/* ==========================================================================
   COTIZADOR AUTOMÁTICO - Sistema de Diseño UI/UX Premium
   Rediseño Visual: Moderno, Limpio, Intuitivo y Altamente Legible
   ========================================================================== */

:root {
  /* Paleta de Acento Principal (Morado / Violeta Premium) */
  --purple-50: #f5f3ff;
  --purple-100: #ede9fe;
  --purple-200: #ddd6fe;
  --purple-300: #c4b5fd;
  --purple-400: #a78bfa;
  --purple-500: #8b5cf6;
  --purple-600: #7c3aed;
  --purple-700: #6d28d9;
  --purple-800: #5b21b6;
  --purple-900: #4c1d95;

  /* Paleta de Acento Secundario - Etiquetado (Azul Vibrante) */
  --blue-50: #eff6ff;
  --blue-100: #dbeafe;
  --blue-200: #bfdbfe;
  --blue-400: #60a5fa;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --blue-800: #1e40af;
  --blue-900: #1e3a5f;

  /* Paleta de Acento Terciario - Producto Terminado (Esmeralda / Teal) */
  --teal-50: #ecfdf5;
  --teal-100: #d1fae5;
  --teal-200: #a7f3d0;
  --teal-400: #34d399;
  --teal-500: #10b981;
  --teal-600: #059669;
  --teal-700: #047857;
  --teal-800: #065f46;
  --teal-900: #064e3b;

  /* Tonos Neutros y Estructurales (Modo Claro) */
  --background: #f8fafc;
  --foreground: #0f172a;
  --card: #ffffff;
  --card-foreground: #0f172a;
  --muted: #f1f5f9;
  --muted-foreground: #64748b;
  --border: #e2e8f0;
  --input: #cbd5e1;
  --ring: #8b5cf6;
  
  /* Botones y Acciones */
  --primary: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-foreground: #ffffff;
  --secondary: #f1f5f9;
  --secondary-foreground: #334155;
  --destructive: #ef4444;
  --destructive-hover: #dc2626;
  --success: #10b981;

  /* Sombras Modernas y Suaves */
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05), 0 1px 2px -1px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.04);
  --shadow-xl: 0 20px 35px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.04);
  --shadow-glow: 0 0 20px rgba(124, 58, 237, 0.15);

  /* Radios de Borde (Geometría Moderna) */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  /* Tipografía Jerárquica */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  
  /* Transiciones */
  --transition-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Modo Oscuro (Sleek Dark Mode con Glassmorphism)
   ========================================================================== */

[data-theme="dark"] {
  --background: #090d16;
  --foreground: #f8fafc;
  --card: #111827;
  --card-foreground: #f8fafc;
  --muted: #1e293b;
  --muted-foreground: #94a3b8;
  --border: #1f2937;
  --input: #334155;
  --ring: #a78bfa;
  --primary: #8b5cf6;
  --primary-hover: #7c3aed;
  --primary-foreground: #ffffff;
  --secondary: #1e293b;
  --secondary-foreground: #e2e8f0;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.6);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.7);
  --shadow-glow: 0 0 25px rgba(139, 92, 246, 0.25);
}

[data-theme="dark"] .kpi-highlight {
  background: linear-gradient(135deg, var(--purple-800) 0%, #3b0764 100%);
  border: 1px solid rgba(167, 139, 250, 0.2);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
}

[data-theme="dark"] .formulacion-table tbody tr:nth-child(even) {
  background: rgba(30, 41, 59, 0.4);
}

[data-theme="dark"] .formulacion-table tbody tr:hover {
  background: rgba(139, 92, 246, 0.12);
}

/* ==========================================================================
   Reseteo y Estilos Base
   ========================================================================== */

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--background);
  color: var(--foreground);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color var(--transition-normal), color var(--transition-normal);
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* ==========================================================================
   Login Overlay
   ========================================================================== */

.login-overlay {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: radial-gradient(circle at top right, var(--purple-100), var(--background));
  padding: 20px;
}

[data-theme="dark"] .login-overlay {
  background: radial-gradient(circle at top right, #1e1b4b, var(--background));
}

.login-card {
  background: var(--card);
  padding: 48px;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border);
  text-align: center;
  max-width: 440px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: linear-gradient(90deg, var(--purple-500), var(--blue-500), var(--teal-400));
}

.login-card h2 {
  margin-bottom: 8px;
  font-size: 1.85rem;
  color: var(--foreground);
}

.login-card p {
  color: var(--muted-foreground);
  margin-bottom: 28px;
  font-size: 0.95rem;
}

.login-error {
  color: var(--destructive);
  margin-top: 16px;
  display: none;
  font-size: 0.9rem;
  font-weight: 500;
  background: rgba(239, 68, 68, 0.1);
  padding: 10px;
  border-radius: var(--radius-sm);
}

/* ==========================================================================
   Estructura Principal de la Aplicación
   ========================================================================== */

.app-content {
  display: none;
  min-height: 100vh;
  background: var(--background);
}

/* Cabecera Flotante con Glassmorphism y Organización Jerárquica */
.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 8px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 1000;
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.04);
  transition: all var(--transition-normal);
  gap: 12px;
}

[data-theme="dark"] .app-header {
  background: rgba(17, 24, 39, 0.92);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.35);
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

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

.header-left h1 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  line-height: 1.15;
  letter-spacing: -0.01em;
  background: linear-gradient(135deg, var(--purple-600), var(--blue-600));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  user-select: none;
}

[data-theme="dark"] .header-left h1 {
  background: linear-gradient(135deg, var(--purple-400), var(--blue-400));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Lado Derecho de la Cabecera */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  justify-content: flex-end;
  flex-shrink: 0;
}

/* Grupo de Acciones del Constructor */
.header-actions-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Botón Agregar Sección */
.btn-add-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: var(--radius-md, 8px);
  background: rgba(99, 102, 241, 0.06);
  color: var(--primary);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  margin: 0;
  box-sizing: border-box;
}

.btn-add-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99, 102, 241, 0.12);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-add-card {
  border-color: rgba(167, 139, 250, 0.3);
  background: rgba(167, 139, 250, 0.08);
  color: #c4b5fd;
}

[data-theme="dark"] .btn-add-card:hover {
  background: rgba(167, 139, 250, 0.16);
  border-color: #a78bfa;
}

/* Botón Webhook n8n */
.btn-webhook-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 13px;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md, 8px);
  background: rgba(245, 158, 11, 0.08);
  color: #d97706;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
  box-sizing: border-box;
}

.btn-webhook-action:hover {
  background: rgba(245, 158, 11, 0.16);
  border-color: #f59e0b;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.18);
}

[data-theme="dark"] .btn-webhook-action {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.3);
  background: rgba(251, 191, 36, 0.08);
}

[data-theme="dark"] .btn-webhook-action:hover {
  background: rgba(251, 191, 36, 0.16);
  border-color: #fbbf24;
}

.btn-webhook-action.is-loading {
  opacity: 0.85;
  cursor: wait;
  pointer-events: none;
}

.btn-webhook-action.status-success {
  background: rgba(16, 185, 129, 0.15) !important;
  border-color: #10b981 !important;
  color: #059669 !important;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25) !important;
}

[data-theme="dark"] .btn-webhook-action.status-success {
  background: rgba(16, 185, 129, 0.2) !important;
  color: #34d399 !important;
}

.btn-webhook-action.status-error {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  color: #dc2626 !important;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.25) !important;
}

[data-theme="dark"] .btn-webhook-action.status-error {
  background: rgba(239, 68, 68, 0.2) !important;
  color: #f87171 !important;
}

.webhook-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(217, 119, 6, 0.3);
  border-top-color: #d97706;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Separadores Estilizados */
.header-separator {
  width: 1px;
  height: 18px;
  background: var(--border);
  opacity: 0.6;
  margin: 0 3px;
}

[data-theme="dark"] .header-separator {
  background: rgba(255, 255, 255, 0.15);
}

/* Botón Primario de Guardar Compacto y Destacado */
.btn-header-save {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: var(--radius-md, 8px);
  background: linear-gradient(135deg, var(--purple-600), var(--blue-600));
  color: #ffffff;
  border: none;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.25);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.btn-header-save:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.35);
}

[data-theme="dark"] .btn-header-save {
  background: linear-gradient(135deg, var(--purple-500), var(--blue-500));
}

/* Contenedor del Menú Desplegable 'Acciones' */
.header-menu-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.header-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 11px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--foreground);
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  cursor: pointer;
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.header-more-btn:hover,
.header-more-btn.active {
  background: var(--card);
  border-color: var(--primary);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .header-more-btn {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}

[data-theme="dark"] .header-more-btn:hover,
[data-theme="dark"] .header-more-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(167, 139, 250, 0.4);
  color: #f8fafc;
}

.menu-chevron {
  width: 13px;
  height: 13px;
  transition: transform 0.2s ease;
}

.header-more-btn.active .menu-chevron {
  transform: rotate(180deg);
}

/* Panel Desplegable Flotante Elegante */
.header-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 340px;
  max-width: calc(100vw - 32px);
  max-height: calc(100vh - 90px);
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 10px;
  box-shadow: 0 14px 38px -6px rgba(0, 0, 0, 0.16), 0 4px 14px rgba(0, 0, 0, 0.06);
  z-index: 1100;
  animation: headerMenuFadeIn 0.15s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes headerMenuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-6px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

[data-theme="dark"] .header-dropdown-menu {
  background: rgba(17, 24, 39, 0.96);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 16px 40px -4px rgba(0, 0, 0, 0.55), 0 4px 16px rgba(0, 0, 0, 0.4);
}

.dropdown-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.dropdown-group-title {
  font-size: 0.67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  padding: 4px 10px 3px;
}

.dropdown-action-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  text-decoration: none;
  color: var(--foreground);
  transition: all var(--transition-fast);
  box-sizing: border-box;
}

.dropdown-action-btn:hover {
  background: var(--muted);
}

[data-theme="dark"] .dropdown-action-btn:hover {
  background: rgba(255, 255, 255, 0.07);
}

.dropdown-action-btn svg,
.dropdown-action-btn i {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
}

.dropdown-action-info {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  min-width: 0;
}

.dropdown-action-name {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--foreground);
  line-height: 1.2;
}

.dropdown-action-hint {
  font-size: 0.71rem;
  color: var(--muted-foreground);
  line-height: 1.2;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 4px;
  opacity: 0.6;
}

[data-theme="dark"] .dropdown-divider {
  background: rgba(255, 255, 255, 0.08);
}

