*{margin:0;padding:0;box-sizing:border-box}
body{font-family:'Roboto',sans-serif;background:#f0f2f5;color:#333}

/* ===== TEMAS ===== */
body.tema-intermedio {
  background: #d1d5db !important;
  color: #111827 !important;
}
body.tema-intermedio .card {
  background: #f3f4f6 !important;
  box-shadow: 0 2px 4px rgba(0,0,0,0.12) !important;
}
body.tema-intermedio .header {
  background: linear-gradient(135deg,#374151 0%,#4b5563 100%) !important;
}
body.tema-intermedio .nav-tab.active {
  background: #f3f4f6 !important;
  color: #374151 !important;
}
body.tema-intermedio .card-header {
  color: #1f2937 !important;
}
body.tema-intermedio .data-table th {
  background: #e5e7eb !important;
  color: #374151 !important;
}
body.tema-intermedio .data-table td {
  color: #1f2937 !important;
}
body.tema-intermedio .form-input, body.tema-intermedio .form-select {
  background: #fff !important;
  color: #1f2937 !important;
}

body.tema-nocturno {
  background: #0f172a !important;
  color: #e2e8f0 !important;
}
body.tema-nocturno .card {
  background: #1e293b !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4) !important;
  color: #e2e8f0 !important;
}
body.tema-nocturno .header {
  background: linear-gradient(135deg,#0f172a 0%,#1e293b 100%) !important;
}
body.tema-nocturno .nav-tab { color: rgba(226,232,240,0.7) !important; }
body.tema-nocturno .nav-tab:hover { background: rgba(255,255,255,0.08) !important; color: #fff !important; }
body.tema-nocturno .nav-tab.active {
  background: #1e293b !important;
  color: #60a5fa !important;
}
body.tema-nocturno .card-header { color: #60a5fa !important; border-bottom-color: #334155 !important; }
body.tema-nocturno .data-table th { background: #0f172a !important; color: #94a3b8 !important; border-bottom-color: #334155 !important; }
body.tema-nocturno .data-table td { color: #cbd5e1 !important; border-bottom-color: #1e293b !important; }
body.tema-nocturno .data-table tr:hover { background: #273549 !important; }
body.tema-nocturno .form-input, body.tema-nocturno .form-select {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
body.tema-nocturno .form-label { color: #94a3b8 !important; }
body.tema-nocturno .btn-secondary { background: #334155 !important; }
body.tema-nocturno input[type="text"], body.tema-nocturno input[type="number"] {
  background: #0f172a !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}
body.tema-nocturno select, body.tema-nocturno #idiomaSelector { background: #0f172a !important; color: #e2e8f0 !important; border-color: #334155 !important; }
body.tema-nocturno .main-container { background: #0f172a; }
body.tema-nocturno h1,body.tema-nocturno h2,body.tema-nocturno h3 { color: #e2e8f0 !important; }
body.tema-nocturno p { color: #94a3b8 !important; }
body.tema-nocturno .filter-input { background: #1e293b !important; color: #cbd5e1 !important; border-color: #334155 !important; }

/* ===== MODO NOCTURNO – FIXES ZONAS BLANCAS ===== */

/* Encabezados de tabla monitor (th sticky con background:#f8f9fa) */
body.tema-nocturno #monitorTable thead th,
body.tema-nocturno #ddmrpTable thead th,
body.tema-nocturno .data-table thead th,
body.tema-nocturno table thead th {
  background: #1e293b !important;
  color: #94a3b8 !important;
  border-bottom-color: #334155 !important;
}

/* Celdas sticky del tbody (columnas fijas Material/Descripcion) */
body.tema-nocturno #monitorTable tbody td,
body.tema-nocturno #ddmrpTable tbody td,
body.tema-nocturno .data-table tbody td,
body.tema-nocturno table tbody td {
  background: #0f172a !important;
  color: #cbd5e1 !important;
  border-bottom-color: #1e293b !important;
}
body.tema-nocturno #monitorTable tbody tr:hover td,
body.tema-nocturno #ddmrpTable tbody tr:hover td,
body.tema-nocturno table tbody tr:hover td {
  background: #1e293b !important;
}

/* Inputs de filtro dentro de tablas */
body.tema-nocturno table input[type="text"],
body.tema-nocturno table input[type="number"],
body.tema-nocturno table select,
body.tema-nocturno .seg-filter,
body.tema-nocturno #filtroSemanaPedido,
body.tema-nocturno #filtroMesPedido,
body.tema-nocturno #filtroMaterial,
body.tema-nocturno #filtroDescripcion,
body.tema-nocturno #filtroProveedor,
body.tema-nocturno #filtroComprador,
body.tema-nocturno #filtroSemanaLlegada,
body.tema-nocturno #filtroMesLlegada,
body.tema-nocturno #filtroSemanaPago,
body.tema-nocturno #filtroMesPago {
  background: #1e293b !important;
  color: #e2e8f0 !important;
  border-color: #334155 !important;
}

/* Filas alternas / zebra blancas */
body.tema-nocturno table tbody tr:nth-child(even) td {
  background: #111827 !important;
}

/* Celdas sticky fijas (Material, Descripcion) en monitor */
body.tema-nocturno #monitorTable tbody td[style*="position:sticky"],
body.tema-nocturno #ddmrpTable tbody td[style*="position:sticky"] {
  background: #0f172a !important;
}
body.tema-nocturno #monitorTable tbody tr:hover td[style*="position:sticky"],
body.tema-nocturno #ddmrpTable tbody tr:hover td[style*="position:sticky"] {
  background: #1e293b !important;
}

/* Thead th sticky (columnas fijas) */
body.tema-nocturno #monitorTable thead th[style*="position:sticky"],
body.tema-nocturno #ddmrpTable thead th[style*="position:sticky"] {
  background: #1e293b !important;
}

/* Sortable hover */
body.tema-nocturno #ddmrpTable thead th.ddmrp-sortable:hover {
  background: #273549 !important;
}

/* Tfoot / totales */
body.tema-nocturno table tfoot tr td {
  background: #1e293b !important;
  color: #e2e8f0 !important;
}

/* Container de filtro de material (chips) */
body.tema-nocturno #materialFilterContainer {
  background: #1e293b !important;
  border-color: #334155 !important;
  color: #e2e8f0 !important;
}

/* Botón limpiar filtros DDMRP */
body.tema-nocturno #ddmrpLayout .btn-secondary {
  background: #334155 !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

/* Th con colores hardcodeados (exceso, días) */
body.tema-nocturno th[style*="background:#fff1f2"] {
  background: #2d1b1b !important;
  color: #fca5a5 !important;
}

script{display:none!important}
body>script{display:none!important}
.header{background:linear-gradient(135deg,#1e3c72 0%,#2a5298 100%);color:#fff;box-shadow:0 2px 8px rgba(0,0,0,.15);position:fixed;width:100%;top:0;z-index:1000}
.header-top{display:flex;align-items:center;padding:6px 24px;gap:16px}
.header-content{display:flex;align-items:center;padding:6px 24px;gap:16px;flex-wrap:nowrap;overflow:visible}

/* ── Búsqueda Global ── */
#globalSearchWrap{position:relative;flex-shrink:0}
#globalSearchInput{background:rgba(255,255,255,0.15);border:1px solid rgba(255,255,255,0.3);color:#fff;border-radius:20px;padding:5px 10px 5px 28px;font-size:12px;width:160px;outline:none;transition:all 0.25s}
#globalSearchInput::placeholder{color:rgba(255,255,255,0.6)}
#globalSearchInput:focus{background:rgba(255,255,255,0.22);border-color:rgba(255,255,255,0.6);width:220px}
#globalSearchIcon{position:absolute;left:10px;top:50%;transform:translateY(-50%);font-size:14px;pointer-events:none;opacity:0.7}
#globalSearchAtajo{position:absolute;right:10px;top:50%;transform:translateY(-50%);font-size:10px;background:rgba(255,255,255,0.2);border-radius:4px;padding:1px 5px;color:rgba(255,255,255,0.7);pointer-events:none}
#globalSearchResults{position:absolute;top:calc(100% + 6px);left:0;min-width:420px;max-width:520px;background:#fff;border-radius:10px;box-shadow:0 8px 32px rgba(0,0,0,0.2);z-index:2000;display:none;max-height:480px;overflow-y:auto}
.gs-group-title{padding:8px 14px 4px;font-size:10px;font-weight:700;text-transform:uppercase;letter-spacing:0.5px;color:#9ca3af;background:#f9fafb;border-bottom:1px solid #f3f4f6}
.gs-item{display:flex;align-items:center;gap:10px;padding:9px 14px;cursor:pointer;transition:background 0.12s;border-bottom:1px solid #f3f4f6}
.gs-item:last-child{border-bottom:none}
.gs-item:hover{background:#eff6ff}
.gs-item-icon{font-size:16px;flex-shrink:0;width:24px;text-align:center}
.gs-item-main{flex:1;min-width:0}
.gs-item-mat{font-weight:700;font-size:13px;color:#1e3c72}
.gs-item-desc{font-size:11px;color:#6b7280;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.gs-item-badge{font-size:11px;font-weight:700;padding:2px 8px;border-radius:10px;white-space:nowrap;flex-shrink:0}
.gs-empty{padding:24px;text-align:center;color:#9ca3af;font-size:13px}
.gs-kbd{display:inline-block;background:#f3f4f6;border:1px solid #d1d5db;border-radius:4px;padding:0 5px;font-size:10px;color:#6b7280;font-family:monospace}
.logo{font-size:20px;font-weight:700}
.company-name{font-size:14px;opacity:.9;border-left:2px solid rgba(255,255,255,.3);padding-left:20px}
.nav-tabs{display:flex;gap:2px;background:rgba(0,0,0,.15);flex-wrap:nowrap;overflow-x:auto;scrollbar-width:none;width:100%;padding:0 16px}
.nav-tab{padding:10px 14px;background:transparent;border:none;color:rgba(255,255,255,.8);cursor:pointer;font-size:12px;font-weight:500;transition:all .3s;position:relative;white-space:nowrap}
.nav-tab:hover{background:rgba(255,255,255,.15);color:#fff}
.nav-tab.active{background:#fff;color:#1e3c72;font-weight:600}
.nav-tab.active::after{content:'';position:absolute;bottom:0;left:0;right:0;height:3px;background:#1e3c72}
.main-container{margin-top:52px;margin-left:220px;padding:24px;min-height:calc(100vh - 52px);overflow-x:hidden;transition:margin-left 0.3s ease}
body.sidebar-collapsed .main-container{margin-left:0}

/* ===== SIDEBAR ===== */
.sidebar{position:fixed;top:52px;left:0;width:220px;height:calc(100vh - 52px);background:#fff;box-shadow:2px 0 6px rgba(0,0,0,0.09);z-index:998;overflow-y:auto;overflow-x:hidden;transition:width 0.28s ease;scrollbar-width:thin;scrollbar-color:#d1d5db transparent}
.sidebar.collapsed{width:0}
.sidebar-toggle-wrap{display:flex;align-items:center;justify-content:space-between;padding:9px 14px;border-bottom:1px solid #e8eaf0;background:#f8f9fa;white-space:nowrap}
.sidebar-toggle-btn{background:none;border:none;cursor:pointer;font-size:15px;color:#6b7280;padding:2px 6px;border-radius:4px;transition:background 0.15s}
.sidebar-toggle-btn:hover{background:#e8eaf0;color:#1e3c72}
.sidebar-nav{padding:4px 0 20px}
.sidebar-item{display:flex;align-items:center;justify-content:space-between;padding:9px 16px;cursor:pointer;font-size:13px;color:#444;border-left:3px solid transparent;transition:all 0.15s;white-space:nowrap;overflow:hidden;user-select:none}
.sidebar-item:hover{background:#f0f4ff;color:#1e3c72;border-left-color:#a5b4fc}
.sidebar-item.active{background:#e8edf8;color:#1e3c72;font-weight:600;border-left-color:#1e3c72}
.sidebar-item .sidebar-arrow{font-size:9px;color:#9ca3af;transition:transform 0.2s;flex-shrink:0}
.sidebar-item.open .sidebar-arrow{transform:rotate(90deg)}
.sidebar-subitems{overflow:hidden;max-height:0;transition:max-height 0.25s ease}
.sidebar-subitems.open{max-height:300px}
.sidebar-subitem{display:flex;align-items:center;padding:7px 14px 7px 28px;cursor:pointer;font-size:12px;color:#6b7280;border-left:3px solid transparent;transition:all 0.15s;white-space:nowrap}
.sidebar-subitem:hover{background:#f5f7ff;color:#1e3c72;border-left-color:#c7d2fe}
.sidebar-subitem.active{color:#1e3c72;font-weight:600;border-left-color:#1e3c72;background:#eef2ff}
.sidebar-divider{height:1px;background:#e8eaf0;margin:4px 0}

/* Temas: sidebar nocturno */
body.tema-nocturno .sidebar{background:#1e293b;box-shadow:2px 0 6px rgba(0,0,0,0.3)}
body.tema-nocturno .sidebar-toggle-wrap{background:#0f172a;border-bottom-color:#334155}
body.tema-nocturno .sidebar-toggle-btn{color:#94a3b8}
body.tema-nocturno .sidebar-toggle-btn:hover{background:#334155;color:#e2e8f0}
body.tema-nocturno .sidebar-item{color:#cbd5e1}
body.tema-nocturno .sidebar-item:hover{background:#273549;color:#e2e8f0;border-left-color:#475569}
body.tema-nocturno .sidebar-item.active{background:#1e40af22;color:#60a5fa;border-left-color:#3b82f6}
body.tema-nocturno .sidebar-subitem{color:#94a3b8}
body.tema-nocturno .sidebar-subitem:hover{background:#1e293b;color:#e2e8f0;border-left-color:#475569}
body.tema-nocturno .sidebar-subitem.active{color:#60a5fa;border-left-color:#3b82f6;background:#1e3a5f33}
body.tema-nocturno .sidebar-divider{background:#334155}
/* Temas: sidebar intermedio */
body.tema-intermedio .sidebar{background:#f3f4f6}
body.tema-intermedio .sidebar-item:hover{background:#e5e7eb;color:#1f2937}
body.tema-intermedio .sidebar-item.active{background:#dbeafe;color:#1e40af;border-left-color:#1e40af}
/* Header toggle button in header */
#sidebarHeaderBtn{background:none;border:none;cursor:pointer;font-size:16px;color:rgba(255,255,255,0.85);padding:4px 8px;border-radius:4px;margin-right:4px;transition:background 0.15s}
#sidebarHeaderBtn:hover{background:rgba(255,255,255,0.15);color:#fff}
.module-container{display:none;animation:fadeIn .3s}
.module-container.active{display:block}
@keyframes fadeIn{from{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}
.card{background:#fff;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,.08);padding:24px;margin-bottom:24px}
.card-header{font-size:18px;font-weight:600;color:#1e3c72;margin-bottom:20px;padding-bottom:12px;border-bottom:2px solid #e8eaf0;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap}
.form-group{margin-bottom:20px}
.form-label{display:block;font-weight:500;margin-bottom:8px;color:#444;font-size:14px}
.form-input,.form-select{width:100%;padding:10px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:all .2s}
.form-input:focus,.form-select:focus{outline:0;border-color:#2a5298;box-shadow:0 0 0 3px rgba(42,82,152,.1)}
.form-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(250px,1fr));gap:20px}
.btn{padding:10px 20px;border:none;border-radius:6px;font-size:14px;font-weight:500;cursor:pointer;transition:all .2s}
.btn-primary{background:#1e3c72;color:#fff}
.btn-primary:hover{background:#2a5298;transform:translateY(-1px);box-shadow:0 4px 8px rgba(0,0,0,.15)}
.btn-secondary{background:#6b7280;color:#fff}
.btn-success{background:#10b981;color:#fff}
.btn-warning{background:#f59e0b;color:#fff}
.btn-danger{background:#ef4444;color:#fff}
.btn-info{background:#3b82f6;color:#fff}
.button-group{display:flex;gap:12px;margin-top:24px;flex-wrap:wrap}
.monitor-icon-btn{width:34px;height:34px;padding:0;font-size:16px;display:flex;align-items:center;justify-content:center;border-radius:6px;position:relative}
.monitor-icon-btn::after{content:attr(title);position:absolute;bottom:calc(100% + 6px);left:50%;transform:translateX(-50%);background:#1e3c72;color:#fff;font-size:11px;white-space:nowrap;padding:4px 8px;border-radius:4px;pointer-events:none;opacity:0;transition:opacity .15s}
.monitor-icon-btn:hover::after{opacity:1}

/* ===== MONITOR FULLSCREEN ===== */
body.monitor-fullscreen .header,
body.monitor-fullscreen .sidebar,
body.monitor-fullscreen .main-container > *:not(#monitor) {
  display: none !important;
}
body.monitor-fullscreen #monitor {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  z-index: 9000;
  background: #f0f2f5;
  overflow-y: auto;
  padding: 12px 16px;
  display: block !important;
}
body.monitor-fullscreen .alert-info,
body.monitor-fullscreen #contenidoMonitorDetalle > .card:first-child,
body.monitor-fullscreen h2.card-header {
  display: none !important;
}
body.monitor-fullscreen #monitorDataTable {
  max-height: calc(100vh - 80px) !important;
}
body.monitor-fullscreen #btnMonitorFullscreen {
  background: #dc2626 !important;
  border-color: #dc2626 !important;
}
/* tema oscuro en fullscreen */
body.tema-oscuro.monitor-fullscreen #monitor { background: #111827; }
body.tema-intermedio.monitor-fullscreen #monitor { background: #d1d5db; }
.data-table{width:100%;overflow-x:auto;margin-top:16px}
.data-table table{width:100%;min-width:100%;border-collapse:collapse;table-layout:auto}
.data-table th{background:#f8f9fa;padding:8px 6px;text-align:left;font-weight:600;color:#444;border-bottom:2px solid #e8eaf0;font-size:11px;white-space:nowrap;position:relative;resize:horizontal;overflow:auto;min-width:60px}
#ddmrpTable thead th.ddmrp-sortable{cursor:pointer;user-select:none;transition:background 0.15s}
#ddmrpTable thead th.ddmrp-sortable:hover{background:#e8edf5 !important}
#ddmrpTable thead th.ddmrp-sortable.sort-asc::after{content:' ▲';font-size:10px;color:#1e3c72}
#ddmrpTable thead th.ddmrp-sortable.sort-desc::after{content:' ▼';font-size:10px;color:#1e3c72}
#ddmrpTable thead th.ddmrp-sortable:not(.sort-asc):not(.sort-desc)::after{content:' ⇅';font-size:9px;color:#9ca3af}
.data-table th.resizable{position:relative;padding-right:20px}
.data-table th .resizer{position:absolute;right:0;top:0;height:100%;width:5px;cursor:col-resize;background:transparent;user-select:none}
.data-table th .resizer:hover{background:#2a5298}
.data-table th input.filter-input{width:100%;padding:4px;font-size:11px;border:1px solid #d1d5db;border-radius:3px;margin-top:4px}
.data-table td{padding:8px 6px;border-bottom:1px solid #e8eaf0;font-size:12px;white-space:nowrap}
.data-table tr:hover{background:#f8f9fa}
.data-table tr.material-separator{border-top:3px solid #1e3c72}
.data-table th.week-col{background:#dbeafe;color:#1e40af;text-align:center;min-width:70px}
.data-table td.week-col{text-align:center;background:#f8faff}
.badge{display:inline-block;padding:4px 12px;border-radius:12px;font-size:12px;font-weight:500}
.badge-success{background:#d1fae5;color:#065f46}
.badge-warning{background:#fef3c7;color:#92400e}
.badge-info{background:#dbeafe;color:#1e40af}
.badge-danger{background:#fee2e2;color:#991b1b}
.badge-purple{background:#ede9fe;color:#6b21a8}
.welcome-screen{text-align:center;padding:60px 20px}
.welcome-icon{font-size:64px;margin-bottom:24px}
.welcome-title{font-size:32px;font-weight:700;color:#1e3c72;margin-bottom:16px}
.welcome-text{font-size:16px;color:#6b7280;max-width:600px;margin:0 auto;line-height:1.6}
.quick-actions{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:20px;margin-top:40px;max-width:1200px;margin-left:auto;margin-right:auto}
.quick-action-card{background:#fff;padding:24px;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,.08);cursor:pointer;transition:all .3s}
.quick-action-card:hover{transform:translateY(-4px);box-shadow:0 4px 12px rgba(0,0,0,.15)}
.quick-action-icon{font-size:36px;margin-bottom:12px}
.quick-action-title{font-weight:600;color:#1e3c72;margin-bottom:8px;font-size:14px}
.quick-action-desc{font-size:13px;color:#6b7280}
.file-upload-zone{border:2px dashed #d1d5db;border-radius:8px;padding:40px;text-align:center;background:#f9fafb;transition:all .3s;cursor:pointer}
.file-upload-zone:hover{border-color:#2a5298;background:#f0f4ff}
.file-upload-zone.drag-over{border-color:#10b981;background:#ecfdf5}
.file-info{background:#f0f4ff;padding:16px;border-radius:6px;margin-top:16px;display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:12px}
.file-info-text{font-size:14px;color:#1e3c72}
.alert{padding:12px 16px;border-radius:6px;margin-bottom:16px}
.alert-success{background:#d1fae5;color:#065f46;border-left:4px solid #10b981}
.alert-warning{background:#fef3c7;color:#92400e;border-left:4px solid #f59e0b}
.alert-info{background:#dbeafe;color:#1e40af;border-left:4px solid #3b82f6}
.kpi-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:16px;margin-bottom:24px}
.kpi-card{background:linear-gradient(135deg,#667eea 0%,#764ba2 100%);color:#fff;padding:20px;border-radius:8px;box-shadow:0 2px 4px rgba(0,0,0,.1)}
.kpi-card.green{background:linear-gradient(135deg,#10b981 0%,#059669 100%)}
.kpi-card.blue{background:linear-gradient(135deg,#3b82f6 0%,#2563eb 100%)}
.kpi-card.orange{background:linear-gradient(135deg,#f59e0b 0%,#d97706 100%)}
.kpi-card.red{background:linear-gradient(135deg,#ef4444 0%,#dc2626 100%)}
.kpi-label{font-size:13px;opacity:.9;margin-bottom:8px}
.kpi-value{font-size:28px;font-weight:700}
.kpi-change{font-size:12px;opacity:.8;margin-top:4px}
.buffer-zone{padding:16px;border-radius:6px;margin-bottom:12px;border-left:4px solid}
.buffer-zone.green{background:#d1fae5;border-color:#10b981;color:#065f46}
.buffer-zone.yellow{background:#fef3c7;border-color:#f59e0b;color:#92400e}
.buffer-zone.red{background:#fee2e2;border-color:#ef4444;color:#991b1b}
.buffer-label{font-weight:600;margin-bottom:4px}
.buffer-range{font-size:13px}
.modal{display:none;position:fixed;z-index:2000;left:0;top:0;width:100%;height:100%;background:rgba(0,0,0,.5);animation:fadeIn .3s}
.modal.active{display:flex;align-items:center;justify-content:center}
.modal-content{background:#fff;border-radius:8px;padding:32px;max-width:600px;width:90%;max-height:90vh;overflow-y:auto;animation:slideUp .3s}
@keyframes slideUp{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}
.modal-header{font-size:20px;font-weight:700;color:#1e3c72;margin-bottom:24px;padding-bottom:12px;border-bottom:2px solid #e8eaf0}
.modal-close{position:absolute;top:16px;right:16px;background:none;border:none;font-size:24px;cursor:pointer;color:#6b7280}
.action-btn{padding:6px 12px;font-size:12px;margin-right:4px}
.filter-inventario{background:#d1fae5;color:#065f46;font-weight:600}
.filter-necesidad{background:#fef3c7;color:#92400e;font-weight:600}
.filter-disponible{background:#dbeafe;color:#1e40af;font-weight:600}
.filter-oc{background:#ede9fe;color:#6b21a8;font-weight:600}
.filter-simulador{background:#fee2e2;color:#991b1b;font-weight:600}
.ddmrp-logo{width:120px;height:120px;margin:0 auto 20px;display:block;border-radius:20px;box-shadow:0 4px 12px rgba(0,0,0,.2)}
.ddmrp-header{text-align:center;margin-bottom:30px}
/* Tooltip para tránsitos */
.transito-tooltip {
  position: absolute;
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  padding: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
  z-index: 1000;
  min-width: 300px;
  max-width: 400px;
  font-size: 13px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
}

.transito-tooltip.visible {
  opacity: 1;
}

.transito-tooltip-header {
  font-weight: 600;
  color: #1e40af;
  margin-bottom: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.transito-tooltip-orden {
  margin-bottom: 10px;
  padding: 8px;
  background: #f9fafb;
  border-radius: 4px;
}

.transito-tooltip-orden:last-child {
  margin-bottom: 0;
}

.transito-tooltip-row {
  display: flex;
  justify-content: space-between;
  margin: 4px 0;
  font-size: 12px;
}

.transito-tooltip-label {
  color: #6b7280;
  font-weight: 500;
}

.transito-tooltip-value {
  color: #111827;
  font-weight: 600;
  text-align: right;
}


/* Hover effect para celdas de tránsitos */
.week-col[style*="cursor: pointer"]:hover {
  background-color: #dbeafe !important;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

/* Colores condicionales para celdas del monitor */
.cell-disponible-negativo {
  background-color: #fee2e2 !important;
  color: #991b1b !important;
  font-weight: 600;
}

.cell-transito-activo {
  background-color: #e9d5ff !important;
  color: #6b21a8 !important;
  font-weight: 600;
}

.cell-simulador-activo {
  background-color: #dbeafe !important;
  color: #1e40af !important;
  font-weight: 500;
}

.cell-necesidad-alta {
  background-color: #fef3c7 !important;
  color: #92400e !important;
  font-weight: 500;
}


.ddmrp-nav-btn {
  display:flex;align-items:center;gap:10px;width:100%;padding:10px 16px;
  border:none;background:transparent;color:rgba(255,255,255,0.85);
  cursor:pointer;font-size:13px;font-weight:500;text-align:left;
  transition:background 0.2s;border-radius:0;white-space:nowrap;overflow:hidden;
}
.ddmrp-nav-btn:hover { background:rgba(255,255,255,0.12); color:#fff; }
.ddmrp-nav-active { background:rgba(255,255,255,0.18) !important; color:#fff !important; font-weight:700; border-left:3px solid #60a5fa; }
.ddmrp-row-selected { background:#dbeafe !important; outline:2px solid #3b82f6; }

/* Panel colapsado */
#ddmrpNavPanel { transition: width 0.22s cubic-bezier(.4,0,.2,1), min-width 0.22s cubic-bezier(.4,0,.2,1); overflow:hidden; }
#ddmrpNavPanel.collapsed { width:54px !important; min-width:54px !important; }
#ddmrpNavPanel.collapsed .nav-label,
#ddmrpNavPanel.collapsed .nav-section-label,
#ddmrpNavPanel.collapsed .nav-panel-title,
#ddmrpNavPanel.collapsed .nav-panel-footer { display:none !important; }
#ddmrpNavPanel.collapsed .ddmrp-nav-btn { justify-content:center; padding:12px 0; }
#ddmrpNavPanel.collapsed .nav-panel-header { justify-content:center; padding:14px 0; }
#ddmrpNavPanel.collapsed .ddmrp-nav-btn:hover::after {
  content: attr(title);
  position:fixed;
  left:62px;
  background:#1e3c72;
  color:#fff;
  padding:5px 10px;
  border-radius:6px;
  font-size:12px;
  white-space:nowrap;
  z-index:9999;
  box-shadow:0 2px 8px rgba(0,0,0,0.2);
  pointer-events:none;
}

/* Layout sticky */
/* Monitor grupos row */
#monitorTable thead tr.monitor-grupos-row th {
  position: sticky;
  top: 0;
  z-index: 16;
  height: 22px;
  background: #f8f9fa;
  border: none !important;
  padding: 0 !important;
}
body.tema-nocturno #monitorTable thead tr.monitor-grupos-row th {
  background: #1e293b;
}
#monitorTable thead tr.monitor-header-row th {
  top: 22px;
  z-index: 15;
}
/* Monitor table sticky header */
#monitorDataTable {
  position: relative;
}
#monitorTable thead th {
  position: sticky;
  top: 0;
  z-index: 6;
  box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}
#monitorTable thead th[style*="left:0"],
#monitorTable thead th[style*="left: 0"] {
  z-index: 21 !important;
}
#monitorTable thead th[style*="left:120px"],
#monitorTable thead th[style*="left: 120px"] {
  z-index: 21 !important;
}
/* tbody celdas sticky deben ir siempre debajo del thead */
#monitorTable tbody td[style*="position:sticky"] {
  z-index: 2 !important;
}

#ddmrpLayout {
  display:flex;
  gap:0;
  align-items:flex-start;
}
#ddmrpNavPanel {
  position:sticky;
  top:70px;
  height:calc(100vh - 90px);
  display:flex;
  flex-direction:column;
}
#ddmrpMainContent {
  flex:1;
  min-width:0;
  min-height:calc(100vh - 90px);
  overflow-y:auto;
}
/* Botón flotante */
#intelya-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(37,99,235,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2147483647;
  transition: transform 0.2s, box-shadow 0.2s;
}
#intelya-chat-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 22px rgba(37,99,235,0.55);
}
#intelya-chat-btn svg { width: 26px; height: 26px; transition: opacity 0.2s; }

/* Burbuja de notificación */
#intelya-chat-btn .chat-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 14px;
  height: 14px;
  background: #ef4444;
  border-radius: 50%;
  border: 2px solid #fff;
  display: none;
}

/* Panel del chat */
#intelya-chat-panel {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 360px;
  z-index: 2147483646;
  max-height: 520px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  z-index: 9998;
  overflow: hidden;
  transform: scale(0.85) translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.25s cubic-bezier(.4,0,.2,1), opacity 0.25s ease;
  transform-origin: bottom right;
}
#intelya-chat-panel.open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* Header del chat */
#intelya-chat-header {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#intelya-chat-header .chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}
#intelya-chat-header .chat-info { flex: 1; }
#intelya-chat-header .chat-info strong { font-size: 14px; display: block; }
#intelya-chat-header .chat-info span { font-size: 11px; opacity: 0.85; }
#intelya-chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  opacity: 0.8;
  transition: opacity 0.15s;
}
#intelya-chat-close:hover { opacity: 1; }

/* Mensajes */
#intelya-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: #f8faff;
}
#intelya-chat-messages::-webkit-scrollbar { width: 4px; }
#intelya-chat-messages::-webkit-scrollbar-thumb { background: #c7d2fe; border-radius: 4px; }

.chat-msg {
  max-width: 82%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 13.5px;
  line-height: 1.45;
  word-break: break-word;
  animation: msgIn 0.2s ease;
}
@keyframes msgIn { from { opacity:0; transform:translateY(6px); } to { opacity:1; transform:translateY(0); } }

.chat-msg.bot {
  background: #fff;
  color: #1e293b;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  align-self: flex-start;
}
.chat-msg.user {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}
.chat-msg.typing {
  background: #fff;
  color: #94a3b8;
  align-self: flex-start;
  font-style: italic;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots span {
  width: 6px; height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: blink 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%,80%,100%{opacity:0.3} 40%{opacity:1} }

/* Input */
#intelya-chat-footer {
  padding: 12px 12px;
  border-top: 1px solid #e2e8f0;
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  background: #fff;
}
#intelya-chat-input {
  flex: 1;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 9px 14px;
  font-size: 13.5px;
  outline: none;
  resize: none;
  font-family: inherit;
  transition: border-color 0.2s;
  background: #f8faff;
  color: #1e293b;
}
#intelya-chat-input:focus { border-color: #2563eb; }
#intelya-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.15s;
}
#intelya-chat-send:hover { transform: scale(1.08); }
#intelya-chat-send svg { width: 17px; height: 17px; color: #fff; }

/* Modo nocturno */
body.tema-nocturno #intelya-chat-panel { background: #1e293b; box-shadow: 0 8px 32px rgba(0,0,0,0.45); }
body.tema-nocturno #intelya-chat-messages { background: #0f172a; }
body.tema-nocturno .chat-msg.bot { background: #1e293b; color: #e2e8f0; }
body.tema-nocturno .chat-msg.typing { background: #1e293b; }
body.tema-nocturno #intelya-chat-footer { background: #1e293b; border-top-color: #334155; }
body.tema-nocturno #intelya-chat-input { background: #0f172a; color: #e2e8f0; border-color: #334155; }
body.tema-nocturno #intelya-chat-input:focus { border-color: #2563eb; }

/* Filtros por columna en tabla productos */
.prod-col-filter {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 2px 6px;
  font-size: 11px;
  font-weight: 400;
  border: 1px solid #334155;
  border-radius: 4px;
  background: #0f172a;
  color: #cbd5e1;
  outline: none;
  box-sizing: border-box;
}
.prod-col-filter:focus {
  border-color: #6c63ff;
  background: #1e293b;
}
.prod-col-filter::placeholder { color: #475569; }

/* Responsivo */
@media (max-width: 420px) {
  #intelya-chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
  #intelya-chat-btn { right: 16px; bottom: 16px; }
}