/* Colores de Acentos de Íconos */
.item-icon-purple { color: #8b5cf6 !important; }
.item-icon-blue   { color: #3b82f6 !important; }
.item-icon-green  { color: #10b981 !important; }
.item-icon-amber  { color: #f59e0b !important; }
.item-icon-cyan   { color: #06b6d4 !important; }
.item-icon-pink   { color: #ec4899 !important; }

/* Selector de Tema con Mini Apariencia Dinámica */
.dropdown-theme-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 6px 2px;
}

.dropdown-theme-hint {
  font-size: 0.68rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

/* ==========================================================================
   Selector de Tema con Mini Apariencia Dinámica
   ========================================================================== */
.btn-theme-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 10px;
  background: var(--muted, rgba(0, 0, 0, 0.04));
  border: 1.5px solid var(--border);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  margin-top: 4px;
  text-align: left;
  user-select: none;
}

.btn-theme-trigger:hover,
.btn-theme-trigger.expanded {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .btn-theme-trigger {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.12);
}

[data-theme="dark"] .btn-theme-trigger:hover,
[data-theme="dark"] .btn-theme-trigger.expanded {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(167, 139, 250, 0.6);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

/* Animación sutil al cambiar de tema */
@keyframes triggerThemeFlash {
  0% { transform: scale(0.97); }
  50% { transform: scale(1.02); }
  100% { transform: scale(1); }
}

.btn-theme-trigger.theme-just-changed {
  animation: triggerThemeFlash 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Lado Izquierdo del Trigger */
.theme-trigger-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

/* Miniatura Maqueta de Ventana */
.theme-trigger-swatch {
  width: 38px;
  height: 27px;
  border-radius: 5px;
  border: 1.5px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.14);
  transition: all 0.25s ease;
  flex-shrink: 0;
  position: relative;
  background: #ffffff;
}

.trigger-swatch-header {
  height: 7px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 3px;
  background: rgba(0, 0, 0, 0.08);
  box-sizing: border-box;
}

.trigger-swatch-header .swatch-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .trigger-swatch-header .swatch-dot {
  background: rgba(255, 255, 255, 0.4);
}

.trigger-swatch-canvas {
  flex: 1;
  display: flex;
  padding: 2px;
  gap: 2px;
  box-sizing: border-box;
}

.trigger-swatch-sidebar {
  width: 8px;
  height: 100%;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.08);
}

.trigger-swatch-card {
  flex: 1;
  height: 100%;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.7);
}

.trigger-swatch-chip {
  width: 10px;
  height: 4px;
  border-radius: 2px;
  background: var(--primary);
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
}

/* Información y Tags del Tema Activo */
.theme-trigger-info {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
  min-width: 0;
}

.theme-trigger-title-row {
  display: flex;
  align-items: center;
  gap: 5px;
}

.theme-trigger-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.theme-trigger-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-trigger-tag {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--muted-foreground);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Lado Derecho: Acción y Flecha */
.theme-trigger-right {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.theme-trigger-action-hint {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted-foreground);
  transition: all 0.2s ease;
}

.btn-theme-trigger:hover .theme-trigger-action-hint,
.btn-theme-trigger.expanded .theme-trigger-action-hint {
  background: var(--primary);
  color: #ffffff;
}

.theme-trigger-chevron {
  width: 14px;
  height: 14px;
  color: var(--muted-foreground);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.btn-theme-trigger.expanded .theme-trigger-chevron {
  transform: rotate(180deg);
}

/* ==========================================================================
   Cuadrícula Visual de Mini Tarjetas de Temas
   ========================================================================== */
.theme-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 8px;
  padding: 8px;
  background: var(--muted, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-sizing: border-box;
  animation: themeGridFadeIn 0.18s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes themeGridFadeIn {
  from { opacity: 0; transform: translateY(-5px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

[data-theme="dark"] .theme-options-grid {
  background: rgba(15, 23, 42, 0.85);
  border-color: rgba(255, 255, 255, 0.1);
}

.theme-card-mini {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px 3px 5px;
  border: 1.5px solid transparent;
  background: var(--card);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-sizing: border-box;
  text-align: center;
  min-width: 0;
  overflow: hidden;
}

.theme-card-mini:hover {
  transform: translateY(-2.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
  border-color: var(--primary);
}

.theme-card-mini.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary);
}

.theme-card-mini.active::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  font-weight: 900;
  width: 13px;
  height: 13px;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

[data-theme="dark"] .theme-card-mini {
  background: rgba(30, 41, 59, 0.9);
}

/* Maqueta Mini-Window dentro de cada tarjeta */
.mini-swatch {
  width: 100%;
  height: 24px;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.mini-bar {
  height: 7px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 3px;
  box-sizing: border-box;
}

.mini-microdot {
  width: 2.5px;
  height: 2.5px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
}

.mini-body {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 2px 4px;
  box-sizing: border-box;
}

.mini-accent {
  width: 12px;
  height: 4px;
  border-radius: 2px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.15);
}

.mini-title {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  margin-top: 1px;
}

.mini-tag {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Swatches Visuales de cada Temática
   ========================================================================== */
.swatch-light {
  background: #ffffff;
  border: 1px solid #e2e8f0;
}
.swatch-light .mini-bar { background: #f1f5f9; }
.swatch-light .mini-accent { background: #7c3aed; }

.swatch-dark {
  background: #0f172a;
  border: 1px solid #334155;
}
.swatch-dark .mini-bar { background: #1e293b; }
.swatch-dark .mini-microdot { background: rgba(255, 255, 255, 0.3); }
.swatch-dark .mini-accent { background: #a78bfa; }

.swatch-ciudad {
  background: #08111f;
  border: 1px solid rgba(254, 212, 106, 0.4);
  box-shadow: 0 0 6px rgba(254, 212, 106, 0.2);
}
.swatch-ciudad .mini-bar { background: #0f1b2e; }
.swatch-ciudad .mini-microdot { background: rgba(254, 212, 106, 0.4); }
.swatch-ciudad .mini-accent { background: #fed46a; box-shadow: 0 0 5px #fed46a; }

.swatch-cyberpop {
  background: #ffd500;
  border: 1px solid #000000;
}
.swatch-cyberpop .mini-bar { background: #ffffff; }
.swatch-cyberpop .mini-microdot { background: #000000; }
.swatch-cyberpop .mini-accent { background: #f05a5b; }

.swatch-sakura {
  background: #fff5f7;
  border: 1px solid #fecdd3;
}
.swatch-sakura .mini-bar { background: #fce7eb; }
.swatch-sakura .mini-microdot { background: #f43f5e; }
.swatch-sakura .mini-accent { background: #a95770; }

.swatch-boceto {
  background: #fffaf3;
  border: 1px solid #d6c7b2;
}
.swatch-boceto .mini-bar { background: #f5ede0; }
.swatch-boceto .mini-microdot { background: #8c7860; }
.swatch-boceto .mini-accent { background: #c2410c; }

.swatch-plano {
  background: #003366;
  border: 1px solid #38bdf8;
}
.swatch-plano .mini-bar { background: #002244; }
.swatch-plano .mini-microdot { background: #38bdf8; }
.swatch-plano .mini-accent { background: #38bdf8; }

.swatch-premium {
  background: #0b0b0f;
  border: 1px solid #d97706;
}
.swatch-premium .mini-bar { background: #18181b; }
.swatch-premium .mini-microdot { background: #fbbf24; }
.swatch-premium .mini-accent { background: #fbbf24; }

.swatch-natural {
  background: #fdfbf7;
  border: 1px solid #a7f3d0;
}
.swatch-natural .mini-bar { background: #f0f7f2; }
.swatch-natural .mini-microdot { background: #10b981; }
.swatch-natural .mini-accent { background: #059669; }

.swatch-frosted {
  background: #f5f5f5;
  border: 1px solid #0a0a0a;
}
.swatch-frosted .mini-bar { background: #fafafa; }
.swatch-frosted .mini-microdot { background: #0a0a0a; }
.swatch-frosted .mini-accent { background: #0a0a0a; }

.swatch-slush {
  background: #dceeff;
  border: 1.5px solid #000000;
}
.swatch-slush .mini-bar { background: #ffffff; }
.swatch-slush .mini-microdot { background: #fb4903; }
.swatch-slush .mini-accent { background: #4da2ff; }

.swatch-superr {
  background: #fdfbf9;
  border: 1.5px solid #171717;
}
.swatch-superr .mini-bar { background: #f7efe9; }
.swatch-superr .mini-microdot { background: #ff6f1e; }
.swatch-superr .mini-accent { background: #ff6f1e; }

.main-content {
  padding: 24px 36px;
  max-width: 98%;
  margin: 0 auto;
}

/* ==========================================================================
   Barra de Datos del Proyecto (Información Integrada y Remodelada)
   ========================================================================== */
.project-info-bar {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 24px;
  margin-bottom: 26px;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
  transition: all var(--transition-normal);
}

.project-info-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--purple-500), var(--blue-500));
}

.project-info-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.project-info-header-title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.project-info-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--primary);
  background: rgba(99, 102, 241, 0.08);
  padding: 3px 10px;
  border-radius: 6px;
}

.project-info-pill svg {
  width: 14px;
  height: 14px;
}

.project-info-desc {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  font-weight: 500;
}

.project-info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 18px;
  align-items: end;
}

.project-info-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.project-info-item label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted-foreground);
  display: flex;
  align-items: center;
  gap: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.project-info-item label svg {
  width: 14px;
  height: 14px;
  color: var(--primary);
}

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

.input-with-unit .info-input {
  width: 100%;
  padding-right: 38px;
}

.input-unit-badge {
  position: absolute;
  right: 12px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted-foreground);
  pointer-events: none;
  background: var(--muted);
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.info-input {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  font-size: 0.95rem;
  color: var(--foreground);
  transition: all var(--transition-fast);
  font-family: var(--font-body);
}

.info-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
  outline: none;
}

.info-input.input-error-highlight {
  border-color: #ef4444 !important;
  box-shadow: 0 0 0 3.5px rgba(239, 68, 68, 0.3) !important;
  animation: input-shake 0.38s ease-in-out !important;
}

@keyframes input-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-5px); }
  40%, 80% { transform: translateX(5px); }
}

@media (max-width: 900px) {
  .project-info-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }
}

/* ==========================================================================
   Títulos y Secciones
   ========================================================================== */

.content-section {
  margin-bottom: 36px;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground);
}

.section-badge {
  background: var(--primary);
  color: white;
  padding: 4px 14px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
}

/* ==========================================================================
   Componente Base: Cards
   ========================================================================== */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), border-color var(--transition-fast);
}

.card:hover {
  box-shadow: var(--shadow-lg);
}

.card-content {
  padding: 0;
}

/* ==========================================================================
   Botones Premium con Micro-animaciones
   ========================================================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  border: 1px solid transparent;
  user-select: none;
}

.btn:active {
  transform: scale(0.97);
}

.btn svg, .btn i {
  width: 18px;
  height: 18px;
  transition: transform var(--transition-fast);
}

.btn:hover svg, .btn:hover i {
  transform: scale(1.1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--purple-600), var(--purple-700));
  color: var(--primary-foreground);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.25);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--purple-700), var(--purple-800));
  box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
  transform: translateY(-1px);
}

.btn-outline {
  background: var(--card);
  color: var(--foreground);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
}

.btn-outline:hover {
  background: var(--muted);
  border-color: var(--input);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--muted-foreground);
  border: none;
  padding: 10px;
  border-radius: var(--radius-md);
}

.btn-ghost:hover {
  background: var(--muted);
  color: var(--foreground);
}

/* ==========================================================================
   Buscador Moderno Unificado (Sin doble marco, limpio y ligero)
   ========================================================================== */

.search-container {
  position: relative;
  margin-bottom: 12px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 38px;
  padding: 0 14px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md, 8px);
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15), var(--shadow-sm);
}

[data-theme="dark"] .search-box:focus-within {
  box-shadow: 0 0 0 3px rgba(167, 139, 250, 0.2), var(--shadow-sm);
}

.search-box svg,
.search-box i {
  width: 16px;
  height: 16px;
  color: var(--muted-foreground);
  flex-shrink: 0;
}

/* Input interno sin bordes ni fondos propios para evitar doble recuadro */
.search-box .search-input,
.search-box input,
.search-box-sm .search-input,
.search-box-sm input {
  flex: 1;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
  padding: 0 !important;
  margin: 0 !important;
  font-size: 0.88rem;
  font-family: var(--font-sans);
  color: var(--foreground) !important;
  width: 100% !important;
}

.search-box .search-input:focus,
.search-box input:focus,
.search-box-sm .search-input:focus,
.search-box-sm input:focus {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  outline: none !important;
}

.search-box .search-input::placeholder,
.search-box-sm .search-input::placeholder {
  color: var(--muted-foreground);
  font-size: 0.84rem;
}

.search-box-sm {
  height: 32px;
  padding: 0 10px;
  border-radius: 6px;
}

.search-loading {
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  max-height: 340px;
  overflow-y: auto;
  z-index: 100;
  display: none;
  overflow-x: hidden;
}

.search-results.active {
  display: block;
  animation: slideDown 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-result-item {
  padding: 14px 18px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background var(--transition-fast), padding-left var(--transition-fast);
}

.search-result-item:last-child {
  border-bottom: none;
}

.search-result-item:hover {
  background: var(--purple-50);
  padding-left: 22px;
}

[data-theme="dark"] .search-result-item:hover {
  background: rgba(139, 92, 246, 0.15);
}

.search-result-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
  margin-bottom: 2px;
}

.search-result-ref {
  font-size: 0.825rem;
  font-family: var(--font-mono);
  color: var(--primary);
}

.search-no-results {
  padding: 24px;
  text-align: center;
  color: var(--muted-foreground);
  font-size: 0.95rem;
}

.mo-search-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 5px;
  font-size: 0.78rem;
  flex-wrap: wrap;
}

.mo-search-badge {
  background: rgba(124, 58, 237, 0.12);
  color: var(--primary);
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.74rem;
  font-family: var(--font-mono, monospace);
  letter-spacing: 0.02em;
}

.mo-search-dur,
.mo-search-emp {
  color: var(--muted-foreground);
  font-size: 0.74rem;
  font-weight: 500;
}

[data-theme="dark"] .mo-search-badge {
  background: rgba(124, 58, 237, 0.25);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.35);
}

/* Tarjeta de Lista de Materiales en Resultados MOD */
.mo-bom-result-item {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mo-bom-result-item:hover {
  background: var(--muted, rgba(124, 58, 237, 0.07));
}

.mo-bom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mo-bom-title {
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--foreground);
  line-height: 1.25;
}

.mo-bom-dur-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(16, 185, 129, 0.12);
  color: #10b981;
  font-family: var(--font-mono, monospace);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm, 4px);
  white-space: nowrap;
  flex-shrink: 0;
}

[data-theme="dark"] .mo-bom-dur-badge {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}

.mo-bom-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.mo-badge-ref {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

[data-theme="dark"] .mo-badge-ref {
  background: rgba(59, 130, 246, 0.25);
  color: #93c5fd;
}

.mo-badge-marmita {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  font-weight: 700;
}

[data-theme="dark"] .mo-badge-marmita {
  background: rgba(245, 158, 11, 0.25);
  color: #fcd34d;
}

.mo-badge-list {
  background: rgba(139, 92, 246, 0.12);
  color: var(--primary);
}

.mo-bom-ops-count {
  font-size: 0.72rem;
  color: var(--muted-foreground);
  font-weight: 600;
  margin-left: auto;
}

.mo-bom-ops-preview {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 1px;
}

.mo-op-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--card, #fff);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.71rem;
  color: var(--foreground);
}

.mo-op-pill-name {
  font-weight: 600;
}

.mo-op-pill-center {
  color: var(--muted-foreground);
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
}

.mo-op-pill-time {
  color: var(--primary);
  font-weight: 700;
  font-size: 0.68rem;
}

/* ==========================================================================
   Layout de Formulación (Grid Responsive)
   ========================================================================== */

.formulacion-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(380px, 0.8fr);
  gap: 24px;
  align-items: start;
}

.formulacion-table-column {
  min-width: 0;
}

.formulacion-summary-column {
  min-width: 0;
}

@media (max-width: 1024px) {
  .formulacion-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .side-panel-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
  }
  .side-kpi-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .side-panel-content {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Panel Lateral Unificado (Mano de Obra + Resumen Financiero + KPI)
   ========================================================================== */

.side-panel-card {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.side-panel-content {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px;
}

/* Secciones Internas del Panel Lateral (Clean & Desaturado de Rectángulos) */
.side-panel-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 0 0 16px 0;
  background: transparent;
  border: none;
  border-radius: 0;
  border-bottom: 1px solid var(--border);
}

.side-panel-section:last-of-type,
.side-panel-section.side-panel-financial {
  border-bottom: none;
  padding-bottom: 0;
}

.side-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 4px;
}

.side-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-heading);
  font-size: 0.9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--foreground);
}

.side-section-title i, .side-section-title svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.side-mo-badge {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--card);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 999px;
}

/* Barra de Búsqueda y Botones de Mano de Obra */
.mo-controls-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mo-btn-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-mo-action {
  flex: 1;
  min-width: 110px;
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  background: var(--card);
  color: var(--foreground);
  border: 1px solid var(--border);
  transition: all var(--transition-fast);
}

.btn-mo-action:hover {
  background: var(--background);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-mo-predict {
  background: var(--btn-predict-bg, rgba(124, 58, 237, 0.08));
  color: var(--btn-predict-color, var(--purple-700, #7c3aed));
  border-color: var(--btn-predict-border, rgba(124, 58, 237, 0.28));
}

.btn-mo-predict:hover {
  background: var(--btn-predict-hover-bg, rgba(124, 58, 237, 0.16));
  border-color: var(--btn-predict-color, var(--primary));
  color: var(--btn-predict-color, var(--primary));
}

.btn-mo-escalera {
  background: var(--btn-escalera-bg, rgba(2, 132, 199, 0.08));
  color: var(--btn-escalera-color, var(--blue-700, #0284c7));
  border-color: var(--btn-escalera-border, rgba(2, 132, 199, 0.28));
}

.btn-mo-escalera:hover {
  background: var(--btn-escalera-hover-bg, rgba(2, 132, 199, 0.16));
  border-color: var(--btn-escalera-color, #0284c7);
  color: var(--btn-escalera-color, #0284c7);
}

[data-theme="dark"] .btn-mo-predict {
  background: rgba(124, 58, 237, 0.18);
  color: #c4b5fd;
  border-color: rgba(167, 139, 250, 0.35);
}

[data-theme="dark"] .btn-mo-escalera {
  background: rgba(2, 132, 199, 0.18);
  color: #7dd3fc;
  border-color: rgba(56, 189, 248, 0.35);
}

/* Impresión */
.imp-card-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.imp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.imp-name {
  font-weight: 600;
  color: var(--foreground);
}

.imp-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
}

/* Filas Financieras (Zero Overlap Guaranteed) */
.financial-card-box {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.fin-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 3px 0;
  width: 100%;
}

.fin-label {
  font-size: 0.85rem;
  color: var(--muted-foreground);
  flex: 1;
  min-width: 100px;
}

.fin-val {
  font-family: var(--font-mono);
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--foreground);
  text-align: right;
  flex-shrink: 0;
}

.fin-divider {
  height: 1px;
  background: var(--border);
  margin: 3px 0;
}

.fin-row-subtotal {
  padding: 4px 0;
}

.fin-val-highlight {
  font-size: 1.05rem;
  color: var(--primary);
}

.fin-flete-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.fin-input-badge-wrap {
  display: inline-flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  transition: border-color var(--transition-fast);
}

.fin-input-badge-wrap:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.fin-num-input {
  width: 48px;
  border: none !important;
  background: transparent !important;
  padding: 2px 4px !important;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  outline: none;
  box-shadow: none !important;
}

.fin-input-badge {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-foreground);
}

.fin-badge-currency {
  margin-right: 2px;
}

.fin-precio-field {
  width: 78px;
}

/* Caja de Margen Comercial (Limpia sin caja anidada) */
.fin-margen-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 6px 0 0 0;
  background: transparent;
  border: none;
  border-radius: 0;
  margin-top: 2px;
}

.fin-margen-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.fin-margen-body {
  width: 100%;
}

.fin-margen-inputs-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
}

.fin-margen-result-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.fin-res-caption {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  font-weight: 600;
}

.fin-margen-pct-val {
  color: var(--teal-600);
}

[data-theme="dark"] .fin-margen-pct-val {
  color: var(--teal-400);
}

/* Tarjeta KPI Highlight en Panel Lateral */
.side-kpi-card {
  padding: 16px 18px;
  border-radius: var(--radius-md);
  color: white;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 8px 20px -4px rgba(0, 0, 0, 0.25);
  margin-top: 4px;
}

.side-kpi-card.kpi-purple {
  background: linear-gradient(135deg, #7c3aed 0%, #5b21b6 100%);
}

.side-kpi-card.kpi-blue {
  background: linear-gradient(135deg, #2563eb 0%, #1e40af 100%);
}

.side-kpi-card.kpi-teal {
  background: linear-gradient(135deg, #059669 0%, #065f46 100%);
}

/* ==========================================================================
   Tablas de Cotización Ultra Legibles
   ========================================================================== */

.table-container {
  overflow-x: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--card);
  width: 100%;
}

.formulacion-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
}

.formulacion-table th {
  background: var(--muted);
  color: var(--muted-foreground);
  padding: 12px 14px;
  text-align: left;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}

[data-theme="dark"] .formulacion-table th {
  background: rgba(15, 23, 42, 0.7);
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
}

.formulacion-table th:first-child {
  border-top-left-radius: var(--radius-md);
}

.formulacion-table th:last-child {
  border-top-right-radius: var(--radius-md);
  border-right: none;
}

.formulacion-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.formulacion-table tbody tr {
  transition: background-color var(--transition-fast);
}

.formulacion-table tbody tr:nth-child(even) {
  background: var(--muted);
}

.formulacion-table tbody tr:hover {
  background: var(--purple-50);
}

/* Anchos de columnas optimizados para fluidez visual sin desbordamientos innecesarios */
.col-ref { width: 130px; min-width: 110px; }
.col-ref-nombre { min-width: 150px; }
.col-cant { width: 85px; min-width: 72px; }
.col-cost { width: 110px; min-width: 95px; }
.col-total { width: 105px; min-width: 90px; }
.col-action { width: 32px; text-align: center; }

.table-container::-webkit-scrollbar {
  height: 5px;
  width: 5px;
}

.table-container::-webkit-scrollbar-track {
  background: transparent;
}

.table-container::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.table-container::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* Celdas de Total Destacadas */
.cell-total {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  padding: 4px;
  text-align: right;
}

/* Botón Eliminar Fila */
.btn-remove-row {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-remove-row:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: var(--destructive);
  color: var(--destructive);
  transform: rotate(90deg);
}

/* ==========================================================================
   Secciones Dinámicas (Granel, Etiquetado, Producto Terminado)
   ========================================================================== */

.granel-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  margin-bottom: 24px;
  transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
  border-left: 5px solid var(--purple-600);
}

.granel-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--purple-300);
}

/* Variante Azul (Etiquetado) */
.granel-card.card-blue {
  border-left-color: var(--blue-600);
}

.granel-card.card-blue:hover {
  border-color: var(--blue-300);
}

/* Variante Teal (Producto Terminado) */
.granel-card.card-teal {
  border-left-color: var(--teal-600);
}

.granel-card.card-teal:hover {
  border-color: var(--teal-300);
}

/* Section Type Pill Badges */
.section-type-badge {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-heading);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 999px;
  flex-shrink: 0;
}

.section-type-badge.badge-pill-purple {
  background: var(--purple-100);
  color: var(--purple-700);
  border: 1px solid var(--purple-300);
}

.section-type-badge.badge-pill-blue {
  background: var(--blue-100);
  color: var(--blue-700);
  border: 1px solid var(--blue-300);
}

.section-type-badge.badge-pill-teal {
  background: var(--teal-100);
  color: var(--teal-700);
  border: 1px solid var(--teal-300);
}

[data-theme="dark"] .section-type-badge.badge-pill-purple {
  background: rgba(124, 58, 237, 0.2);
  color: var(--purple-300);
  border-color: rgba(124, 58, 237, 0.4);
}

[data-theme="dark"] .section-type-badge.badge-pill-blue {
  background: rgba(37, 99, 235, 0.2);
  color: var(--blue-300);
  border-color: rgba(37, 99, 235, 0.4);
}

[data-theme="dark"] .section-type-badge.badge-pill-teal {
  background: rgba(16, 185, 129, 0.2);
  color: var(--teal-300);
  border-color: rgba(16, 185, 129, 0.4);
}

/* Editable Section Title Label */
.granel-label {
  position: static;
  background: transparent;
  color: var(--foreground);
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  text-transform: none;
  letter-spacing: -0.01em;
  cursor: text;
  outline: none;
  box-shadow: none;
  border: 1px dashed transparent;
  transition: all var(--transition-fast);
}

.granel-label:hover {
  border-color: var(--border);
  background: var(--muted);
}

.granel-label:focus {
  background: var(--card);
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* ==========================================================================
   Armonización de Colores por Sección (Azul / Teal)
   Reemplaza el morado predeterminado en tablas, laterales y controles
   ========================================================================== */

/* --- Sección ETIQUETADO (Azul) --- */
.granel-card.card-blue .formulacion-table tbody tr:hover {
  background: #eff6ff;
}
[data-theme="dark"] .granel-card.card-blue .formulacion-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.12);
}
[data-theme="dark"] .granel-card.card-blue .formulacion-table th {
  border-bottom-color: var(--blue-600);
}
.granel-card.card-blue .cell-total {
  color: var(--blue-600);
}
[data-theme="dark"] .granel-card.card-blue .cell-total {
  color: #60a5fa;
}
.granel-card.card-blue .resumen-card {
  border-color: #bfdbfe;
}
[data-theme="dark"] .granel-card.card-blue .resumen-card {
  border-color: rgba(37, 99, 235, 0.4);
}
.granel-card.card-blue .summary-title::before {
  background: var(--blue-600);
}
.granel-card.card-blue .input-field:focus {
  border-color: var(--blue-600);
  box-shadow: 0 0 0 3px #dbeafe;
}
[data-theme="dark"] .granel-card.card-blue .input-field:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25);
}
.granel-card.card-blue .mo-card-center {
  color: var(--blue-600);
  background: #eff6ff;
}
[data-theme="dark"] .granel-card.card-blue .mo-card-center {
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.2);
}
.granel-card.card-blue .btn-add-mo:hover,
.granel-card.card-blue .btn-add-row:hover {
  border-color: var(--blue-600);
  color: var(--blue-600);
  background: #eff6ff;
}
[data-theme="dark"] .granel-card.card-blue .btn-add-mo:hover,
[data-theme="dark"] .granel-card.card-blue .btn-add-row:hover {
  border-color: #60a5fa;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.15);
}
.granel-card.card-blue .search-result-item:hover,
.granel-card.card-blue .ref-autocomplete-item:hover {
  background: #eff6ff;
}
[data-theme="dark"] .granel-card.card-blue .search-result-item:hover,
[data-theme="dark"] .granel-card.card-blue .ref-autocomplete-item:hover {
  background: rgba(37, 99, 235, 0.15);
}
.granel-card.card-blue .ref-ac-ref {
  color: var(--blue-600);
}
[data-theme="dark"] .granel-card.card-blue .ref-ac-ref {
  color: #60a5fa;
}

/* --- Sección PRODUCTO TERMINADO (Teal / Verde) --- */
.granel-card.card-teal .formulacion-table tbody tr:hover {
  background: #ecfdf5;
}
[data-theme="dark"] .granel-card.card-teal .formulacion-table tbody tr:hover {
  background: rgba(16, 185, 129, 0.12);
}
[data-theme="dark"] .granel-card.card-teal .formulacion-table th {
  border-bottom-color: var(--teal-600);
}
.granel-card.card-teal .cell-total {
  color: var(--teal-600);
}
[data-theme="dark"] .granel-card.card-teal .cell-total {
  color: #34d399;
}
.granel-card.card-teal .resumen-card {
  border-color: #a7f3d0;
}
[data-theme="dark"] .granel-card.card-teal .resumen-card {
  border-color: rgba(16, 185, 129, 0.4);
}
.granel-card.card-teal .summary-title::before {
  background: var(--teal-600);
}
.granel-card.card-teal .input-field:focus {
  border-color: var(--teal-600);
  box-shadow: 0 0 0 3px #d1fae5;
}
[data-theme="dark"] .granel-card.card-teal .input-field:focus {
  border-color: #34d399;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
}
.granel-card.card-teal .mo-card-center {
  color: var(--teal-600);
  background: #ecfdf5;
}
[data-theme="dark"] .granel-card.card-teal .mo-card-center {
  color: #34d399;
  background: rgba(16, 185, 129, 0.2);
}
.granel-card.card-teal .btn-add-mo:hover,
.granel-card.card-teal .btn-add-row:hover {
  border-color: var(--teal-600);
  color: var(--teal-600);
  background: #ecfdf5;
}
[data-theme="dark"] .granel-card.card-teal .btn-add-mo:hover,
[data-theme="dark"] .granel-card.card-teal .btn-add-row:hover {
  border-color: #34d399;
  color: #34d399;
  background: rgba(16, 185, 129, 0.15);
}
.granel-card.card-teal .search-result-item:hover,
.granel-card.card-teal .ref-autocomplete-item:hover {
  background: #ecfdf5;
}
[data-theme="dark"] .granel-card.card-teal .search-result-item:hover,
[data-theme="dark"] .granel-card.card-teal .ref-autocomplete-item:hover {
  background: rgba(16, 185, 129, 0.15);
}
.granel-card.card-teal .ref-ac-ref {
  color: var(--teal-600);
}
[data-theme="dark"] .granel-card.card-teal .ref-ac-ref {
  color: #34d399;
}


/* Cabecera Granel y Segmented Toggle */
.granel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.granel-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
  row-gap: 8px;
}

.granel-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--muted);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.granel-toggle-btn {
  padding: 4px 14px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  line-height: 1.2;
}

.granel-toggle-btn:hover {
  color: var(--foreground);
}

.granel-toggle-btn.active {
  background: var(--card);
  color: var(--blue-600);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .granel-toggle-btn.active {
  color: var(--blue-400);
}

/* ==========================================================================
   Selector de Modo Margen / Precio (PT)
   ========================================================================== */

.pt-calc-mode-toggle {
  display: inline-flex;
  align-items: center;
  background: var(--muted);
  border-radius: var(--radius-sm);
  padding: 2px;
  gap: 2px;
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.04);
}

.pt-mode-btn {
  padding: 2px 7px;
  border: none;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.3;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.pt-mode-btn:hover {
  color: var(--foreground);
}

.pt-mode-btn.active {
  background: var(--card);
  color: var(--teal-700);
  box-shadow: var(--shadow-sm);
}

[data-theme="dark"] .pt-mode-btn.active {
  background: var(--secondary);
  color: var(--teal-300);
}

/* ==========================================================================
   Impresión Sección
   ========================================================================== */

.imp-envase-row, .imp-pct-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
}

.imp-envase-name {
  font-weight: 600;
  color: var(--foreground);
  flex: 1;
}

.imp-envase-valor {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--blue-600);
}

.imp-pct-row .input-field {
  width: 80px;
  text-align: center;
}

/* ==========================================================================
   KPI Dual
   ========================================================================== */

.kpi-dual {
  display: flex;
  align-items: center;
  justify-content: space-around;
  gap: 12px;
  width: 100%;
}

.kpi-dual-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.kpi-dual-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.85;
}

.kpi-dual-divider {
  width: 1px;
  height: 36px;
  background: rgba(255, 255, 255, 0.3);
}

/* ==========================================================================
   Autocomplete Dropdown
   ========================================================================== */

.ref-autocomplete {
  position: relative;
}

.ref-autocomplete-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  max-height: 260px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  margin-top: 4px;
}

.ref-autocomplete-list.active {
  display: block;
}

.ref-autocomplete-item {
  padding: 12px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background var(--transition-fast);
}

.ref-autocomplete-item:last-child {
  border-bottom: none;
}

.ref-autocomplete-item:hover {
  background: var(--purple-50);
}

[data-theme="dark"] .ref-autocomplete-item:hover {
  background: rgba(139, 92, 246, 0.15);
}

.ref-ac-ref {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  font-family: var(--font-mono);
}

.ref-ac-name {
  font-size: 0.85rem;
  color: var(--muted-foreground);
}

/* ==========================================================================
   Inputs y Campos de Formulario Premium
   ========================================================================== */

/* Remover flechas de spinners para evitar que roben espacio en campos numéricos */
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.input-field {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--input);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  transition: all var(--transition-fast);
  text-overflow: ellipsis;
}

.formulacion-table .input-field {
  padding: 4px 6px;
  font-size: 0.8rem;
}

.formulacion-table .input-field:not(:focus):not(:hover) {
  background: transparent !important;
  border-color: transparent !important;
  box-shadow: none !important;
}

.formulacion-table .input-field[readonly] {
  background: transparent !important;
  border-color: transparent !important;
  pointer-events: none;
  color: var(--muted-foreground);
}

.input-field:focus {
  outline: none;
  border-color: var(--ring);
  box-shadow: 0 0 0 3px var(--purple-100);
  background: var(--card);
}

[data-theme="dark"] .input-field:focus {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.25);
}

.input-field:disabled {
  background: var(--muted);
  color: var(--muted-foreground);
  cursor: not-allowed;
  opacity: 0.7;
}

.input-field.input-number {
  font-family: var(--font-mono);
  font-weight: 600;
  text-align: right;
}

.input-field.input-sm {
  padding: 6px 10px;
  font-size: 0.85rem;
}

/* Campos Editables */
.input-field.editable {
  border-color: rgba(139, 92, 246, 0.3);
  background: rgba(139, 92, 246, 0.04);
}

.input-field.editable:hover {
  border-color: var(--primary);
}

.input-field.editable:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
  background: var(--card);
}

[data-theme="dark"] .input-field.editable {
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.4);
}

/* Campo Solo Lectura */
.input-field[readonly] {
  background: var(--muted);
  color: var(--muted-foreground);
  cursor: not-allowed;
}

.tooltip-warning {
  position: relative;
}

.tooltip-warning::after {
  content: 'Solo lectura - Editar en Supabase';
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 12px;
  background: var(--foreground);
  color: var(--background);
  font-size: 0.75rem;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-fast);
  z-index: 20;
}

.tooltip-warning:hover::after {
  opacity: 1;
}

/* ==========================================================================
   Tarjeta de Resumen Lateral (Invoice Summary Card)
   ========================================================================== */

.resumen-card {
  position: sticky;
  top: 96px;
  border: 2px solid var(--purple-200);
  background: var(--card);
  box-shadow: var(--shadow-xl);
}

[data-theme="dark"] .resumen-card {
  border-color: var(--purple-900);
}

.resumen-card .card-content {
  padding: 24px;
}

.summary-section {
  margin-bottom: 20px;
}

.summary-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--foreground);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: var(--primary);
  border-radius: 2px;
}

.summary-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.summary-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
}

.summary-label {
  font-size: 0.9rem;
  color: var(--muted-foreground);
}

.summary-value {
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--foreground);
}

.summary-grid-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* ==========================================================================
   Mano de Obra - Componentes
   ========================================================================== */

.mo-data-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 16px;
  background: var(--muted);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  margin-bottom: 12px;
}

.mo-field-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mo-field-group label {
  font-size: 0.725rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
}

.mo-card-header {
  grid-column: 1 / -1; /* Cabecera abarca todo el ancho del grid */
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.mo-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--foreground);
}

.mo-card-title-container {
  display: flex;
  align-items: center;
  position: relative;
  flex: 1 1 140px;
  min-width: 0;
}

.mo-card-title-input {
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--foreground);
  background: transparent;
  border: 1px dashed transparent;
  border-radius: var(--radius-sm, 6px);
  padding: 4px 24px 4px 6px;
  width: 100%;
  min-width: 80px;
  cursor: text;
  transition: all var(--transition-fast, 0.15s ease);
}

.mo-card-title-input:hover {
  background: var(--card);
  border-color: rgba(139, 92, 246, 0.4);
}

.mo-card-title-input:focus {
  background: var(--card);
  border: 1px solid var(--primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.18);
  outline: none;
}

[data-theme="dark"] .mo-card-title-input:hover {
  border-color: rgba(139, 92, 246, 0.5);
}

.mo-title-edit-hint {
  position: absolute;
  right: 6px;
  pointer-events: none;
  color: var(--muted-foreground);
  opacity: 0.45;
  display: flex;
  align-items: center;
  transition: all var(--transition-fast, 0.15s ease);
}

.mo-card-title-container:hover .mo-title-edit-hint {
  opacity: 1;
  color: var(--primary);
}

.mo-card-title-input:focus ~ .mo-title-edit-hint {
  opacity: 0;
  pointer-events: none;
}

.mo-card-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: auto;
}

.mo-card-center {
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  background: var(--purple-50);
  padding: 4px 10px;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

[data-theme="dark"] .mo-card-center {
  background: rgba(139, 92, 246, 0.2);
}

.mo-card-remove {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-size: 1.2rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mo-card-remove:hover {
  background: var(--destructive);
  border-color: var(--destructive);
  color: white;
}

.btn-add-mo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  margin-top: 10px;
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  color: var(--muted-foreground);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-mo:hover {
  background: var(--purple-50);
  border-color: var(--primary);
  color: var(--primary);
}

[data-theme="dark"] .btn-add-mo:hover {
  background: rgba(139, 92, 246, 0.1);
}

.mo-breakdown {
  margin-top: 16px;
  padding: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.mo-breakdown-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.mo-breakdown-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  font-size: 0.9rem;
}

.mo-breakdown-row span:last-child {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--foreground);
}

.mo-breakdown-total {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  margin-top: 10px;
  border-top: 2px solid var(--border);
  font-weight: 700;
}

.mo-breakdown-total span:last-child {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  color: var(--primary);
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-group label {
  font-size: 0.8rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ==========================================================================
   KPI Highlight Banner (Total General)
   ========================================================================== */

.kpi-highlight {
  background: linear-gradient(135deg, var(--purple-600) 0%, #4c1d95 100%);
  color: white;
  padding: 20px 16px;
  border-radius: var(--radius-lg);
  text-align: center;
  box-shadow: 0 10px 25px -5px rgba(124, 58, 237, 0.4);
  transition: transform var(--transition-fast);
  overflow: hidden; /* Evita desbordamiento del símbolo $ o cifras grandes */
}

.kpi-highlight:hover {
  transform: translateY(-2px);
}

.kpi-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.9;
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
}

.kpi-value {
  font-size: 1.35rem; /* Tamaño optimizado para que quepan cifras largas sin salirse */
  font-weight: 700;
  font-family: var(--font-mono);
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* ==========================================================================
   Botón Agregar Fila
   ========================================================================== */

.table-box-container {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.add-row-container {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-top: none;
  background: var(--card);
  border-bottom-left-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-add-row {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: 1;
  padding: 8px 16px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-row:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--purple-50);
}

[data-theme="dark"] .btn-add-row:hover {
  background: rgba(139, 92, 246, 0.1);
}

.btn-clear-table {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  color: var(--muted-foreground);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
}

.btn-clear-table:hover {
  border-color: var(--destructive, #ef4444);
  color: var(--destructive, #ef4444);
  background: rgba(239, 68, 68, 0.08);
}

[data-theme="dark"] .btn-clear-table:hover {
  background: rgba(239, 68, 68, 0.15);
}

/* ==========================================================================
   Controles de Cards Dinámicas
   ========================================================================== */

.btn-add-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1.5px dashed rgba(99, 102, 241, 0.4);
  border-radius: var(--radius-md);
  background: rgba(99, 102, 241, 0.04);
  color: var(--primary);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-add-card:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(99, 102, 241, 0.1);
  transform: translateY(-1px);
}

[data-theme="dark"] .btn-add-card:hover {
  background: rgba(167, 139, 250, 0.15);
}

.btn-remove-card {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  margin-left: auto;
}

.btn-remove-card:hover {
  background: rgba(239, 68, 68, 0.15);
  color: var(--destructive);
  transform: rotate(90deg);
}

.add-card-menu {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 8px;
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 200px;
  z-index: 1000;
  animation: slideDown 0.15s ease;
}

.add-card-option {
  display: block;
  width: 100%;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--foreground);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background var(--transition-fast);
}

.add-card-option:hover {
  background: var(--muted);
  padding-left: 20px;
}

.add-card-option.card-color-purple { border-left: 4px solid var(--purple-500); }
.add-card-option.card-color-blue { border-left: 4px solid var(--blue-500); }
.add-card-option.card-color-teal { border-left: 4px solid var(--teal-500); }

.granel-card[draggable="true"] { cursor: grab; }
.granel-card[draggable="true"]:active { cursor: grabbing; }
.granel-card.dragging { opacity: 0.4; transform: scale(0.98); }

.drag-handle {
  cursor: grab;
  color: var(--muted-foreground);
  font-size: 1.2rem;
  padding: 0 6px;
  user-select: none;
  transition: color var(--transition-fast);
}

.drag-handle:hover { color: var(--foreground); }

/* ==========================================================================
   Toast Notifications
   ========================================================================== */

.toast {
  position: fixed;
  bottom: 32px;
  right: 32px;
  padding: 16px 28px;
  border-radius: var(--radius-lg);
  background: var(--primary);
  color: white;
  font-size: 0.95rem;
  font-weight: 600;
  box-shadow: var(--shadow-xl);
  z-index: 9999;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.toast.success { background: var(--success); }
.toast.error { background: var(--destructive); }

/* ==========================================================================
   Animaciones Keyframes
   ========================================================================== */

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Adaptabilidad Responsiva (Mobile, Tablet & Desktop)
   ========================================================================== */

@media (max-width: 900px) {
  .app-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 12px 18px;
  }

  .header-left {
    justify-content: space-between;
    width: 100%;
  }

  .header-right {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
  }

  .header-actions-group {
    flex-wrap: wrap;
  }

  .btn-add-card, .btn-webhook-action {
    flex: 1;
    justify-content: center;
  }

  .main-content {
    padding: 16px 12px;
  }

  .granel-card {
    padding: 36px 14px 16px 14px;
  }

  .granel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .mo-data-card {
    grid-template-columns: 1fr;
  }

  .kpi-value {
    font-size: 1.6rem;
  }
}

/* ==========================================================================
   Drawer de Historial y Modales de Guardado
   ========================================================================== */

.drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(4px);
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.drawer-panel {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: 420px;
  max-width: 90vw;
  background: var(--card);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.25);
  z-index: 1001;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.drawer-panel.open {
  transform: translateX(0);
}

.drawer-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.drawer-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--foreground);
}

.drawer-title svg, .drawer-title i {
  color: var(--primary);
  width: 22px;
  height: 22px;
}

.drawer-search {
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--muted);
}

.drawer-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.drawer-item {
  background: var(--background);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: all var(--transition-fast);
}

.drawer-item:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.drawer-item-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.drawer-item-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--foreground);
}

.drawer-item-date {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.drawer-item-total {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--primary);
}

.drawer-item-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 4px;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

/* Modales */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 1100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  animation: fadeInScale 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.modal-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--foreground);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  padding: 16px 24px;
  background: var(--muted);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

/* ==========================================================================
   Modal Sincronización Webhook / Base de Datos con Temporizador 60s
   ========================================================================== */
.modal-sync-card {
  max-width: 460px;
  text-align: center;
}

.modal-sync-card .modal-header {
  justify-content: space-between;
}

.modal-sync-card .modal-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.05rem;
}

.modal-sync-card .modal-header h3 svg {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.modal-sync-body {
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.sync-state-view {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.sync-timer-container {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
}

.sync-timer-ring {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid var(--primary);
  background: rgba(99, 102, 241, 0.06);
  box-shadow: 0 0 24px rgba(99, 102, 241, 0.18);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  animation: pulseGlow 2.5s infinite ease-in-out;
}

[data-theme="dark"] .sync-timer-ring {
  background: rgba(167, 139, 250, 0.08);
  border-color: #a78bfa;
  box-shadow: 0 0 24px rgba(167, 139, 250, 0.25);
}

#sync-countdown-text {
  font-size: 1.65rem;
  font-weight: 800;
  font-family: var(--font-mono);
  color: var(--primary);
  line-height: 1;
}

.sync-timer-unit {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted-foreground);
  margin-top: 2px;
  letter-spacing: 0.05em;
}

.sync-progress-bar-wrapper {
  width: 100%;
  height: 8px;
  background: var(--muted);
  border-radius: 9999px;
  overflow: hidden;
}

.sync-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--purple-500), var(--blue-500));
  border-radius: 9999px;
  transition: width 0.8s linear;
}

.sync-state-msg {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--foreground);
  margin: 0;
  line-height: 1.45;
}

.sync-state-subtext {
  font-size: 0.82rem;
  color: var(--muted-foreground);
  font-weight: 500;
  line-height: 1.4;
}

.sync-feedback-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.sync-feedback-icon svg {
  width: 36px;
  height: 36px;
}

.sync-feedback-icon.success {
  background: rgba(16, 185, 129, 0.12);
  border: 2px solid #10B981;
  color: #10B981;
}

.sync-feedback-icon.warning {
  background: rgba(245, 158, 11, 0.12);
  border: 2px solid #F59E0B;
  color: #D97706;
}

.sync-feedback-icon.error {
  background: rgba(239, 68, 68, 0.12);
  border: 2px solid #EF4444;
  color: #DC2626;
}

.sync-feedback-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--foreground);
}

.sync-alert-banner {
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.35);
  border-radius: var(--radius-md);
  padding: 12px 18px;
  width: 100%;
}

.sync-alert-banner p {
  margin: 0;
  font-weight: 700;
  color: #b45309;
  font-size: 0.95rem;
  line-height: 1.4;
}

[data-theme="dark"] .sync-alert-banner {
  background: rgba(245, 158, 11, 0.15);
  border-color: rgba(251, 191, 36, 0.4);
}

[data-theme="dark"] .sync-alert-banner p {
  color: #fde68a;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.03); opacity: 0.92; }
}

/* Mantener el color del tema cuando el navegador rellena un campo guardado. */
[data-theme] input:-webkit-autofill,
[data-theme] input:-webkit-autofill:hover,
[data-theme] input:-webkit-autofill:focus,
[data-theme] input:-webkit-autofill:active {
  -webkit-text-fill-color: var(--foreground) !important;
  -webkit-box-shadow: 0 0 0 1000px var(--card) inset !important;
  box-shadow: 0 0 0 1000px var(--card) inset !important;
  caret-color: var(--foreground) !important;
  transition: background-color 99999s ease-out 0s;
}

[data-theme] input:autofill {
  color: var(--foreground) !important;
}

[data-theme="dark"] .quote-status--unquoted {
  background: rgba(248, 113, 113, 0.16) !important;
  border-color: rgba(248, 113, 113, 0.58) !important;
  color: #ffc2c2 !important;
}

[data-theme="dark"] .quote-status--quoting {
  background: rgba(245, 158, 11, 0.15) !important;
  border-color: rgba(245, 158, 11, 0.52) !important;
  color: #f8d78d !important;
}

/* ==========================================================================
   Alertas Visuales de Filas MP (Materias Primas)
   ========================================================================== */

/* Alerta: MP con Costo > $1.000.000 COP */
tr.fila-alerta-millon {
  background-color: #fff1f2 !important;
  border-left: 5px solid #ef4444 !important;
  transition: background-color 0.25s ease, border-left 0.25s ease;
}
tr.fila-alerta-millon:hover {
  background-color: #ffe4e6 !important;
}

[data-theme="dark"] tr.fila-alerta-millon {
  background-color: rgba(239, 68, 68, 0.18) !important;
  border-left: 5px solid #f87171 !important;
}
[data-theme="dark"] tr.fila-alerta-millon:hover {
  background-color: rgba(239, 68, 68, 0.26) !important;
}

/* Alerta: MP con Valor x Kilo */
tr.fila-alerta-kilo {
  background-color: #fffbeb !important;
  border-left: 5px solid #f59e0b !important;
  transition: background-color 0.25s ease, border-left 0.25s ease;
}
tr.fila-alerta-kilo:hover {
  background-color: #fef3c7 !important;
}

[data-theme="dark"] tr.fila-alerta-kilo {
  background-color: rgba(245, 158, 11, 0.16) !important;
  border-left: 5px solid #fbbf24 !important;
}
[data-theme="dark"] tr.fila-alerta-kilo:hover {
  background-color: rgba(245, 158, 11, 0.24) !important;
}

/* Badges de alerta de fila */
.badge-alerta-mp {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  white-space: nowrap;
  letter-spacing: 0.2px;
  user-select: none;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.badge-alerta-mp--millon {
  color: #991b1b;
  background: #fee2e2;
  border: 1px solid #f87171;
}
[data-theme="dark"] .badge-alerta-mp--millon {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.25);
  border-color: rgba(239, 68, 68, 0.5);
}

.badge-alerta-mp--kilo {
  color: #92400e;
  background: #fef3c7;
  border: 1px solid #fbbf24;
}
[data-theme="dark"] .badge-alerta-mp--kilo {
  color: #fde68a;
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.5);
}

/* Spinner para botones interactivos de Webhook / Cotización */
.btn-spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

.btn-cotizar-row {
  transition: all 0.2s ease;
}
.btn-cotizar-row:hover {
  transform: translateY(-1px);
}
.btn-cotizar-row:disabled,
.btn-cotizar-faltantes:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  pointer-events: none;
}

/* SweetAlert2 personalización con tipografía de la aplicación */
.swal2-popup {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  border-radius: 16px !important;
  padding: 1.5rem !important;
}
.swal2-title {
  font-family: 'Outfit', 'Inter', sans-serif !important;
  font-weight: 700 !important;
}
.swal2-styled.swal2-confirm {
  border-radius: 8px !important;
  font-weight: 600 !important;
  padding: 9px 22px !important;
}
.swal2-styled.swal2-cancel {
  border-radius: 8px !important;
  font-weight: 500 !important;
}

/* ==========================================================================
   Barra de Navegación Rápida & Resumen en Vivo (Quick-Nav Bar)
   ========================================================================== */
.toolbar-btn-excel {
  color: var(--teal-600) !important;
}
[data-theme="dark"] .toolbar-btn-excel {
  color: var(--teal-400) !important;
}
.toolbar-btn-excel:hover {
  background: rgba(16, 185, 129, 0.12) !important;
  color: var(--teal-700) !important;
}

.project-info-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-quick-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted-foreground);
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-quick-action:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--card);
}

.btn-quick-action svg {
  width: 14px;
  height: 14px;
}

/* ==========================================================================
   Barra de Navegación Rápida & Resumen en Vivo (Quick-Nav Bar)
   ========================================================================== */
/* ==========================================================================
   Barra de Navegación Rápida & Resumen en Vivo (Quick-Nav Bar)
   ========================================================================== */
.quick-nav-bar {
  position: sticky;
  top: 63px;
  z-index: 950;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card, rgba(255, 255, 255, 0.95));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 16px;
  margin-bottom: 24px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  flex-wrap: nowrap;
  overflow-x: auto;
  scrollbar-width: thin;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Margen superior de scroll para que el contenido no quede oculto bajo la barra pegajosa */
.granel-card,
.packaging-card,
.card,
[id^="card-"] {
  scroll-margin-top: 140px;
}

.quick-nav-label {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
  flex-shrink: 0;
  user-select: none;
}

.quick-nav-pills {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.quick-nav-pills::-webkit-scrollbar {
  display: none;
}

.quick-nav-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  color: var(--foreground);
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
  white-space: nowrap;
  flex-shrink: 0;
}

.quick-nav-pill:hover {
  transform: translateY(-1px);
  border-color: var(--primary);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.08);
}

.quick-nav-pill:active {
  transform: translateY(0);
}

.quick-nav-pill.is-collapsed {
  opacity: 0.65;
  border-style: dashed;
}

.quick-nav-pill-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.quick-nav-pill:hover .quick-nav-pill-dot {
  transform: scale(1.25);
}

/* Indicadores de tipo de sección */
.pill-purple .quick-nav-pill-dot {
  background: #8b5cf6;
  box-shadow: 0 0 5px rgba(139, 92, 246, 0.4);
}
.pill-blue .quick-nav-pill-dot {
  background: #0284c7;
  box-shadow: 0 0 5px rgba(2, 132, 199, 0.4);
}
.pill-teal .quick-nav-pill-dot {
  background: #0d9488;
  box-shadow: 0 0 5px rgba(13, 148, 136, 0.4);
}

.pill-purple:hover { border-color: rgba(139, 92, 246, 0.5); }
.pill-blue:hover { border-color: rgba(2, 132, 199, 0.5); }
.pill-teal:hover { border-color: rgba(13, 148, 136, 0.5); }

.quick-nav-pill-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--foreground);
  letter-spacing: -0.01em;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-nav-pill-val {
  font-size: 0.73rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--muted-foreground);
  padding: 1px 6px;
  background: var(--muted, rgba(0, 0, 0, 0.04));
  border-radius: 4px;
  border: 1px solid var(--border);
  letter-spacing: -0.02em;
}

.quick-nav-pill:hover .quick-nav-pill-val {
  color: var(--foreground);
}

.quick-nav-actions {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.quick-nav-add-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px dashed var(--border);
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.quick-nav-add-btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: rgba(124, 58, 237, 0.05);
  transform: translateY(-1px);
}

/* ==========================================================================
   Adaptaciones de Quick-Nav Bar a Temas Oscuros y de Estilo
   ========================================================================== */

/* 1. MODO OSCURO (Dark) */
[data-theme="dark"] .quick-nav-bar {
  background: rgba(15, 23, 42, 0.92);
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .quick-nav-pill {
  background: rgba(30, 41, 59, 0.95);
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .quick-nav-pill:hover {
  border-color: var(--primary);
  background: rgba(40, 53, 76, 0.95);
}
[data-theme="dark"] .quick-nav-pill-title {
  color: #f8fafc;
}
[data-theme="dark"] .quick-nav-pill-val {
  background: rgba(15, 23, 42, 0.6);
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}
[data-theme="dark"] .quick-nav-pill:hover .quick-nav-pill-val {
  color: #f8fafc;
}
[data-theme="dark"] .quick-nav-add-btn {
  background: rgba(30, 41, 59, 0.7);
  border-color: rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
}

/* 2. PREMIUM (Terciopelo Pro, Vino & Oro) */
[data-theme="premium"] .quick-nav-bar {
  background: rgba(25, 20, 25, 0.94) !important;
  border: 1px solid rgba(197, 163, 101, 0.35) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 16px rgba(75, 27, 46, 0.35) !important;
}
[data-theme="premium"] .quick-nav-label {
  color: #dfc58d !important;
}
[data-theme="premium"] .quick-nav-pill {
  background: rgba(39, 27, 35, 0.95) !important;
  border: 1.5px solid rgba(197, 163, 101, 0.3) !important;
  border-radius: 999px !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3) !important;
}
[data-theme="premium"] .quick-nav-pill:hover {
  border-color: #dfc58d !important;
  box-shadow: 0 4px 14px rgba(197, 163, 101, 0.3) !important;
}
[data-theme="premium"] .pill-purple .quick-nav-pill-dot {
  background: #c084fc !important;
  box-shadow: 0 0 6px rgba(192, 132, 252, 0.6) !important;
}
[data-theme="premium"] .pill-blue .quick-nav-pill-dot {
  background: #38bdf8 !important;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.6) !important;
}
[data-theme="premium"] .pill-teal .quick-nav-pill-dot {
  background: #dfc58d !important;
  box-shadow: 0 0 6px rgba(223, 197, 141, 0.6) !important;
}
[data-theme="premium"] .quick-nav-pill-title {
  color: #f2eadc !important;
}
[data-theme="premium"] .quick-nav-pill-val {
  background: rgba(75, 27, 46, 0.7) !important;
  color: #dfc58d !important;
  border-color: rgba(197, 163, 101, 0.3) !important;
}
[data-theme="premium"] .quick-nav-add-btn {
  background: rgba(39, 27, 35, 0.85) !important;
  border: 1.5px dashed rgba(197, 163, 101, 0.45) !important;
  border-radius: 999px !important;
  color: #dfc58d !important;
}
[data-theme="premium"] .quick-nav-add-btn:hover {
  background: rgba(75, 27, 46, 0.8) !important;
  border-color: #dfc58d !important;
  color: #f2eadc !important;
}

/* 3. METRÓPOLIS NEÓN (Recorrido Ciudad) */
[data-theme="ciudad"] .quick-nav-bar {
  background: rgba(10, 18, 33, 0.94) !important;
  border: 1px solid rgba(254, 212, 106, 0.35) !important;
  border-radius: 999px !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.55), 0 0 15px rgba(254, 212, 106, 0.15) !important;
}
[data-theme="ciudad"] .quick-nav-label {
  color: #fed46a !important;
}
[data-theme="ciudad"] .quick-nav-pill {
  background: rgba(17, 29, 52, 0.95) !important;
  border-color: rgba(254, 212, 106, 0.25) !important;
  border-radius: 999px !important;
}
[data-theme="ciudad"] .quick-nav-pill:hover {
  border-color: #fed46a !important;
  box-shadow: 0 4px 14px rgba(254, 212, 106, 0.25) !important;
}
[data-theme="ciudad"] .pill-purple .quick-nav-pill-dot { background: #fa927f !important; box-shadow: 0 0 6px #fa927f !important; }
[data-theme="ciudad"] .pill-blue .quick-nav-pill-dot { background: #38bdf8 !important; box-shadow: 0 0 6px #38bdf8 !important; }
[data-theme="ciudad"] .pill-teal .quick-nav-pill-dot { background: #fed46a !important; box-shadow: 0 0 6px #fed46a !important; }
[data-theme="ciudad"] .quick-nav-pill-title {
  color: #ffffff !important;
}
[data-theme="ciudad"] .quick-nav-pill-val {
  background: rgba(254, 212, 106, 0.12) !important;
  color: #fed46a !important;
  border-color: rgba(254, 212, 106, 0.25) !important;
}
[data-theme="ciudad"] .quick-nav-add-btn {
  background: rgba(17, 29, 52, 0.8) !important;
  border: 1.5px dashed rgba(254, 212, 106, 0.4) !important;
  border-radius: 999px !important;
  color: #fed46a !important;
}
[data-theme="ciudad"] .quick-nav-add-btn:hover {
  border-color: #fed46a !important;
  color: #ffffff !important;
}

/* 4. PLANO TÉCNICO (Blueprint) */
[data-theme="plano"] .quick-nav-bar {
  background: rgba(0, 34, 68, 0.94) !important;
  border: 1.5px solid rgba(56, 189, 248, 0.4) !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45) !important;
}
[data-theme="plano"] .quick-nav-label {
  color: #38bdf8 !important;
  font-family: monospace !important;
}
[data-theme="plano"] .quick-nav-pill {
  background: rgba(0, 41, 82, 0.95) !important;
  border-color: rgba(56, 189, 248, 0.35) !important;
  border-radius: 4px !important;
}
[data-theme="plano"] .quick-nav-pill:hover {
  border-color: #38bdf8 !important;
}
[data-theme="plano"] .pill-purple .quick-nav-pill-dot { background: #a78bfa !important; }
[data-theme="plano"] .pill-blue .quick-nav-pill-dot { background: #38bdf8 !important; }
[data-theme="plano"] .pill-teal .quick-nav-pill-dot { background: #34d399 !important; }
[data-theme="plano"] .quick-nav-pill-title {
  color: #ffffff !important;
  font-family: monospace !important;
}
[data-theme="plano"] .quick-nav-pill-val {
  background: rgba(0, 20, 40, 0.6) !important;
  color: #7dd3fc !important;
  border-color: rgba(56, 189, 248, 0.3) !important;
}
[data-theme="plano"] .quick-nav-add-btn {
  border: 1px dashed rgba(56, 189, 248, 0.45) !important;
  color: #38bdf8 !important;
  border-radius: 4px !important;
  font-family: monospace !important;
}

/* 5. CYBERPOP */
[data-theme="cyberpop"] .quick-nav-bar {
  background: #ffd500 !important;
  border: 2.5px solid #000000 !important;
  border-radius: 6px !important;
  box-shadow: 4px 4px 0 #000000 !important;
}
[data-theme="cyberpop"] .quick-nav-label {
  color: #000000 !important;
  font-weight: 900 !important;
}
[data-theme="cyberpop"] .quick-nav-pill {
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  border-radius: 5px !important;
  box-shadow: 2px 2px 0 #000000 !important;
}
[data-theme="cyberpop"] .quick-nav-pill:hover {
  transform: translate(-1px, -1px) !important;
  box-shadow: 3px 3px 0 #000000 !important;
}
[data-theme="cyberpop"] .pill-purple .quick-nav-pill-dot { background: #7c3aed !important; }
[data-theme="cyberpop"] .pill-blue .quick-nav-pill-dot { background: #0284c7 !important; }
[data-theme="cyberpop"] .pill-teal .quick-nav-pill-dot { background: #00aa66 !important; }
[data-theme="cyberpop"] .quick-nav-pill-title {
  color: #000000 !important;
  font-weight: 800 !important;
}
[data-theme="cyberpop"] .quick-nav-pill-val {
  background: #000000 !important;
  color: #ffd500 !important;
  border: none !important;
}
[data-theme="cyberpop"] .quick-nav-add-btn {
  background: #ffffff !important;
  border: 2px solid #000000 !important;
  color: #000000 !important;
  border-radius: 5px !important;
  font-weight: 800 !important;
  box-shadow: 2px 2px 0 #000000 !important;
}

/* 6. SAKURA JAPÓN */
[data-theme="sakura"] .quick-nav-bar {
  background: rgba(255, 245, 247, 0.94) !important;
  border: 1px solid rgba(254, 205, 211, 0.8) !important;
  border-radius: 999px !important;
  box-shadow: 0 4px 18px rgba(169, 87, 112, 0.12) !important;
}
[data-theme="sakura"] .quick-nav-label {
  color: #a95770 !important;
}
[data-theme="sakura"] .quick-nav-pill {
  background: #ffffff !important;
  border-color: #fecdd3 !important;
  border-radius: 999px !important;
}
[data-theme="sakura"] .quick-nav-pill:hover {
  border-color: #f43f5e !important;
  box-shadow: 0 4px 12px rgba(244, 63, 94, 0.15) !important;
}
[data-theme="sakura"] .pill-purple .quick-nav-pill-dot { background: #a95770 !important; box-shadow: 0 0 5px rgba(169, 87, 112, 0.4) !important; }
[data-theme="sakura"] .pill-blue .quick-nav-pill-dot { background: #38bdf8 !important; box-shadow: 0 0 5px rgba(56, 189, 248, 0.4) !important; }
[data-theme="sakura"] .pill-teal .quick-nav-pill-dot { background: #f43f5e !important; box-shadow: 0 0 5px rgba(244, 63, 94, 0.4) !important; }
[data-theme="sakura"] .quick-nav-pill-title {
  color: #4a3036 !important;
}
[data-theme="sakura"] .quick-nav-pill-val {
  background: rgba(254, 205, 211, 0.35) !important;
  color: #a95770 !important;
  border-color: rgba(254, 205, 211, 0.8) !important;
}
[data-theme="sakura"] .quick-nav-add-btn {
  background: transparent !important;
  border: 1.5px dashed #fecdd3 !important;
  color: #a95770 !important;
  border-radius: 999px !important;
}
[data-theme="sakura"] .quick-nav-add-btn:hover {
  background: rgba(254, 205, 211, 0.3) !important;
  border-color: #f43f5e !important;
}

/* 7. BOCETO */
[data-theme="boceto"] .quick-nav-bar {
  background: #fffaf3 !important;
  border: 1.5px dashed #8c7860 !important;
  border-radius: 8px !important;
  box-shadow: 2px 2px 0 rgba(0, 0, 0, 0.06) !important;
}
[data-theme="boceto"] .quick-nav-label {
  color: #5c4a38 !important;
  font-family: cursive, 'Segoe Print', sans-serif !important;
}
[data-theme="boceto"] .quick-nav-pill {
  background: #fffdf9 !important;
  border: 1.5px solid #d6c7b2 !important;
  border-radius: 6px !important;
}
[data-theme="boceto"] .quick-nav-pill:hover {
  border-color: #8c7860 !important;
}
[data-theme="boceto"] .pill-purple .quick-nav-pill-dot { background: #8c7860 !important; }
[data-theme="boceto"] .pill-blue .quick-nav-pill-dot { background: #0284c7 !important; }
[data-theme="boceto"] .pill-teal .quick-nav-pill-dot { background: #c2410c !important; }
[data-theme="boceto"] .quick-nav-pill-title {
  color: #211a15 !important;
  font-family: cursive, 'Segoe Print', sans-serif !important;
}
[data-theme="boceto"] .quick-nav-pill-val {
  background: #f7eee1 !important;
  color: #8c7860 !important;
  border-color: #d6c7b2 !important;
}
[data-theme="boceto"] .quick-nav-add-btn {
  background: transparent !important;
  border: 1.5px dashed #8c7860 !important;
  color: #5c4a38 !important;
  border-radius: 6px !important;
}

/* 8. NATURAL */
[data-theme="natural"] .quick-nav-bar {
  background: rgba(253, 251, 247, 0.94) !important;
  border: 1px solid rgba(167, 243, 208, 0.7) !important;
  border-radius: 999px !important;
  box-shadow: 0 4px 18px rgba(5, 150, 105, 0.08) !important;
}
[data-theme="natural"] .quick-nav-label {
  color: #059669 !important;
}
[data-theme="natural"] .quick-nav-pill {
  background: #ffffff !important;
  border-color: #a7f3d0 !important;
  border-radius: 999px !important;
}
[data-theme="natural"] .quick-nav-pill:hover {
  border-color: #059669 !important;
  box-shadow: 0 4px 12px rgba(5, 150, 105, 0.12) !important;
}
[data-theme="natural"] .pill-purple .quick-nav-pill-dot { background: #8b5cf6 !important; }
[data-theme="natural"] .pill-blue .quick-nav-pill-dot { background: #0284c7 !important; }
[data-theme="natural"] .pill-teal .quick-nav-pill-dot { background: #059669 !important; }
[data-theme="natural"] .quick-nav-pill-title {
  color: #064e3b !important;
}
[data-theme="natural"] .quick-nav-pill-val {
  background: rgba(167, 243, 208, 0.3) !important;
  color: #059669 !important;
  border-color: rgba(167, 243, 208, 0.7) !important;
}
[data-theme="natural"] .quick-nav-add-btn {
  background: transparent !important;
  border: 1.5px dashed #a7f3d0 !important;
  color: #059669 !important;
  border-radius: 999px !important;
}
[data-theme="natural"] .quick-nav-add-btn:hover {
  background: rgba(167, 243, 208, 0.25) !important;
  border-color: #059669 !important;
}

/* Herramientas de Cabecera de Tarjeta y Modo Colapsado */
.btn-card-tool {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--muted-foreground);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn-card-tool:hover {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--muted);
  transform: translateY(-1px);
}

.btn-card-tool svg {
  width: 15px;
  height: 15px;
}

.card-collapsed-summary {
  display: none;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
  flex-wrap: wrap;
}

.collapsed-chip {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}

.collapsed-chip-highlight {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary);
  background: rgba(124, 58, 237, 0.08);
  border-color: rgba(124, 58, 237, 0.25);
}

.granel-card.is-collapsed {
  padding: 18px 24px !important;
  margin-bottom: 20px !important;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.granel-card.is-collapsed .granel-card-body-wrap {
  display: none !important;
}

.granel-card.is-collapsed .granel-header {
  margin-bottom: 0 !important;
  padding-bottom: 0 !important;
  border-bottom: none !important;
}

.granel-card.is-collapsed .granel-header-left {
  display: flex !important;
  align-items: center !important;
  gap: 14px !important;
  flex-wrap: wrap !important;
  row-gap: 8px !important;
}

.granel-card.is-collapsed .card-collapsed-summary {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  margin-left: 4px !important;
  flex-wrap: wrap !important;
}

@keyframes pulseCardFocus {
  0% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.55); }
  50% { box-shadow: 0 0 0 8px rgba(124, 58, 237, 0); }
  100% { box-shadow: 0 0 0 0 rgba(124, 58, 237, 0); }
}

.card-pulse-focus {
  animation: pulseCardFocus 1.1s ease-out;
}

/* ==========================================================================
   Enterprise UX Upgrade: Vista Limpia, Celdas Unificadas, Resumen Ejecutivo y MO Compacta
   ========================================================================== */

/* 1. Modo Vista Limpia vs Vista Detallada */
#cards-container.table-clean-mode .col-tech-meta {
  display: none !important;
}

.btn-toggle-all-cards.is-active-clean {
  background: rgba(124, 58, 237, 0.12);
  color: var(--primary);
  border-color: var(--primary);
}

/* 2. Resumen Ejecutivo en vivo en la Barra Rápida */
.quick-nav-exec-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--muted);
  border: 1px solid var(--border);
  font-size: 0.76rem;
  white-space: nowrap;
}

.exec-summary-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.exec-summary-label {
  color: var(--muted-foreground);
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.exec-summary-val {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--foreground);
}

.exec-summary-val--pv {
  color: var(--teal-600, #059669);
  background: rgba(16, 185, 129, 0.12);
  padding: 1px 7px;
  border-radius: 999px;
}

.exec-summary-sep {
  color: var(--border);
  font-weight: 400;
}

/* 3. Celda Unificada de Origen / Vigencia y Exclusividad */
.meta-origin-stack,
.excl-cell-stack {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  line-height: 1.15;
}

.badge-tipo-costo {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  letter-spacing: 0.01em;
}

.meta-origin-sub {
  font-size: 0.67rem;
  color: var(--muted-foreground);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.meta-empty-dash {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  opacity: 0.6;
}

.uom-sub-tag {
  font-size: 0.65rem;
  color: var(--primary);
  display: block;
  text-align: right;
  margin-top: 2px;
  font-weight: 600;
  opacity: 0.85;
}

.badge-excl {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
  cursor: help;
}

.badge-excl--exclusive {
  background: rgba(139, 92, 246, 0.14);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.32);
}

.badge-excl--semi-time {
  background: rgba(245, 158, 11, 0.14);
  color: #d97706;
  border: 1px solid rgba(245, 158, 11, 0.32);
}

.badge-excl--semi-form {
  background: rgba(2, 132, 199, 0.14);
  color: #0284c7;
  border: 1px solid rgba(2, 132, 199, 0.32);
}

.badge-excl--semi-both {
  background: rgba(194, 65, 12, 0.14);
  color: #c2410c;
  border: 1px solid rgba(194, 65, 12, 0.32);
}

.badge-excl--shared {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
  border: 1px solid rgba(59, 130, 246, 0.28);
}

.badge-excl-sub {
  font-size: 0.65rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--muted-foreground);
  white-space: nowrap;
}

/* 4. Tarjetas de Operación MO: Layout Funcional y Espacioso */
.mo-data-card .mo-fields-layout,
.mo-data-card .mo-fields-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.mo-data-card .mo-field-full {
  width: 100%;
}

.mo-data-card .mo-field-full input {
  width: 100%;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 7px 10px;
}

.mo-data-card .mo-fields-numbers-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr 1.05fr;
  gap: 8px;
  width: 100%;
}

.mo-data-card .mo-field-group {
  min-width: 0;
}

.mo-data-card .mo-field-group label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--muted-foreground);
  margin-bottom: 3px;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

.mo-data-card .mo-field-group input {
  font-size: 0.88rem;
  padding: 6px 8px;
}

/* 5. Desglose Técnico MO Colapsable (<details>) */
.mo-breakdown-details {
  padding: 0 !important;
  overflow: hidden;
}

.mo-breakdown-summary {
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--muted-foreground);
  transition: background-color 0.15s ease, color 0.15s ease;
}

.mo-breakdown-summary::-webkit-details-marker {
  display: none;
}

.mo-breakdown-summary:hover {
  background: rgba(124, 58, 237, 0.06);
  color: var(--foreground);
}

.mo-breakdown-summary-title::before {
  content: '▸ ';
  display: inline-block;
  margin-right: 4px;
  transition: transform 0.18s ease;
}

.mo-breakdown-details[open] .mo-breakdown-summary-title::before {
  transform: rotate(90deg);
}

.mo-breakdown-summary-meta {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  font-weight: 600;
  color: var(--primary);
}

.mo-breakdown-body {
  padding: 6px 12px 10px;
  border-top: 1px dashed var(--border);
}

/* ==========================================================================
   MOD por Valor Objetivo (cálculo inverso de tiempo)
   ========================================================================== */

.mo-target-op-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--primary);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex: 0 0 auto;
}

.mo-target-op-btn:hover {
  background: var(--muted);
  border-color: var(--primary);
  color: var(--primary);
}

.mo-target-op-btn svg,
.mo-target-op-btn i {
  width: 14px;
  height: 14px;
}

.mo-target-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 160px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--primary);
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mo-data-card .mo-card-header-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mo-card-center--ref {
  color: var(--muted-foreground);
  background: var(--muted);
  border: 1px dashed var(--border);
  font-style: italic;
}

.mo-target-overlay {
  z-index: 9998;
}

.mo-target-chip--warn {
  color: var(--destructive);
  border-style: dashed;
}

.mo-target-chip--error {
  color: var(--destructive, #dc2626);
  border-color: var(--destructive, #ef4444);
  border-style: dashed;
}

.mo-target-chip svg,
.mo-target-chip i {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
}

.mo-target-chip > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mo-target-modal {
  max-width: 580px;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
}

.mo-target-modal .modal-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  max-height: min(72vh, 720px);
  overflow-y: auto;
}

.mo-target-modal .modal-header h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.mo-target-modal .modal-header h3 svg,
.mo-target-modal .modal-header h3 i {
  width: 18px;
  height: 18px;
  color: var(--primary);
}

.mo-target-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.mo-target-field > label,
.mo-target-mode-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-foreground);
}

.mo-target-field .input-field,
.mo-target-field select {
  width: 100%;
  font-size: 0.9rem;
  padding: 8px 10px;
}

.mo-target-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 0.8fr;
  gap: 10px;
}

.mo-target-value-row {
  display: flex;
  align-items: stretch;
  gap: 6px;
}

.mo-target-value-row .mo-target-prefix {
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--muted-foreground);
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  flex: 0 0 auto;
}

.mo-target-value-row .input-field {
  flex: 1 1 auto;
  min-width: 0;
}

.mo-target-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.mo-target-seg {
  display: inline-flex;
  padding: 3px;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--muted);
}

.mo-target-seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted-foreground);
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 5px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.mo-target-seg-btn.is-active {
  background: var(--primary);
  color: var(--primary-foreground);
}

.mo-target-hint {
  font-size: 0.7rem;
  line-height: 1.4;
  color: var(--muted-foreground);
}

.mo-target-op-summary {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 9px 11px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.mo-target-op-name {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--foreground);
}

.mo-target-op-meta {
  font-family: var(--font-mono, monospace);
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.mo-target-result {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--card);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mo-target-result--ok { border-left: 3px solid var(--success, #10b981); }
.mo-target-result--warn { border-left: 3px solid var(--warning, #d97706); }
.mo-target-result--error { border-left: 3px solid var(--destructive, #ef4444); }

.mo-target-result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.mo-target-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid var(--border);
}

.mo-target-badge--ok {
  background: var(--muted);
  color: var(--success, #059669);
  border: 1px solid var(--success, #10b981);
}

.mo-target-badge--warn {
  background: var(--muted);
  color: var(--warning, #b45309);
  border: 1px solid var(--warning, #d97706);
}

.mo-target-badge--error {
  background: var(--muted);
  color: var(--destructive, #dc2626);
  border: 1px solid var(--destructive, #ef4444);
}

.mo-target-hero {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 0 8px;
  border-bottom: 1px dashed var(--border);
}

.mo-target-hero-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.mo-target-hero-value {
  font-family: var(--font-mono, monospace);
  font-size: 1.85rem;
  font-weight: 800;
  line-height: 1;
  color: var(--foreground);
}

.mo-target-hero-unit {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted-foreground);
}

.mo-target-hero-sec {
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary);
}

.mo-target-main-value {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  padding: 14px 16px;
  background: var(--muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
}

.mo-target-main-value-grid {
  display: flex;
  align-items: stretch;
  justify-content: center;
  gap: 14px;
  width: 100%;
}

.mo-target-main-value-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 1 1 0;
  min-width: 0;
}

.mo-target-main-value-divider {
  width: 1px;
  align-self: stretch;
  background: var(--border);
  flex: 0 0 auto;
}

.mo-target-main-value-label {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
  line-height: 1.3;
}

.mo-target-main-value-number {
  font-family: var(--font-mono, monospace);
  font-size: 1.9rem;
  font-weight: 800;
  line-height: 1.1;
  color: var(--primary);
  white-space: nowrap;
}

.mo-target-main-value-meta {
  font-family: var(--font-mono, monospace);
  font-size: 0.7rem;
  line-height: 1.5;
  color: var(--muted-foreground);
}

.mo-target-breakdown {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  overflow: hidden;
}

.mo-target-breakdown-summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  cursor: pointer;
  user-select: none;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted-foreground);
  transition: color 0.15s ease, background-color 0.15s ease;
}

.mo-target-breakdown-summary::-webkit-details-marker {
  display: none;
}

.mo-target-breakdown-summary::before {
  content: '▸';
  display: inline-block;
  transition: transform 0.18s ease;
}

.mo-target-breakdown[open] .mo-target-breakdown-summary::before {
  transform: rotate(90deg);
}

.mo-target-breakdown-summary:hover {
  background: var(--muted);
  color: var(--foreground);
}

.mo-target-breakdown-body {
  padding: 10px 12px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mo-target-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mo-target-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.78rem;
}

.mo-target-row span:first-child {
  color: var(--muted-foreground);
}

.mo-target-row strong {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--foreground);
  text-align: right;
}

.mo-target-rate-breakdown {
  font-family: var(--font-mono, monospace);
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--muted-foreground);
  margin-top: -2px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--border);
}

.mo-target-row--total {
  padding-top: 6px;
  border-top: 1px solid var(--border);
  font-size: 0.84rem;
}

.mo-target-row--total strong {
  color: var(--primary);
  font-size: 0.9rem;
}

.mo-target-warning,
.mo-target-error,
.mo-target-note {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 10px 11px;
  border-radius: var(--radius-sm);
  font-size: 0.78rem;
  line-height: 1.45;
}

.mo-target-warning {
  border: 1px dashed var(--warning, #d97706);
  background: var(--muted);
  color: var(--foreground);
}

.mo-target-error {
  border: 1px solid var(--destructive, #ef4444);
  background: var(--muted);
  color: var(--destructive, #dc2626);
}

.mo-target-note {
  border: 1px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
}

.mo-target-warning svg,
.mo-target-warning i,
.mo-target-error svg,
.mo-target-error i {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.mo-target-warning strong,
.mo-target-error strong {
  display: block;
  margin-bottom: 2px;
}

.mo-target-warning p,
.mo-target-error p {
  margin: 0;
}

.mo-target-actions-hint {
  font-size: 0.72rem;
  color: var(--muted-foreground);
}

.mo-target-modal .modal-footer {
  flex-wrap: wrap;
  gap: 10px;
}

.mo-target-footer-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

@media (max-width: 560px) {
  .mo-target-grid {
    grid-template-columns: 1fr 1fr;
  }

  .mo-target-grid .mo-target-field:last-child {
    grid-column: 1 / -1;
  }

  .mo-target-hero-value {
    font-size: 1.5rem;
  }

  .mo-target-main-value-number {
    font-size: 1.45rem;
  }

  .mo-target-main-value-grid {
    gap: 8px;
  }

  .mo-target-main-value-label {
    font-size: 0.62rem;
  }

  .mo-target-footer-actions {
    width: 100%;
    margin-left: 0;
  }

  .mo-target-actions-hint {
    flex: 1 1 100%;
  }

  .mo-target-footer-actions .btn {
    flex: 1;
  }
}

/* ==========================================================================
   Banner de Presentaciones Múltiples de Solicitud en Cotizador
   ========================================================================== */
.solicitud-pres-banner {
  background: linear-gradient(135deg, rgba(0, 180, 216, 0.08), rgba(124, 58, 237, 0.06));
  border: 1.5px solid rgba(0, 180, 216, 0.25);
  border-radius: var(--radius-lg, 12px);
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.spb-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.spb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.spb-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.92rem;
  color: var(--foreground);
}

.spb-badge {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  background: var(--card);
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  color: var(--primary);
}

.spb-client {
  font-weight: 700;
}

.spb-hint {
  font-size: 0.8rem;
  color: var(--muted-foreground);
}

.spb-tabs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.spb-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--foreground);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.spb-tab:hover {
  border-color: var(--primary);
  background: rgba(0, 180, 216, 0.08);
  transform: translateY(-1px);
}

.spb-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0, 180, 216, 0.35);
  font-weight: 700;
}

.spb-tab-vol {
  font-weight: 700;
}

.spb-tab-qty {
  font-size: 0.78rem;
  opacity: 0.9;
}

.spb-tab-status {
  font-size: 0.7rem;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.25);
  padding: 1px 6px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.spb-tab-action {
  font-size: 0.7rem;
  color: var(--primary);
  text-decoration: underline;
}

/* ==========================================================================
   Subtotal de Formulación a Granel (Suma y Balance Dinámico 1.000000)
   Banda de cierre adaptativa: toma el acento, tipografía y radios del tema.
   ========================================================================== */

/* Acento de sección: por defecto el del tema; ajustes por diseño para que
   la banda case con el borde/accento propio de cada tarjeta. */
.granel-card {
  --section-accent: var(--primary);
}

.granel-card.card-blue {
  --section-accent: var(--blue-600);
}

.granel-card.card-teal {
  --section-accent: var(--teal-600);
}

[data-theme="sakura"] .granel-card {
  --section-accent: var(--sakura-card-accent, var(--primary));
}

[data-theme="natural"] .granel-card {
  --section-accent: var(--garden-card-accent, var(--primary));
}

[data-theme="premium"] .granel-card {
  --section-accent: var(--premium-card-accent, var(--primary));
}

[data-theme="plano"] .granel-card {
  --section-accent: #b388ff;
}

[data-theme="cyberpop"] .granel-card {
  --section-accent: var(--pop-red, var(--primary));
}

[data-theme="slush"] .granel-card {
  --section-accent: var(--color-electric-blue, var(--primary));
}

[data-theme="superr"] .granel-card {
  --section-accent: var(--accent, var(--primary));
}

.granel-tfoot {
  --subtotal-tint: transparent;
  background: var(--muted);
  border-top: none;
}

@supports (background: color-mix(in srgb, red 5%, blue)) {
  .granel-tfoot {
    --subtotal-tint: color-mix(in srgb, var(--section-accent) 10%, transparent);
  }
}

/* Banda: una sola superficie limpia, sin las cajas de color de los temas. */
.formulacion-table tfoot.granel-tfoot > tr.granel-subtotal-row > td {
  background-color: var(--muted) !important;
  background-image: linear-gradient(var(--subtotal-tint), var(--subtotal-tint)) !important;
  border-bottom: none !important;
  border-right: none !important;
  border-top: 1px solid var(--border) !important;
  color: var(--foreground) !important;
  padding: 9px 10px !important;
  vertical-align: middle;
}

@supports (background: color-mix(in srgb, red 5%, blue)) {
  .formulacion-table tfoot.granel-tfoot > tr.granel-subtotal-row > td {
    border-top-color: color-mix(in srgb, var(--section-accent) 26%, var(--border)) !important;
  }
}

/* La fila de cierre no debe responder al hover de las filas de insumos. */
.formulacion-table tfoot.granel-tfoot > tr.granel-subtotal-row:hover > td {
  background-color: var(--muted) !important;
  background-image: linear-gradient(var(--subtotal-tint), var(--subtotal-tint)) !important;
}

.granel-subtotal-label {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--foreground);
}

.subtotal-lockup {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.subtotal-accent-bar {
  display: inline-block;
  flex: none;
  width: 3px;
  height: 15px;
  border-radius: 999px;
  background: var(--section-accent);
}

.subtotal-title {
  font-family: var(--font-heading);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
  color: var(--foreground);
}

.subtotal-chip {
  font-family: var(--font-sans);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.4;
  color: var(--muted-foreground);
  padding: 2px 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  white-space: nowrap;
}

.granel-cant-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px 3px 8px;
  border-radius: 999px;
  font-family: var(--font-mono, monospace);
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  color: var(--foreground);
  background: var(--muted);
  border: 1px solid var(--border);
  transition: border-color var(--transition-fast, 0.2s);
}

.badge-sum-num {
  font-variant-numeric: tabular-nums;
}

.badge-sum-goal {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted-foreground);
}

.badge-sum-dot {
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-foreground);
}

.granel-cant-badge.badge-sum-ok .badge-sum-dot {
  background: var(--success);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.18);
}

.granel-cant-badge.badge-sum-warn .badge-sum-dot {
  background: var(--destructive);
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.16);
}

@supports (background: color-mix(in srgb, red 5%, blue)) {
  .granel-cant-badge.badge-sum-ok {
    background: color-mix(in srgb, var(--success) 9%, var(--muted)) !important;
    border-color: color-mix(in srgb, var(--success) 30%, var(--border)) !important;
  }

  .granel-cant-badge.badge-sum-warn {
    background: color-mix(in srgb, var(--destructive) 8%, var(--muted)) !important;
    border-color: color-mix(in srgb, var(--destructive) 28%, var(--border)) !important;
  }

  .granel-cant-badge.badge-sum-ok .badge-sum-dot {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--success) 20%, transparent);
  }

  .granel-cant-badge.badge-sum-warn .badge-sum-dot {
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--destructive) 18%, transparent);
  }
}

.granel-subtotal-base {
  text-align: center;
}

.base-pill {
  display: inline-block;
  font-family: var(--font-sans);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  line-height: 1.4;
  text-transform: uppercase;
  color: var(--muted-foreground);
  padding: 2px 7px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  white-space: nowrap;
}

.granel-subtotal-costo {
  text-align: right;
  padding-right: 18px !important;
}

.granel-subtotal-costo strong {
  font-family: var(--font-mono, monospace);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--foreground);
}

.icon-spin {
  animation: spin 0.8s linear infinite !important;
  display: inline-block;
}

/* ==========================================================================
   WIDGET FLOTANTE / MONITOR DE COSTOS EN VIVO & TRIQUI (O | X)
   Diseño Adaptativo Premium Multitema (SaaS Moderno)
   ========================================================================== */

/* 1. Estructura Base (Modo Claro / Estándar Moderno) */
.note-cuaderno-widget {
  position: fixed;
  z-index: 850;
  width: 285px;
  min-width: 240px;
  max-width: 650px;
  min-height: 200px;
  max-height: 85vh;
  resize: both;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 14px;
  box-shadow: 
    0 16px 36px -4px rgba(15, 23, 42, 0.12),
    0 6px 14px -2px rgba(15, 23, 42, 0.05);
  color: var(--foreground, #0f172a);
  font-family: var(--font-sans, 'Inter', system-ui, -apple-system, sans-serif);
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  padding: 12px 14px 10px;
  transition: opacity 0.25s ease, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s ease, background-color 0.2s ease;
  user-select: none;
}

.note-cuaderno-widget:hover {
  box-shadow: 
    0 20px 42px -4px rgba(15, 23, 42, 0.16),
    0 8px 18px -2px rgba(15, 23, 42, 0.08);
}

/* Tirador / Grabber superior elegante para arrastrar */
.note-washi-tape {
  position: absolute;
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  width: 38px;
  height: 4px;
  background: rgba(0, 0, 0, 0.15);
  border-radius: 999px;
  cursor: grab;
  z-index: 2;
  transition: all 0.2s ease;
}

.note-washi-tape:hover,
.note-cuaderno-widget.is-dragging .note-washi-tape {
  background: var(--primary, #7c3aed);
  width: 48px;
  height: 5px;
  cursor: grabbing;
}

/* Cabecera del Widget */
.note-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border, #e2e8f0);
  margin-bottom: 8px;
  cursor: grab;
  flex-shrink: 0;
  gap: 8px;
}

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

.note-tabs {
  display: flex;
  gap: 2px;
  background: var(--muted, #f1f5f9);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.note-tab-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  font-family: var(--font-sans, inherit);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted-foreground, #64748b);
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.note-tab-btn:hover {
  color: var(--foreground, #0f172a);
}

.note-tab-btn.active {
  background: var(--card, #ffffff);
  color: var(--foreground, #0f172a);
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.note-tab-icon {
  font-size: 0.85rem;
}

.note-header-actions {
  display: flex;
  align-items: center;
  gap: 3px;
  flex-shrink: 0;
}

.note-btn-icon {
  background: transparent;
  border: none;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted-foreground, #64748b);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
}

.note-btn-icon:hover {
  background: var(--muted, #f1f5f9);
  color: var(--foreground, #0f172a);
}

.note-btn-icon.note-btn-close:hover {
  background: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Cuerpo con scroll suave */
.note-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-right: 2px;
}

.note-body::-webkit-scrollbar {
  width: 4px;
}

.note-body::-webkit-scrollbar-thumb {
  background: var(--border, #cbd5e1);
  border-radius: 4px;
}

/* ==========================================================================
   MONITOR EN VIVO DE SECCIONES (GRANEL, ETIQUETADO, IMPRESIÓN, PT)
   ========================================================================== */
.note-sections-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.note-sections-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 48vh;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

.note-sections-list::-webkit-scrollbar {
  width: 4px;
}

.note-sections-list::-webkit-scrollbar-thumb {
  background: var(--border, #cbd5e1);
  border-radius: 4px;
}

.note-section-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid var(--border, #e2e8f0);
  background: var(--card, #ffffff);
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
  position: relative;
}

.note-section-card:hover {
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.note-section-card:active {
  transform: scale(0.985);
}

.note-section-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.note-type-badge {
  font-family: var(--font-sans, system-ui);
  font-size: 0.65rem;
  font-weight: 750;
  padding: 2px 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.note-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}

.note-section-cost-val {
  font-family: var(--font-mono, monospace);
  font-size: 0.88rem;
  font-weight: 800;
  white-space: nowrap;
  letter-spacing: -0.01em;
}

.note-section-name-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.note-section-title {
  font-family: var(--font-sans, inherit);
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--foreground, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}

.note-section-link-hint {
  font-size: 0.75rem;
  color: var(--muted-foreground, #94a3b8);
  opacity: 0.6;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.note-section-card:hover .note-section-link-hint {
  opacity: 1;
  transform: translate(2px, -2px);
  color: var(--primary, #7c3aed);
}

/* Variantes de Color por Sección (Modo Claro / Base) */
.note-section-card.type-granel {
  background: #faf5ff;
  border-color: #e9d5ff;
}
.note-section-card.type-granel:hover {
  border-color: #c084fc;
}
.note-type-badge.badge-granel {
  background: #ede9fe;
  color: #6b21a8;
  border: 1px solid #ddd6fe;
}
.note-section-card.type-granel .note-badge-dot {
  background: #9333ea;
  box-shadow: 0 0 5px rgba(147, 51, 234, 0.4);
}
.note-section-card.type-granel .note-section-cost-val {
  color: #6b21a8;
}

.note-section-card.type-etiquetado {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.note-section-card.type-etiquetado:hover {
  border-color: #93c5fd;
}
.note-type-badge.badge-etiquetado {
  background: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}
.note-section-card.type-etiquetado .note-badge-dot {
  background: #2563eb;
  box-shadow: 0 0 5px rgba(37, 99, 235, 0.4);
}
.note-section-card.type-etiquetado .note-section-cost-val {
  color: #1e40af;
}

.note-section-card.type-impresion {
  background: #fff7ed;
  border-color: #fed7aa;
}
.note-section-card.type-impresion:hover {
  border-color: #fdba74;
}
.note-type-badge.badge-impresion {
  background: #ffedd5;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.note-section-card.type-impresion .note-badge-dot {
  background: #ea580c;
  box-shadow: 0 0 5px rgba(234, 88, 12, 0.4);
}
.note-section-card.type-impresion .note-section-cost-val {
  color: #9a3412;
}

.note-section-card.type-pt {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
.note-section-card.type-pt:hover {
  border-color: #86efac;
}
.note-type-badge.badge-pt {
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
}
.note-section-card.type-pt .note-badge-dot {
  background: #16a34a;
  box-shadow: 0 0 5px rgba(22, 163, 74, 0.4);
}
.note-section-card.type-pt .note-section-cost-val {
  color: #15803d;
}

/* Botón Agregar Sección */
.note-btn-add-section-inline {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 100%;
  margin-top: 6px;
  padding: 6px 10px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted-foreground, #64748b);
  background: transparent;
  border: 1.5px dashed var(--border, #cbd5e1);
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: all 0.15s ease;
}

.note-btn-add-section-inline:hover {
  color: var(--primary, #7c3aed);
  border-color: var(--primary, #7c3aed);
  background: rgba(124, 58, 237, 0.05);
}

/* Caja de Resumen Ejecutivo PT */
.note-exec-summary-box {
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--muted, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.note-exec-kpi {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
}

.note-exec-kpi.note-exec-pv {
  align-items: flex-end;
}

.note-exec-label {
  font-size: 0.66rem;
  color: var(--muted-foreground, #64748b);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.note-exec-val {
  font-family: var(--font-mono, monospace);
  font-size: 0.88rem;
  font-weight: 800;
  color: var(--foreground, #0f172a);
  white-space: nowrap;
}

.note-exec-val.pv {
  color: #059669;
}

.note-exec-sep {
  color: var(--border, #cbd5e1);
  font-size: 0.9rem;
}

.note-sections-empty {
  text-align: center;
  padding: 16px 8px;
  color: var(--muted-foreground, #64748b);
  font-size: 0.85rem;
}

.note-btn-add-section {
  margin-top: 8px;
  background: var(--muted, #f1f5f9);
  border: 1px dashed var(--border, #cbd5e1);
  border-radius: 6px;
  padding: 5px 12px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--foreground, #0f172a);
  cursor: pointer;
  transition: all 0.15s;
}

.note-btn-add-section:hover {
  background: var(--border, #e2e8f0);
  border-color: var(--primary, #7c3aed);
  color: var(--primary, #7c3aed);
}

/* ==========================================================================
   PIE DEL WIDGET (Diseño Anti-Colisión)
   ========================================================================== */
.note-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  padding-top: 6px;
  border-top: 1px solid var(--border, #e2e8f0);
  font-size: 0.72rem;
  padding-right: 18px; /* Espacio para el tirador sin superposición */
  position: relative;
  gap: 6px;
  flex-shrink: 0;
}

.note-zone-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--muted, #f1f5f9);
  color: var(--muted-foreground, #64748b);
  border: 1px solid var(--border, #e2e8f0);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 145px;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.note-zone-pill:hover {
  background: var(--border, #e2e8f0);
  color: var(--foreground, #0f172a);
}

.note-zone-icon {
  font-size: 0.85rem;
  flex-shrink: 0;
}

.note-zone-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.note-footer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.note-footer-switch-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  color: var(--muted-foreground, #64748b);
  background: var(--muted, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.note-footer-switch-bar-btn:hover {
  color: var(--primary, #7c3aed);
  border-color: var(--primary, #7c3aed);
  background: rgba(124, 58, 237, 0.08);
}

/* Tirador de Redimensionamiento Táctil */
.note-resize-handle {
  position: absolute;
  bottom: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  cursor: nwse-resize;
  color: var(--muted-foreground, #94a3b8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: color 0.15s, transform 0.15s;
  pointer-events: none;
  opacity: 0.65;
}

.note-cuaderno-widget:hover .note-resize-handle {
  color: var(--primary, #7c3aed);
  opacity: 1;
  transform: scale(1.1);
}

/* Estado Minimizado */
.note-cuaderno-widget.is-minimized {
  width: auto !important;
  height: auto !important;
  padding: 6px 12px !important;
  cursor: pointer;
  border-radius: 999px;
}

.note-minimized-strip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--foreground, #0f172a);
}

.btn-expand-note {
  background: transparent;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: inherit;
  cursor: pointer;
  padding: 0;
}

/* ==========================================================================
   MINI-JUEGO TRIQUI (O | X)
   ========================================================================== */
.triqui-scoreboard {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--muted, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 4px 10px;
  margin-bottom: 8px;
  font-size: 0.8rem;
  font-weight: 700;
}

.score-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 2px 6px;
  border-radius: 4px;
}

.score-item.score-x { color: #2563eb; }
.score-item.score-o { color: #e11d48; }

.score-item.is-active-turn {
  background: var(--card, #ffffff);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.score-status {
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.score-status.turn-win-x {
  color: #16a34a;
  animation: pulse 1s ease infinite;
}

.score-status.turn-win-o {
  color: #e11d48;
  animation: pulse 1s ease infinite;
}

.score-status.turn-tie {
  color: #d97706;
}

.score-status.turn-thinking {
  color: #7c3aed;
  font-style: italic;
}

.triqui-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 44px);
  gap: 5px;
  margin-bottom: 8px;
  background: var(--muted, #f1f5f9);
  padding: 5px;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
}

.triqui-cell {
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-sans, inherit);
  font-size: 1.45rem;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.triqui-cell:hover:not(:disabled) {
  border-color: var(--primary, #7c3aed);
  transform: scale(1.04);
  box-shadow: 0 2px 6px rgba(124, 58, 237, 0.15);
}

.triqui-cell:active:not(:disabled) {
  transform: scale(0.96);
}

.triqui-cell:disabled {
  cursor: default;
}

.triqui-cell.cell-x .cell-mark {
  color: #2563eb;
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.triqui-cell.cell-o .cell-mark {
  color: #e11d48;
  animation: popIn 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.triqui-cell.is-winner {
  background: #fef08a !important;
  border-color: #ca8a04 !important;
  box-shadow: 0 0 10px rgba(234, 179, 8, 0.5) !important;
  animation: winBounce 0.8s ease infinite alternate;
}

@keyframes popIn {
  0% { transform: scale(0.2) rotate(-15deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

@keyframes winBounce {
  0% { transform: scale(1); }
  100% { transform: scale(1.06); }
}

.triqui-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 4px;
}

.triqui-tool-btn {
  background: var(--muted, #f1f5f9);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  font-family: var(--font-sans, inherit);
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--muted-foreground, #64748b);
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.triqui-tool-btn:hover {
  background: var(--border, #e2e8f0);
  color: var(--foreground, #0f172a);
}

.triqui-tool-btn.active {
  background: rgba(124, 58, 237, 0.12);
  color: var(--primary, #7c3aed);
  border-color: rgba(124, 58, 237, 0.3);
}

.triqui-reset-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
  border-color: rgba(239, 68, 68, 0.25);
}

/* ==========================================================================
   PESTAÑA DE APUNTES RÁPIDOS
   ========================================================================== */
.notes-container {
  display: flex;
  flex-direction: column;
}

.note-ruled-textarea {
  width: 100%;
  height: 154px;
  background: var(--card, #ffffff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-sans, inherit);
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--foreground, #0f172a);
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.note-ruled-textarea:focus {
  border-color: var(--primary, #7c3aed);
  box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.notes-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 0.74rem;
  color: var(--muted-foreground, #64748b);
}

.notes-status-badge {
  color: #16a34a;
  font-weight: 600;
  transition: opacity 0.2s;
}

.notes-status-badge.saving {
  color: #d97706;
}

.notes-clear-btn {
  background: transparent;
  border: none;
  color: var(--muted-foreground, #64748b);
  font-family: inherit;
  font-size: 0.74rem;
  cursor: pointer;
  text-decoration: underline;
  padding: 0;
}

.notes-clear-btn:hover {
  color: #dc2626;
}

/* ==========================================================================
   ZONAS DE POSICIONAMIENTO
   ========================================================================== */
.note-cuaderno-widget.note-zone-margin-left {
  top: 195px;
  left: 16px;
  bottom: auto;
  right: auto;
}

.note-cuaderno-widget.note-zone-bottom-left {
  bottom: 22px;
  left: 20px;
  top: auto;
  right: auto;
}

.note-cuaderno-widget.note-zone-margin-right {
  top: 195px;
  right: 16px;
  left: auto;
  bottom: auto;
}

.note-cuaderno-widget.note-zone-bottom-right {
  bottom: 22px;
  right: 20px;
  top: auto;
  left: auto;
}

.note-cuaderno-widget.note-zone-hidden {
  display: none !important;
}

@media (max-width: 1100px) {
  .note-cuaderno-widget.note-zone-margin-left,
  .note-cuaderno-widget.note-zone-margin-right {
    top: auto;
    bottom: 20px;
  }
}

/* Selector modal de Zonas */
.note-zone-options-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
  margin-top: 6px;
}

.note-zone-card-mini {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1.5px solid transparent;
  background: var(--card, #ffffff);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  position: relative;
  box-sizing: border-box;
  text-align: left;
}

.note-zone-card-mini:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
  border-color: var(--primary, #7c3aed);
}

.note-zone-card-mini.active {
  border-color: var(--primary, #7c3aed);
  box-shadow: 0 0 0 2px var(--primary, #7c3aed);
  background: rgba(124, 58, 237, 0.05);
}

.note-zone-card-mini.active::after {
  content: '✓';
  position: absolute;
  top: 2px;
  right: 2px;
  font-size: 8px;
  font-weight: 900;
  width: 12px;
  height: 12px;
  background: var(--primary, #7c3aed);
  color: #ffffff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.note-zone-card-mini.note-zone-hide {
  grid-column: span 2;
  justify-content: center;
  border-style: dashed;
}

.note-zone-card-mini.note-zone-hide:hover {
  border-color: #dc2626;
  color: #dc2626;
}

.note-zone-icon {
  font-size: 1.05rem;
  flex-shrink: 0;
}

.note-zone-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.note-zone-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--foreground, #0f172a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.note-zone-tag {
  font-size: 0.68rem;
  color: var(--muted-foreground, #64748b);
}

/* ==========================================================================
   RESUMEN FINANCIERO: DISTINCIÓN MANO DE OBRA UNITARIA VS LOTE
   ========================================================================== */
.fin-row.fin-row-highlight {
  background: rgba(124, 58, 237, 0.05);
  padding: 2px 4px;
  border-radius: 4px;
  margin: 1px 0;
}

.fin-row.fin-row-highlight .fin-label {
  font-weight: 700;
  color: var(--foreground, #0f172a);
}

.fin-val.fin-val-unit {
  font-weight: 800;
  color: #0284c7;
}

/* ==========================================================================
   EXCLUSIVIDAD MUTUA: BARRA SUPERIOR VS NOTA DE CUADERNO
   ========================================================================== */
#quick-nav-bar.hidden-by-note,
body.note-view-active #quick-nav-bar {
  display: none !important;
}

body.note-view-active .granel-card,
body.note-view-active .packaging-card,
body.note-view-active .card,
body.note-view-active [id^="card-"] {
  scroll-margin-top: 85px !important;
}

.quick-nav-switch-to-note-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--card, #fff);
  color: var(--foreground, #1e293b);
  font-size: 0.76rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  margin-right: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.quick-nav-switch-to-note-btn:hover {
  border-color: var(--primary, #7c3aed);
  color: var(--primary, #7c3aed);
  background: rgba(124, 58, 237, 0.07);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(124, 58, 237, 0.15);
}

.quick-nav-switch-to-note-btn .btn-note-icon {
  font-size: 0.85rem;
}

.note-btn-switch-bar:hover {
  color: var(--primary, #7c3aed) !important;
  background: rgba(124, 58, 237, 0.1) !important;
}

/* ==========================================================================
   ADAPTACIONES A CADA ESTILO VISUAL / TEMA (100% ARMONIZADO)
   ========================================================================== */

/* --- 1. MODO OSCURO (OLED / Dark Glass) --- */
[data-theme="dark"] .note-cuaderno-widget {
  background: rgba(17, 24, 39, 0.94);
  border-color: rgba(255, 255, 255, 0.09);
  color: #f8fafc;
  box-shadow: 0 18px 40px -4px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .note-washi-tape {
  background: rgba(255, 255, 255, 0.2);
}
[data-theme="dark"] .note-header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .note-tabs {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .note-tab-btn {
  color: #94a3b8;
}
[data-theme="dark"] .note-tab-btn.active {
  background: #1e293b;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
[data-theme="dark"] .note-btn-icon {
  color: #94a3b8;
}
[data-theme="dark"] .note-btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}
[data-theme="dark"] .note-section-card {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .note-section-title {
  color: #f1f5f9;
}
[data-theme="dark"] .note-section-card.type-granel {
  background: rgba(147, 51, 234, 0.12);
  border-color: rgba(147, 51, 234, 0.35);
}
[data-theme="dark"] .note-type-badge.badge-granel {
  background: rgba(147, 51, 234, 0.22);
  color: #d8b4fe;
  border-color: rgba(147, 51, 234, 0.4);
}
[data-theme="dark"] .note-section-card.type-granel .note-badge-dot {
  background: #c084fc;
  box-shadow: 0 0 6px #a855f7;
}
[data-theme="dark"] .note-section-card.type-granel .note-section-cost-val {
  color: #d8b4fe;
}
[data-theme="dark"] .note-section-card.type-etiquetado {
  background: rgba(37, 99, 235, 0.12);
  border-color: rgba(37, 99, 235, 0.35);
}
[data-theme="dark"] .note-type-badge.badge-etiquetado {
  background: rgba(37, 99, 235, 0.22);
  color: #93c5fd;
  border-color: rgba(37, 99, 235, 0.4);
}
[data-theme="dark"] .note-section-card.type-etiquetado .note-badge-dot {
  background: #60a5fa;
  box-shadow: 0 0 6px #3b82f6;
}
[data-theme="dark"] .note-section-card.type-etiquetado .note-section-cost-val {
  color: #bfdbfe;
}
[data-theme="dark"] .note-section-card.type-impresion {
  background: rgba(234, 88, 12, 0.12);
  border-color: rgba(234, 88, 12, 0.35);
}
[data-theme="dark"] .note-type-badge.badge-impresion {
  background: rgba(234, 88, 12, 0.22);
  color: #fed7aa;
  border-color: rgba(234, 88, 12, 0.4);
}
[data-theme="dark"] .note-section-card.type-impresion .note-badge-dot {
  background: #fb923c;
  box-shadow: 0 0 6px #f97316;
}
[data-theme="dark"] .note-section-card.type-impresion .note-section-cost-val {
  color: #fed7aa;
}
[data-theme="dark"] .note-section-card.type-pt {
  background: rgba(16, 185, 129, 0.12);
  border-color: rgba(16, 185, 129, 0.35);
}
[data-theme="dark"] .note-type-badge.badge-pt {
  background: rgba(16, 185, 129, 0.22);
  color: #86efac;
  border-color: rgba(16, 185, 129, 0.4);
}
[data-theme="dark"] .note-section-card.type-pt .note-badge-dot {
  background: #34d399;
  box-shadow: 0 0 6px #10b981;
}
[data-theme="dark"] .note-section-card.type-pt .note-section-cost-val {
  color: #86efac;
}
[data-theme="dark"] .note-exec-summary-box {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .note-exec-val {
  color: #f1f5f9;
}
[data-theme="dark"] .note-exec-val.pv {
  color: #34d399;
}
[data-theme="dark"] .note-footer {
  border-top-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .note-zone-pill,
[data-theme="dark"] .note-footer-switch-bar-btn {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #94a3b8;
}
[data-theme="dark"] .note-zone-pill:hover,
[data-theme="dark"] .note-footer-switch-bar-btn:hover {
  background: #334155;
  color: #f8fafc;
}
[data-theme="dark"] .note-btn-add-section-inline {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.15);
}
[data-theme="dark"] .note-btn-add-section-inline:hover {
  color: #c4b5fd;
  border-color: #a78bfa;
  background: rgba(124, 58, 237, 0.15);
}
[data-theme="dark"] .triqui-scoreboard {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}
[data-theme="dark"] .triqui-grid {
  background: rgba(0, 0, 0, 0.25);
  border-color: rgba(255, 255, 255, 0.1);
}
[data-theme="dark"] .triqui-cell {
  background: #232936;
  border-color: rgba(255, 255, 255, 0.12);
}
[data-theme="dark"] .triqui-cell:hover:not(:disabled) {
  background: #2d3444;
  border-color: #38bdf8;
}
[data-theme="dark"] .triqui-cell.cell-x .cell-mark { color: #60a5fa; }
[data-theme="dark"] .triqui-cell.cell-o .cell-mark { color: #fb7185; }
[data-theme="dark"] .triqui-tool-btn {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}
[data-theme="dark"] .triqui-tool-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}
[data-theme="dark"] .note-ruled-textarea {
  background: #1e293b;
  border-color: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
}
[data-theme="dark"] .fin-row.fin-row-highlight {
  background: rgba(255, 255, 255, 0.05);
}
[data-theme="dark"] .fin-row.fin-row-highlight .fin-label {
  color: #f3f4f6;
}
[data-theme="dark"] .fin-val.fin-val-unit {
  color: #38bdf8;
}

/* --- 2. METRÓPOLIS NEÓN (Ciudad) --- */
[data-theme="ciudad"] .note-cuaderno-widget {
  background: rgba(8, 17, 31, 0.95);
  border-color: rgba(254, 212, 106, 0.35);
  color: #fed46a;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75), 0 0 18px rgba(254, 212, 106, 0.12);
}
[data-theme="ciudad"] .note-washi-tape {
  background: rgba(254, 212, 106, 0.5);
  box-shadow: 0 0 8px rgba(254, 212, 106, 0.4);
}
[data-theme="ciudad"] .note-header {
  border-bottom-color: rgba(254, 212, 106, 0.2);
}
[data-theme="ciudad"] .note-tabs {
  background: rgba(15, 27, 46, 0.9);
  border-color: rgba(254, 212, 106, 0.2);
}
[data-theme="ciudad"] .note-tab-btn {
  color: rgba(254, 212, 106, 0.7);
}
[data-theme="ciudad"] .note-tab-btn.active {
  background: #fed46a;
  color: #08111f;
  font-weight: 800;
}
[data-theme="ciudad"] .note-btn-icon {
  color: #fed46a;
}
[data-theme="ciudad"] .note-section-card {
  background: rgba(15, 27, 46, 0.85);
  border-color: rgba(254, 212, 106, 0.25);
}
[data-theme="ciudad"] .note-section-title {
  color: #ffffff;
}
[data-theme="ciudad"] .note-section-card.type-granel {
  border-color: rgba(168, 85, 247, 0.5);
}
[data-theme="ciudad"] .note-section-card.type-granel .note-section-cost-val {
  color: #c084fc;
}
[data-theme="ciudad"] .note-section-card.type-etiquetado {
  border-color: rgba(56, 189, 248, 0.5);
}
[data-theme="ciudad"] .note-section-card.type-etiquetado .note-section-cost-val {
  color: #38bdf8;
}
[data-theme="ciudad"] .note-section-card.type-pt {
  border-color: rgba(52, 211, 153, 0.5);
}
[data-theme="ciudad"] .note-section-card.type-pt .note-section-cost-val {
  color: #34d399;
}
[data-theme="ciudad"] .note-exec-summary-box {
  background: rgba(15, 27, 46, 0.95);
  border-color: rgba(254, 212, 106, 0.3);
}
[data-theme="ciudad"] .note-exec-val {
  color: #fed46a;
}
[data-theme="ciudad"] .note-exec-val.pv {
  color: #38bdf8;
}
[data-theme="ciudad"] .note-zone-pill,
[data-theme="ciudad"] .note-footer-switch-bar-btn {
  background: rgba(15, 27, 46, 0.9);
  border-color: rgba(254, 212, 106, 0.25);
  color: #fed46a;
}

/* --- 3. CYBERPOP RETRO --- */
[data-theme="cyberpop"] .note-cuaderno-widget {
  background: #ffffff;
  border: 2.5px solid #000000;
  box-shadow: 5px 5px 0px #000000;
  border-radius: 8px;
  color: #000000;
}
[data-theme="cyberpop"] .note-washi-tape {
  background: #ffd500;
  border: 1.5px solid #000000;
  height: 6px;
  width: 44px;
}
[data-theme="cyberpop"] .note-header {
  border-bottom: 2px solid #000000;
}
[data-theme="cyberpop"] .note-tabs {
  background: #f4f4f5;
  border: 2px solid #000000;
  border-radius: 6px;
}
[data-theme="cyberpop"] .note-tab-btn {
  color: #000000;
  font-weight: 700;
}
[data-theme="cyberpop"] .note-tab-btn.active {
  background: #ffd500;
  border: 1.5px solid #000000;
  box-shadow: 1px 1px 0px #000000;
}
[data-theme="cyberpop"] .note-section-card {
  border: 2px solid #000000;
  box-shadow: 2px 2px 0px #000000;
  border-radius: 6px;
}
[data-theme="cyberpop"] .note-type-badge {
  border: 1.5px solid #000000;
  font-weight: 900;
}
[data-theme="cyberpop"] .note-section-title {
  color: #000000;
  font-weight: 800;
}
[data-theme="cyberpop"] .note-exec-summary-box {
  border: 2px solid #000000;
  box-shadow: 2px 2px 0px #000000;
  background: #fffbe8;
}
[data-theme="cyberpop"] .note-zone-pill,
[data-theme="cyberpop"] .note-footer-switch-bar-btn {
  border: 1.5px solid #000000;
  color: #000000;
  font-weight: 700;
  background: #ffd500;
  box-shadow: 1px 1px 0px #000000;
}

/* --- 4. SAKURA JAPÓN --- */
[data-theme="sakura"] .note-cuaderno-widget {
  background: rgba(255, 245, 247, 0.95);
  border: 1.5px solid rgba(225, 155, 170, 0.4);
  color: #4a3036;
  border-radius: 16px;
  box-shadow: 0 16px 36px rgba(169, 87, 112, 0.12), 0 4px 12px rgba(169, 87, 112, 0.06);
}
[data-theme="sakura"] .note-washi-tape {
  background: rgba(244, 63, 94, 0.35);
  border-radius: 999px;
}
[data-theme="sakura"] .note-header {
  border-bottom-color: rgba(169, 87, 112, 0.2);
}
[data-theme="sakura"] .note-tabs {
  background: #fce7eb;
  border-color: rgba(169, 87, 112, 0.2);
  border-radius: 12px;
}
[data-theme="sakura"] .note-tab-btn {
  color: #8c5b68;
}
[data-theme="sakura"] .note-tab-btn.active {
  background: #ffffff;
  color: #a95770;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(169, 87, 112, 0.15);
}
[data-theme="sakura"] .note-section-card {
  background: #ffffff;
  border-color: rgba(225, 155, 170, 0.35);
  border-radius: 10px;
}
[data-theme="sakura"] .note-section-title {
  color: #4a3036;
}
[data-theme="sakura"] .note-section-card.type-pt {
  background: #fff1f2;
  border-color: #fecdd3;
}
[data-theme="sakura"] .note-section-card.type-pt .note-section-cost-val {
  color: #e11d48;
}
[data-theme="sakura"] .note-exec-summary-box {
  background: #fff5f7;
  border-color: rgba(169, 87, 112, 0.25);
}
[data-theme="sakura"] .note-exec-val.pv {
  color: #e11d48;
}
[data-theme="sakura"] .note-zone-pill,
[data-theme="sakura"] .note-footer-switch-bar-btn {
  background: #fce7eb;
  border-color: rgba(169, 87, 112, 0.25);
  color: #a95770;
}

/* --- 5. PLANO BLUEPRINT --- */
[data-theme="plano"] .note-cuaderno-widget {
  background: rgba(0, 41, 82, 0.95);
  border: 1.5px solid rgba(56, 189, 248, 0.4);
  color: #ffffff;
  box-shadow: 0 16px 36px rgba(0, 20, 45, 0.7), inset 0 0 20px rgba(56, 189, 248, 0.05);
}
[data-theme="plano"] .note-washi-tape {
  background: #38bdf8;
  box-shadow: 0 0 8px rgba(56, 189, 248, 0.4);
}
[data-theme="plano"] .note-header {
  border-bottom-color: rgba(56, 189, 248, 0.3);
}
[data-theme="plano"] .note-tabs {
  background: #002244;
  border-color: rgba(56, 189, 248, 0.3);
}
[data-theme="plano"] .note-tab-btn {
  color: #93c5fd;
}
[data-theme="plano"] .note-tab-btn.active {
  background: #38bdf8;
  color: #002244;
  font-weight: 800;
}
[data-theme="plano"] .note-section-card {
  background: #002952;
  border-color: rgba(56, 189, 248, 0.35);
}
[data-theme="plano"] .note-section-title {
  color: #ffffff;
}
[data-theme="plano"] .note-section-cost-val {
  color: #38bdf8;
}
[data-theme="plano"] .note-exec-summary-box {
  background: #002244;
  border-color: rgba(56, 189, 248, 0.4);
}
[data-theme="plano"] .note-exec-val {
  color: #ffffff;
}
[data-theme="plano"] .note-exec-val.pv {
  color: #38bdf8;
}
[data-theme="plano"] .note-zone-pill,
[data-theme="plano"] .note-footer-switch-bar-btn {
  background: #002244;
  border-color: rgba(56, 189, 248, 0.35);
  color: #38bdf8;
}

/* --- 6. TERCIOPELO PRO ORO (Premium) --- */
[data-theme="premium"] .note-cuaderno-widget {
  background: rgba(17, 17, 21, 0.96);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fbbf24;
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.8), 0 0 16px rgba(251, 191, 36, 0.1);
}
[data-theme="premium"] .note-washi-tape {
  background: linear-gradient(90deg, #d97706, #fbbf24, #d97706);
  box-shadow: 0 0 10px rgba(251, 191, 36, 0.4);
}
[data-theme="premium"] .note-header {
  border-bottom-color: rgba(251, 191, 36, 0.2);
}
[data-theme="premium"] .note-tabs {
  background: #18181b;
  border-color: rgba(251, 191, 36, 0.2);
}
[data-theme="premium"] .note-tab-btn {
  color: #a1a1aa;
}
[data-theme="premium"] .note-tab-btn.active {
  background: #fbbf24;
  color: #000000;
  font-weight: 800;
}
[data-theme="premium"] .note-section-card {
  background: #18181b;
  border-color: rgba(251, 191, 36, 0.25);
}
[data-theme="premium"] .note-section-title {
  color: #f4f4f5;
}
[data-theme="premium"] .note-section-cost-val {
  color: #fbbf24;
}
[data-theme="premium"] .note-exec-summary-box {
  background: #18181b;
  border-color: rgba(251, 191, 36, 0.3);
}
[data-theme="premium"] .note-exec-val {
  color: #fbbf24;
}
[data-theme="premium"] .note-exec-val.pv {
  color: #34d399;
}
[data-theme="premium"] .note-zone-pill,
[data-theme="premium"] .note-footer-switch-bar-btn {
  background: #18181b;
  border-color: rgba(251, 191, 36, 0.25);
  color: #fbbf24;
}

/* --- 7. JARDÍN BOTÁNICO (Natural) --- */
[data-theme="natural"] .note-cuaderno-widget {
  background: rgba(253, 251, 247, 0.96);
  border: 1.5px solid rgba(5, 150, 105, 0.25);
  color: #064e3b;
  box-shadow: 0 14px 30px rgba(6, 78, 59, 0.08);
}
[data-theme="natural"] .note-washi-tape {
  background: rgba(5, 150, 105, 0.4);
}
[data-theme="natural"] .note-header {
  border-bottom-color: rgba(5, 150, 105, 0.2);
}
[data-theme="natural"] .note-tabs {
  background: #f0f7f2;
  border-color: rgba(5, 150, 105, 0.2);
}
[data-theme="natural"] .note-tab-btn {
  color: #047857;
}
[data-theme="natural"] .note-tab-btn.active {
  background: #ffffff;
  color: #065f46;
  font-weight: 700;
  box-shadow: 0 1px 3px rgba(6, 78, 59, 0.12);
}
[data-theme="natural"] .note-section-card {
  background: #ffffff;
  border-color: rgba(5, 150, 105, 0.2);
}
[data-theme="natural"] .note-section-title {
  color: #064e3b;
}
[data-theme="natural"] .note-section-card.type-pt {
  background: #ecfdf5;
  border-color: #a7f3d0;
}
[data-theme="natural"] .note-section-card.type-pt .note-section-cost-val {
  color: #059669;
}
[data-theme="natural"] .note-exec-summary-box {
  background: #f0f7f2;
  border-color: rgba(5, 150, 105, 0.25);
}
[data-theme="natural"] .note-exec-val.pv {
  color: #059669;
}
[data-theme="natural"] .note-zone-pill,
[data-theme="natural"] .note-footer-switch-bar-btn {
  background: #f0f7f2;
  border-color: rgba(5, 150, 105, 0.2);
  color: #065f46;
}

/* --- 8. BOCETO A MANO & SUPERR NOTEBOOK --- */
[data-theme="boceto"] .note-cuaderno-widget,
[data-theme="superr"] .note-cuaderno-widget {
  background-color: #fffef2;
  background-image: repeating-linear-gradient(
    transparent,
    transparent 23px,
    rgba(43, 26, 7, 0.055) 23px,
    rgba(43, 26, 7, 0.055) 24px
  );
  border: 1.5px solid rgba(43, 26, 7, 0.18);
  box-shadow: 0 10px 24px -4px rgba(43, 26, 7, 0.14), 0 4px 10px -2px rgba(43, 26, 7, 0.08);
  color: #2b1a07;
  font-family: 'Patrick Hand', 'Caveat', cursive, var(--font-sans);
}
[data-theme="boceto"] .note-washi-tape,
[data-theme="superr"] .note-washi-tape {
  background: rgba(255, 237, 213, 0.88);
  border-left: 2px dashed rgba(234, 88, 12, 0.45);
  border-right: 2px dashed rgba(234, 88, 12, 0.45);
  width: 72px;
  height: 18px;
  top: -8px;
}
[data-theme="boceto"] .note-header,
[data-theme="superr"] .note-header {
  border-bottom: 1.5px dashed rgba(43, 26, 7, 0.14);
}
[data-theme="boceto"] .note-tabs,
[data-theme="superr"] .note-tabs {
  background: rgba(43, 26, 7, 0.05);
}
[data-theme="boceto"] .note-tab-btn,
[data-theme="superr"] .note-tab-btn {
  font-family: 'Patrick Hand', 'Caveat', cursive, sans-serif;
  color: #6b5e51;
}
[data-theme="boceto"] .note-tab-btn.active,
[data-theme="superr"] .note-tab-btn.active {
  background: rgba(43, 26, 7, 0.1);
  color: #2b1a07;
}
[data-theme="boceto"] .note-section-card,
[data-theme="superr"] .note-section-card {
  border: 1.5px dashed rgba(43, 26, 7, 0.2);
  background: rgba(255, 255, 255, 0.65);
}
[data-theme="boceto"] .note-section-title,
[data-theme="superr"] .note-section-title {
  font-family: 'Patrick Hand', 'Caveat', cursive, sans-serif;
  color: #2b1a07;
  font-size: 0.92rem;
}
[data-theme="boceto"] .note-exec-summary-box,
[data-theme="superr"] .note-exec-summary-box {
  background: rgba(255, 255, 255, 0.65);
  border: 1.5px dashed rgba(43, 26, 7, 0.2);
}

/* --- 9. FROSTED PAPER --- */
[data-theme="frosted"] .note-cuaderno-widget {
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(20px);
  border: 1px solid rgba(0, 0, 0, 0.14);
  color: #0a0a0a;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.06);
}
[data-theme="frosted"] .note-washi-tape {
  background: rgba(0, 0, 0, 0.15);
}
[data-theme="frosted"] .note-tabs {
  background: #f5f5f5;
  border-color: rgba(0, 0, 0, 0.1);
}
[data-theme="frosted"] .note-tab-btn.active {
  background: #0a0a0a;
  color: #ffffff;
}
[data-theme="frosted"] .note-section-card {
  background: #ffffff;
  border-color: rgba(0, 0, 0, 0.1);
}

/* --- 10. SLUSH STICKER --- */
[data-theme="slush"] .note-cuaderno-widget {
  background: #ffffff;
  border: 2px solid #bae6fd;
  box-shadow: 0 12px 28px rgba(77, 162, 255, 0.15);
  border-radius: 16px;
  color: #0f172a;
}
[data-theme="slush"] .note-washi-tape {
  background: #38bdf8;
  height: 5px;
}
[data-theme="slush"] .note-tab-btn.active {
  background: #38bdf8;
  color: #ffffff;
}
[data-theme="slush"] .note-section-card {
  border-color: #e0f2fe;
}

