:root {
  --green:        #006B3C;
  --green-dk:     #004D2B;
  --green-lt:     #E8F4EE;
  --green-mid:    #1A8C56;
  --amber:        #B45309;
  --amber-lt:     #FEF3C7;
  --red:          #C0392B;
  --red-lt:       #FDECEA;
  --slate:        #1E293B;
  --slate-mid:    #475569;
  --slate-lt:     #94A3B8;
  --border:       #E2E8F0;
  --bg:           #F8FAFC;
  --white:        #FFFFFF;
  --radius:       10px;
  --radius-sm:    6px;
  --shadow-sm:    0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.04);
  --shadow:       0 4px 12px rgba(0,0,0,0.08);
  --font:         'Inter', -apple-system, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--slate);
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ─── HEADER ─── */
.header {
  background: var(--green);
  color: #fff;
  padding: 14px 20px 12px;
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; gap: 12px;
}
.header-brand { font-size: 18px; font-weight: 700; letter-spacing: -0.3px; color: #FFD700; }
.header-info { flex: 1; }
.header-info h1 { font-size: 14px; font-weight: 600; letter-spacing: -0.1px; }
.header-info p  { font-size: 11px; opacity: 0.7; margin-top: 1px; }
.header-date    { font-size: 11px; opacity: 0.75; text-align: right; line-height: 1.5; }

/* ─── NAV ─── */
.nav {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  display: flex; overflow-x: auto; scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }
.nav-tab {
  flex: 0 0 auto;
  padding: 11px 15px;
  font-size: 12px; font-weight: 500; font-family: var(--font);
  color: var(--slate-mid);
  border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.nav-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }

/* ─── VIEWS ─── */
.view { display: none; padding: 16px; }
.view.active { display: block; }

/* ─── CARD ─── */
.card {
  background: var(--white);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 16px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
}
.card-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.8px;
  text-transform: uppercase; color: var(--slate-lt);
  margin-bottom: 12px;
}

/* ─── BADGES ─── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 8px; border-radius: 20px;
  font-size: 10px; font-weight: 600; letter-spacing: 0.3px;
}
.badge-ok    { background: var(--green-lt);  color: var(--green); }
.badge-warn  { background: var(--amber-lt);  color: var(--amber); }
.badge-err   { background: var(--red-lt);    color: var(--red); }

/* ─── BUTTONS ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 16px; border-radius: var(--radius-sm);
  border: none; font-family: var(--font);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
  width: 100%; margin-bottom: 8px;
}
.btn:active { transform: scale(0.97); filter: brightness(0.93); }
.btn-green  { background: var(--green);  color: #fff; }
.btn-amber  { background: var(--amber);  color: #fff; }
.btn-red    { background: var(--red);    color: #fff; }
.btn-ghost  { background: var(--white);  color: var(--green); border: 1.5px solid var(--green); }
.btn-slate  { background: var(--slate);  color: #fff; }
.btn-sm {
  padding: 7px 12px; font-size: 12px; border-radius: var(--radius-sm);
  border: none; font-family: var(--font); font-weight: 500; cursor: pointer;
  transition: filter 0.15s;
}
.btn-sm:active { filter: brightness(0.9); }

/* ─── FORM FIELDS ─── */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 11px; font-weight: 600; color: var(--slate-mid); margin-bottom: 5px; letter-spacing: 0.2px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 14px; color: var(--slate);
  background: var(--white); outline: none;
  transition: border-color 0.15s;
}
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); }
.field textarea { resize: vertical; min-height: 72px; }

/* ─── IN DEVELOPMENT OVERLAY ─── */
.wip-overlay {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 24px; text-align: center;
}
.wip-badge {
  background: var(--amber-lt); color: var(--amber);
  font-size: 10px; font-weight: 700; letter-spacing: 1px;
  padding: 4px 10px; border-radius: 20px; margin-bottom: 16px;
  text-transform: uppercase;
}
.wip-icon { font-size: 44px; margin-bottom: 12px; opacity: 0.4; }
.wip-overlay h2 { font-size: 17px; font-weight: 600; color: var(--slate); margin-bottom: 6px; }
.wip-overlay p { font-size: 13px; color: var(--slate-lt); line-height: 1.6; }

/* ─── CALENDAR ─── */
.cal-nav {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px;
}
.cal-nav h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.2px; }
.cal-nav-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white);
  font-size: 16px; color: var(--slate-mid);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s;
}
.cal-nav-btn:active { background: var(--green-lt); }

.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px;
  margin-bottom: 12px;
}
.cal-daylabel {
  text-align: center; font-size: 10px; font-weight: 600;
  color: var(--slate-lt); padding: 4px 0; letter-spacing: 0.3px;
}
.cal-cell {
  aspect-ratio: 1; border-radius: var(--radius-sm);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; position: relative; transition: background 0.12s;
  font-size: 12px; font-weight: 500; color: var(--slate);
  border: 1.5px solid transparent;
  gap: 2px;
}
.cal-cell:active { filter: brightness(0.93); }
.cal-cell.empty { cursor: default; pointer-events: none; }
.cal-cell.today { border-color: var(--green); font-weight: 700; color: var(--green); }
.cal-cell.selected { background: var(--green); color: #fff; border-color: var(--green); }
.cal-cell.selected.today { background: var(--green); }
.cal-cell.has-geo  { background: var(--green-lt); }
.cal-cell.has-meth { background: #EFF6FF; }
.cal-cell.has-both { background: linear-gradient(135deg, var(--green-lt) 50%, #EFF6FF 50%); }
.cal-cell.has-inc  { background: var(--red-lt); }
.cal-cell.selected { background: var(--green) !important; color: #fff !important; }

.cal-dots { display: flex; gap: 2px; }
.cal-dot  { width: 4px; height: 4px; border-radius: 50%; }
.cal-dot-geo  { background: var(--green); }
.cal-dot-meth { background: #2563EB; }
.cal-dot-inc  { background: var(--red); }
.cal-cell.selected .cal-dot-geo  { background: rgba(255,255,255,0.8); }
.cal-cell.selected .cal-dot-meth { background: rgba(255,255,255,0.8); }
.cal-cell.selected .cal-dot-inc  { background: rgba(255,255,255,0.8); }

.cal-legend {
  display: flex; flex-wrap: wrap; gap: 12px;
  margin-top: 4px; padding-top: 12px; border-top: 1px solid var(--border);
}
.cal-legend-item {
  display: flex; align-items: center; gap: 5px;
  font-size: 11px; color: var(--slate-mid);
}
.cal-legend-dot { width: 8px; height: 8px; border-radius: 50%; }

/* ─── DAY PANEL ─── */
.day-panel {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border);
  margin-top: 12px; overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.day-panel-header {
  padding: 14px 16px 0;
  display: flex; align-items: center; justify-content: space-between;
}
.day-panel-header h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.2px; }
.day-panel-date { font-size: 11px; color: var(--slate-lt); }

.day-actions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; padding: 12px 16px;
}
.day-act-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 8px; border-radius: var(--radius-sm);
  border: 1.5px solid transparent; font-family: var(--font);
  font-size: 12px; font-weight: 500; cursor: pointer;
  transition: all 0.15s;
}
.day-act-btn:active { transform: scale(0.96); }
.day-act-carga { background: var(--green); color: #fff; }
.day-act-inc   { background: var(--red-lt); color: var(--red); border-color: var(--red-lt); }
.day-act-edit  { background: var(--bg); color: var(--slate-mid); border-color: var(--border); }
.day-act-del   { background: var(--bg); color: var(--slate-lt);  border-color: var(--border); }

/* ─── DAY TABS ─── */
.day-tabs {
  display: flex; border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none; padding: 0 16px;
}
.day-tabs::-webkit-scrollbar { display: none; }
.day-tab {
  flex: 0 0 auto; padding: 10px 14px;
  font-family: var(--font); font-size: 12px; font-weight: 500;
  color: var(--slate-lt); border: none; background: none; cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  white-space: nowrap; transition: color 0.15s, border-color 0.15s;
}
.day-tab.active { color: var(--green); border-bottom-color: var(--green); font-weight: 600; }
.day-tab-inc.active { color: var(--red); border-bottom-color: var(--red); }

.day-tab-content { padding: 16px; min-height: 120px; }
.day-tab-panel { display: none; animation: panelIn 0.15s ease; }
.day-tab-panel.active { display: block; }
@keyframes panelIn { from { opacity:0; transform:translateY(3px); } to { opacity:1; transform:translateY(0); } }

/* ─── PHOTO GRID ─── */
.photo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px;
  margin-top: 10px;
}
.photo-thumb {
  aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; position: relative;
}
.photo-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  transition: transform 0.2s;
}
.photo-thumb:active img { transform: scale(0.97); }

.carga-card {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px;
}
.carga-card:last-child { margin-bottom: 0; }
.carga-card-header {
  display: flex; align-items: flex-start; gap: 8px; margin-bottom: 8px;
}
.carga-card-title { font-size: 13px; font-weight: 600; flex: 1; }
.carga-card-sub   { font-size: 11px; color: var(--slate-lt); margin-top: 1px; }
.carga-card-actions { display: flex; gap: 5px; }

.empty-transport {
  display: flex; flex-direction: column; align-items: center;
  padding: 32px 16px; text-align: center;
}
.empty-transport-icon { font-size: 32px; opacity: 0.25; margin-bottom: 10px; }
.empty-transport h4 { font-size: 14px; font-weight: 500; color: var(--slate-mid); margin-bottom: 6px; }
.empty-transport p  { font-size: 12px; color: var(--slate-lt); margin-bottom: 14px; }

.inc-card {
  border: 1px solid var(--red-lt); border-radius: var(--radius-sm);
  padding: 12px; margin-bottom: 10px; background: #FFFBFB;
}
.inc-card-title { font-size: 13px; font-weight: 600; color: var(--slate); }
.inc-card-transport { font-size: 11px; color: var(--slate-lt); margin-top: 1px; }
.inc-card-desc {
  font-size: 12px; color: var(--slate-mid); line-height: 1.6;
  margin-top: 8px; padding: 8px; background: var(--red-lt);
  border-radius: var(--radius-sm);
}

/* ─── MODAL ─── */
.modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(15,23,42,0.5); z-index: 200;
  align-items: flex-end; justify-content: center;
  backdrop-filter: blur(2px);
}
.modal-overlay.open { display: flex; }
.modal {
  background: var(--white);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px 32px;
  width: 100%; max-height: 88vh; overflow-y: auto;
}
.modal-handle {
  width: 36px; height: 4px; background: var(--border);
  border-radius: 2px; margin: 0 auto 18px;
}
.modal-title { font-size: 16px; font-weight: 600; margin-bottom: 4px; letter-spacing: -0.2px; }
.modal-sub   { font-size: 12px; color: var(--slate-lt); margin-bottom: 18px; }

/* ─── PHOTO DROPZONE ─── */
.dropzone {
  border: 1.5px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer;
  background: var(--bg); transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--green); background: var(--green-lt); }
.dropzone-icon { font-size: 24px; opacity: 0.4; margin-bottom: 6px; }
.dropzone-text { font-size: 12px; color: var(--slate-lt); }

.preview-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px;
}
.preview-item {
  aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; position: relative;
}
.preview-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.preview-remove {
  position: absolute; top: 3px; right: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: rgba(0,0,0,0.65); border: none; color: #fff;
  font-size: 10px; cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* ─── VIEWER ─── */
.viewer-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.95); z-index: 300;
  flex-direction: column; align-items: center; justify-content: center;
}
.viewer-overlay.open { display: flex; }
.viewer-img { max-width: 100%; max-height: 75vh; object-fit: contain; border-radius: 4px; }
.viewer-caption { color: rgba(255,255,255,0.6); font-size: 12px; margin-top: 10px; }
.viewer-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.1); border: none; color: #fff;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.viewer-nav {
  display: flex; gap: 16px; margin-top: 14px;
}
.viewer-nav-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: rgba(255,255,255,0.12); border: none; color: #fff;
  font-size: 20px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}

/* ─── TOAST ─── */
.toast {
  position: fixed; bottom: 28px; left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--slate); color: #fff;
  padding: 10px 18px; border-radius: 24px;
  font-size: 13px; font-weight: 500;
  z-index: 999; transition: transform 0.25s;
  white-space: nowrap; pointer-events: none;
}
.toast.show { transform: translateX(-50%) translateY(0); }
/* ─── HEADER LOGO ─── */
.header-logo {
  height: 32px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════
   SCANNER — Control de Mercancías
   ════════════════════════════════════════════════════ */

.scan-section { display: none; }

/* ─── ENTRADA ─── */
.scan-entrada-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px;
}
.scan-opcion {
  background: var(--white); border: 1.5px solid var(--border);
  border-radius: var(--radius); padding: 20px 10px;
  text-align: center; cursor: pointer; display: block;
  transition: border-color 0.15s, background 0.15s; position: relative;
}
.scan-opcion:active { background: var(--green-lt); border-color: var(--green); }
.scan-opcion-icon  { font-size: 30px; margin-bottom: 8px; }
.scan-opcion-label { font-size: 13px; font-weight: 600; color: var(--slate); }
.scan-opcion-sub   { font-size: 11px; color: var(--slate-lt); margin-top: 3px; }
.scan-opcion input[type=file] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}

/* ─── PROCESANDO ─── */
.scan-proc-wrap {
  display: flex; flex-direction: column; align-items: center;
  padding: 52px 24px; text-align: center;
}
.scan-spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border); border-top-color: var(--green);
  border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── LISTA PEDIDOS ─── */
.scan-pedido-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 10px;
  transition: border-color 0.15s, background 0.15s;
}
.scan-pedido-card:active { background: var(--green-lt); border-color: var(--green); }

/* ─── REVISIÓN ─── */
.scan-back-btn {
  width: 32px; height: 32px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--white);
  font-size: 18px; color: var(--slate-mid); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.scan-progreso-bar {
  background: var(--border); border-radius: 4px;
  height: 5px; margin: 10px 0 4px; overflow: hidden;
}
.scan-progreso-fill {
  background: var(--green); height: 100%; border-radius: 4px; transition: width 0.3s;
}
.scan-ref-row {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px; background: var(--white);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.scan-ref-btns { display: flex; flex-direction: column; gap: 4px; flex-shrink: 0; }
.scan-est-btn {
  padding: 6px 8px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border); background: var(--bg);
  font-family: var(--font); font-size: 11px; font-weight: 500;
  color: var(--slate-mid); cursor: pointer; white-space: nowrap;
  min-width: 66px; text-align: center; transition: all 0.12s;
}
.scan-est-btn.ok   { background: var(--green-lt); border-color: var(--green); color: var(--green); font-weight: 700; }
.scan-est-btn.falta { background: var(--red-lt);  border-color: var(--red);   color: var(--red);   font-weight: 700; }
.scan-est-btn.inc  { background: var(--amber-lt); border-color: var(--amber); color: var(--amber); font-weight: 700; }

/* ─── CONSOLIDACIÓN ─── */
.scan-consol-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 0; border-bottom: 1px solid var(--border);
}
.scan-consol-row:last-child { border-bottom: none; }
.scan-consol-label { font-size: 14px; font-weight: 500; }
.scan-consol-ctrl  { display: flex; align-items: center; gap: 16px; }
.scan-consol-btn {
  width: 36px; height: 36px; border-radius: 50%;
  border: 1.5px solid var(--border); background: var(--bg);
  font-size: 20px; color: var(--slate); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.12s;
}
.scan-consol-btn:active { background: var(--green-lt); border-color: var(--green); color: var(--green); }
.scan-consol-num { font-size: 20px; font-weight: 700; min-width: 22px; text-align: center; }
.scan-consol-resumen {
  background: var(--green-lt); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13px; color: var(--green);
  font-weight: 500; margin: 12px 0; min-height: 40px;
  display: flex; align-items: center; line-height: 1.4;
}

/* ─── COMPLETADOS ─── */
.scan-completado-card {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 8px; box-shadow: var(--shadow-sm);
}

/* ════════════════════════════════════════════════════
   HOJA MAESTRA
   ════════════════════════════════════════════════════ */

/* ─── Cabecera ─── */
.mst-header {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
  margin-bottom: 14px; box-shadow: var(--shadow-sm);
}
.mst-header-top {
  display: flex; align-items: flex-start;
  justify-content: space-between; margin-bottom: 12px;
}
.mst-title    { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.mst-subtitle { font-size: 12px; color: var(--slate-lt); margin-top: 2px; }
.mst-pdf-btn {
  background: var(--green); color: #fff;
  border: none; border-radius: var(--radius-sm);
  padding: 8px 14px; font-size: 12px; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  white-space: nowrap; flex-shrink: 0;
  transition: filter 0.15s;
}
.mst-pdf-btn:active { filter: brightness(0.88); }
.mst-filtro-row {
  display: flex; gap: 10px;
}

/* ─── Bloques ─── */
.mst-bloque-titulo {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--green);
  margin-bottom: 8px;
}
.mst-bloque-num {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--green); color: #fff;
  font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ─── Tabla ─── */
.mst-table-wrap {
  overflow-x: auto; border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
}
.mst-table {
  width: 100%; border-collapse: collapse;
  background: var(--white); min-width: 520px;
}
.mst-table thead th {
  background: var(--green); color: #fff;
  padding: 9px 10px; font-size: 10px; font-weight: 600;
  text-align: left; letter-spacing: 0.4px; white-space: nowrap;
}
.mst-table tbody td {
  padding: 9px 10px; font-size: 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.mst-table tbody tr:last-child td { border-bottom: none; }
.mst-table tbody tr:nth-child(even) td { background: var(--bg); }

.mst-td-pedido { font-weight: 600; white-space: nowrap; }
.mst-td-center { text-align: center; }
.mst-td-obs    { font-size: 11px; color: var(--slate-mid); max-width: 140px; }

/* ─── Check icons ─── */
.mst-check {
  display: inline-flex; align-items: center; justify-content: center;
  width: 22px; height: 22px; border-radius: 50%;
  font-size: 11px; font-weight: 700;
}
.mst-check.ok   { background: var(--green-lt); color: var(--green); }
.mst-check.inc  { background: var(--amber-lt); color: var(--amber); }
.mst-check.pend { background: var(--border);   color: var(--slate-lt); }

/* ─── Print ─── */
@media print {
  .header, .nav, .mst-header, .mst-pdf-btn { display: none !important; }
  .mst-table-wrap { overflow: visible; border: none; box-shadow: none; }
  .mst-table thead th { background: #006B3C !important; -webkit-print-color-adjust: exact; }
}

/* ─── REF / BULTOS sections ─── */
.ref-section { display: block; }

/* ─── TIPO INCIDENCIA BUTTONS ─── */
.inc-tipo-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 3px; padding: 12px 8px;
  border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--bg); cursor: pointer; font-family: var(--font);
  color: var(--slate-mid); transition: all 0.15s;
}
.inc-tipo-btn.active {
  background: var(--red-lt); border-color: var(--red); color: var(--red);
}
.inc-tipo-btn:active { transform: scale(0.96); }

/* ─── CALENDAR LEYENDA POST-CARGA ─── */
.cal-dot-postcarga { background: #7C3AED; }
.cal-cell.has-postcarga { background: #F5F3FF; }

/* ─── LUPA EN FOTOS ─── */
.photo-thumb { position: relative; }
.photo-lupa {
  position: absolute; bottom: 4px; right: 4px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,0.55); color: #fff;
  font-size: 13px; display: flex; align-items: center;
  justify-content: center; cursor: pointer;
  opacity: 0; transition: opacity 0.15s;
  pointer-events: none;
}
.photo-thumb:hover .photo-lupa { opacity: 1; pointer-events: auto; }
/* En móvil siempre visible */
@media (hover: none) { .photo-lupa { opacity: 1; pointer-events: auto; } }

/* ─── TAB BADGES ─── */
.tab-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--red); color: #fff;
  border-radius: 10px; padding: 1px 6px;
  font-size: 10px; font-weight: 700; margin-left: 4px;
}
.tab-badge-purple { background: #7C3AED; }

/* ─── INC TIPO BTN mejorado ─── */
.inc-tipo-btn {
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; padding: 14px 8px;
  border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--bg); cursor: pointer; font-family: var(--font);
  color: var(--slate-mid); transition: all 0.15s;
}
.inc-tipo-btn.active {
  background: var(--red-lt); border-color: var(--red);
  color: var(--red); box-shadow: 0 0 0 3px rgba(192,57,43,0.12);
}
.inc-tipo-btn:active { transform: scale(0.96); }

/* ════════════════════════════════════════════════════
   BUSCADOR DE CALENDARIO
   ════════════════════════════════════════════════════ */

/* ─── Campo de búsqueda ─── */
.cal-search-inner {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.15s, background 0.15s;
}
.cal-search-inner:focus-within {
  border-color: var(--green);
  background: var(--white);
}
.cal-search-icon { font-size: 16px; opacity: 0.45; flex-shrink: 0; }
.cal-search-input {
  flex: 1; border: none; background: none; outline: none;
  font-family: var(--font); font-size: 14px; color: var(--slate);
  min-width: 0;
}
.cal-search-input::placeholder { color: var(--slate-lt); font-size: 13px; }
.cal-search-clear {
  background: none; border: none; color: var(--slate-lt);
  font-size: 18px; cursor: pointer; padding: 0;
  line-height: 1; flex-shrink: 0;
  transition: color 0.15s;
}
.cal-search-clear:hover { color: var(--slate); }

/* ─── Grupo de resultados ─── */
.sr-group { margin-bottom: 4px; }

.sr-group-header {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 0 5px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.7px;
  text-transform: uppercase; color: var(--slate-lt);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
}

/* ─── Tarjeta de resultado ─── */
.sr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--white);
  margin-bottom: 6px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-shadow: var(--shadow-sm);
}
.sr-item:last-child { margin-bottom: 0; }
.sr-item:active { border-color: var(--green); box-shadow: 0 0 0 2px var(--green-lt); }

.sr-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.sr-dot-carga    { background: var(--green); }
.sr-dot-inc      { background: var(--red); }
.sr-dot-postcarga{ background: #7C3AED; }
.sr-dot-pedido   { background: var(--amber); }

.sr-body { flex: 1; min-width: 0; }
.sr-title {
  font-size: 13px; font-weight: 600; color: var(--slate);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-title mark {
  background: #FEF08A; color: var(--slate);
  border-radius: 2px; padding: 0 2px;
}
.sr-sub {
  font-size: 11px; color: var(--slate-lt); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sr-sub mark { background: #FEF08A; color: var(--slate); border-radius: 2px; padding: 0 2px; }

.sr-right { text-align: right; flex-shrink: 0; }
.sr-fecha { font-size: 12px; font-weight: 600; color: var(--green); }
.sr-tipo  { font-size: 10px; color: var(--slate-lt); margin-top: 2px; }

/* ─── Sin resultados ─── */
.sr-empty {
  text-align: center; padding: 20px;
  font-size: 13px; color: var(--slate-lt);
}

/* ════════════════════════════════════════════════════
   SWIPE TO REMOVE — zona Escanear
   ════════════════════════════════════════════════════ */
.sc-swipe-wrap {
  position: relative; overflow: hidden;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}
.sc-swipe-content {
  transition: transform 0.25s ease;
  position: relative; z-index: 1;
}
.sc-swipe-action {
  position: absolute; right: 0; top: 0; bottom: 0;
  display: flex; align-items: stretch;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
  z-index: 0;
}


/* ═══════════════════════════════════════════════════
   CARPETAS — Completados y Anterior
   ═══════════════════════════════════════════════════ */
.carpeta-btn {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  padding: 13px 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 13px; font-weight: 500;
  color: var(--slate);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: left;
  box-shadow: var(--shadow-sm);
}
.carpeta-btn:active   { background: var(--green-lt); border-color: var(--green); }
.carpeta-btn-icon     { font-size: 16px; flex-shrink: 0; }
.carpeta-btn-label    { flex: 1; }
.carpeta-btn-count    { font-size: 11px; color: var(--slate-lt); font-weight: 400; }
.carpeta-btn-chevron  {
  color: var(--slate-lt); font-size: 16px;
  transition: transform 0.2s; flex-shrink: 0;
}

.carpeta-panel {
  display: none;
  background: var(--white);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  padding: 0 14px 4px;
  box-shadow: var(--shadow-sm);
}

.carpeta-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.carpeta-row:last-child { border-bottom: none; }
.carpeta-row-info  { flex: 1; min-width: 0; }
.carpeta-row-title { font-size: 13px; font-weight: 600; }
.carpeta-row-meta  { font-size: 11px; color: var(--slate-lt); margin-top: 2px; }
.carpeta-row-actions { display: flex; gap: 6px; flex-shrink: 0; }

.carpeta-empty {
  padding: 16px;
  text-align: center;
  font-size: 13px;
  color: var(--slate-lt);
}

/* ════════════════════════════════════════════════════
   VIEWER TOOLBAR
   ════════════════════════════════════════════════════ */
.viewer-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.92);
  z-index: 200;
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 16px 12px 12px;
}
.viewer-overlay.open { display: flex; }

.viewer-toolbar {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px;
  background: #1a1a1a;
  border-radius: 12px;
  padding: 8px 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.7);
  cursor: default;
  user-select: none;
  z-index: 210;
  touch-action: none;
  max-width: calc(100vw - 16px);
  flex-wrap: wrap;
  justify-content: center;
}
.vtb-handle {
  color: #555; font-size: 18px; cursor: grab;
  padding: 2px 6px; line-height: 1;
}
.vtb-handle:active { cursor: grabbing; }
.vtb-btn {
  border: none; border-radius: 7px;
  padding: 8px 13px;
  font-family: var(--font); font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: filter 0.12s, transform 0.1s;
  display: flex; align-items: center; gap: 4px;
}
.vtb-btn:active { transform: scale(0.93); filter: brightness(0.82); }
.vtb-dark  { background: #2d2d2d; color: #fff; font-size: 20px; font-weight: 700; padding: 5px 13px; }
.vtb-mid   { background: #3a3a3a; color: #ccc; }
.vtb-nav   { background: #2d2d2d; color: #fff; font-size: 22px; padding: 4px 11px; }
.vtb-green { background: #16a34a; color: #fff; }
.vtb-blue  { background: #2563EB; color: #fff; }
.vtb-red   { background: #DC2626; color: #fff; }

/* ─── Barra compacta en móvil ─── */
@media (max-width: 640px) {
  .viewer-toolbar {
    bottom: 12px;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 10px;
  }
  .vtb-btn {
    padding: 7px 9px;
    font-size: 11px;
    border-radius: 6px;
    gap: 2px;
  }
  .vtb-dark { font-size: 17px; padding: 4px 10px; }
  .vtb-nav  { font-size: 18px; padding: 3px 9px; }
  .vtb-handle { font-size: 15px; padding: 2px 3px; }
  /* Ocultar el texto de los botones largos, dejar solo icono */
  .vtb-green .vtb-txt,
  .vtb-blue  .vtb-txt,
  .vtb-mid   .vtb-txt { display: none; }
  .vtb-green, .vtb-blue { padding: 7px 11px; font-size: 14px; }
  .vtb-mid { padding: 7px 10px; font-size: 14px; }
}

@media (max-width: 400px) {
  .viewer-toolbar { gap: 3px; padding: 5px 6px; }
  .vtb-btn  { padding: 6px 7px; }
  .vtb-dark { font-size: 16px; padding: 3px 8px; }
  .vtb-nav  { font-size: 16px; padding: 3px 7px; }
}

/* ════════════════════════════════════════════════════
   ESCÁNER EAN EN REFERENCIAS
   ════════════════════════════════════════════════════ */
.ean-scanner-wrap {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}

/* ─── Video del escáner ocupa todo el contenedor ─── */
#ref-scanner-reader video,
#ref-scanner-reader canvas {
  position: absolute !important;
  top: 0; left: 0;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
}
#ref-scanner-reader canvas.drawingBuffer { z-index: 5; }

/* ─── Filtro de imagen del escáner ─── */
#ref-scanner-reader video {
  transition: filter 0.2s ease;
}

/* ─── Anillo de enfoque tap-to-focus ─── */
#ref-focus-ring {
  transition: transform 0.18s ease, opacity 0.35s ease;
}


/* ════════════════════════════════════════════════════
   OPERARIO EN CABECERA
   ════════════════════════════════════════════════════ */
.header-user {
  background: rgba(255,255,255,0.14); color: #fff;
  border: 1px solid rgba(255,255,255,0.25); border-radius: 20px;
  padding: 5px 11px; font-family: var(--font); font-size: 11px; font-weight: 600;
  cursor: pointer; white-space: nowrap; max-width: 130px;
  overflow: hidden; text-overflow: ellipsis; margin-right: 8px;
}
.header-user:active { background: rgba(255,255,255,0.25); }

/* ════════════════════════════════════════════════════
   ANÁLISIS (analytics.js)
   ════════════════════════════════════════════════════ */
.ax-head {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-sm);
}
.ax-head-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.ax-title { font-size: 19px; font-weight: 800; letter-spacing: -0.3px; }
.ax-sub   { font-size: 12px; color: var(--slate-lt); margin-top: 3px; }
.ax-icon-btn {
  width: 36px; height: 36px; flex-shrink: 0;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 16px; color: var(--slate-mid); cursor: pointer;
}
.ax-icon-btn:active { background: var(--green-lt); color: var(--green); }

.ax-periodos { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 12px; scrollbar-width: none; }
.ax-periodos::-webkit-scrollbar { display: none; }
.ax-periodos button {
  flex-shrink: 0; padding: 7px 13px; border-radius: 20px;
  background: var(--bg); border: 1px solid var(--border);
  font-family: var(--font); font-size: 12px; font-weight: 600; color: var(--slate-mid); cursor: pointer;
}
.ax-periodos button.on { background: var(--green); border-color: var(--green); color: #fff; }

.ax-filtros, .ax-m-filtros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ax-filtros label, .ax-m-filtros label {
  display: flex; flex-direction: column; gap: 4px;
  font-size: 10px; font-weight: 700; color: var(--slate-lt);
  text-transform: uppercase; letter-spacing: 0.4px; min-width: 0;
}
.ax-filtros input, .ax-filtros select, .ax-m-filtros input, .ax-m-filtros select {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  background: var(--white); font-family: var(--font); font-size: 13px; color: var(--slate);
  text-transform: none; letter-spacing: 0; font-weight: 500; outline: none; min-width: 0;
}
.ax-filtros input:focus, .ax-filtros select:focus,
.ax-m-filtros input:focus, .ax-m-filtros select:focus { border-color: var(--green); }

/* ── KPIs globales ── */
.ax-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 18px; }
.ax-kpi {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 16px 14px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.ax-kpi::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--kc); }
.ax-kpi-v { font-size: 28px; font-weight: 800; color: var(--kc); line-height: 1.05; letter-spacing: -0.8px; }
.ax-kpi-l { font-size: 12px; font-weight: 600; color: var(--slate); margin-top: 6px; }
.ax-kpi-s { font-size: 11px; color: var(--slate-lt); margin-top: 2px; }

/* ── Grupos y tarjetas ── */
.ax-grupo-h { display: flex; align-items: baseline; gap: 10px; margin: 6px 2px 10px; flex-wrap: wrap; }
.ax-grupo-h span  { font-size: 14px; font-weight: 800; color: var(--slate); }
.ax-grupo-h small { font-size: 11px; color: var(--slate-lt); }

.ax-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; margin-bottom: 20px; }
.ax-card {
  text-align: left; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 15px; cursor: pointer; font-family: var(--font);
  box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 5px;
  transition: border-color .15s, box-shadow .15s, transform .12s;
}
.ax-card:hover  { border-color: var(--green); box-shadow: 0 4px 14px rgba(0,107,60,0.10); }
.ax-card:active { transform: scale(0.985); }
.ax-card-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ax-card-ico {
  width: 36px; height: 36px; border-radius: 10px; background: var(--green-lt);
  display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0;
}
.ax-card-val {
  font-size: 12px; font-weight: 800; color: var(--green); background: var(--green-lt);
  padding: 4px 9px; border-radius: 20px; white-space: nowrap; max-width: 60%;
  overflow: hidden; text-overflow: ellipsis;
}
.ax-card-t { font-size: 14px; font-weight: 700; color: var(--slate); margin-top: 4px; }
.ax-card-s { font-size: 12px; color: var(--slate-mid); line-height: 1.4; }
.ax-card-f {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 10.5px; color: var(--slate-mid); background: var(--bg);
  border: 1px dashed var(--border); border-radius: 6px; padding: 6px 8px;
  margin-top: 4px; line-height: 1.45;
}

.ax-cargando, .ax-error {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 16px; font-size: 13px; color: var(--slate-lt); text-align: center;
}
.ax-error { color: var(--red); }

/* ── Modal ── */
.ax-modal-ov {
  position: fixed; inset: 0; background: rgba(15,23,42,0.55); z-index: 250;
  display: none; align-items: center; justify-content: center; padding: 20px;
}
.ax-modal-ov.open { display: flex; }
.ax-modal {
  background: var(--white); width: 100%; max-width: 1100px; max-height: 94vh;
  overflow-y: auto; border-radius: 16px; padding: 20px 22px 24px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.ax-m-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.ax-m-ico {
  width: 44px; height: 44px; border-radius: 12px; background: var(--green-lt);
  display: flex; align-items: center; justify-content: center; font-size: 22px; flex-shrink: 0;
}
.ax-m-title { font-size: 18px; font-weight: 800; }
.ax-m-sub   { font-size: 12px; color: var(--slate-mid); margin-top: 2px; line-height: 1.4; }
.ax-formula {
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: 12px; color: var(--slate-mid); background: var(--bg);
  border-left: 3px solid var(--green); border-radius: 6px; padding: 9px 12px; margin-bottom: 14px; line-height: 1.5;
}
.ax-formula b { font-family: var(--font); color: var(--green); margin-right: 6px; }
.ax-m-filtros { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 14px; }

.ax-m-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 14px; }
.ax-mk {
  background: var(--bg); border-radius: var(--radius-sm); padding: 11px 12px;
  border-top: 3px solid var(--kc); min-width: 0;
}
.ax-mk-v { font-size: 18px; font-weight: 800; color: var(--kc); line-height: 1.15; word-break: break-word; }
.ax-mk-l { font-size: 11px; color: var(--slate-mid); margin-top: 3px; }

.ax-m-chart { position: relative; height: 52vh; min-height: 280px; margin-bottom: 12px; }

.ax-nota {
  font-size: 12px; color: var(--slate-mid); background: var(--amber-lt);
  border-radius: var(--radius-sm); padding: 9px 12px; margin-bottom: 10px; line-height: 1.45;
}
.ax-nota-err { background: var(--red-lt); color: var(--red); }

.ax-tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.ax-tabla { width: 100%; border-collapse: collapse; font-size: 12px; min-width: 420px; }
.ax-tabla th {
  background: var(--bg); text-align: left; padding: 8px 10px; font-size: 10px;
  font-weight: 700; color: var(--slate-mid); text-transform: uppercase; letter-spacing: 0.4px;
}
.ax-tabla td { padding: 8px 10px; border-top: 1px solid var(--border); color: var(--slate); }

/* ── Responsive ── */
@media (max-width: 760px) {
  .ax-kpis    { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .ax-kpi     { padding: 13px 13px 12px; }
  .ax-kpi-v   { font-size: 23px; }
  .ax-filtros { grid-template-columns: repeat(2, 1fr); }
  .ax-grid    { grid-template-columns: 1fr; }
  .ax-m-kpis  { grid-template-columns: repeat(2, 1fr); }
  .ax-modal-ov { padding: 0; align-items: flex-end; }
  .ax-modal   { max-height: 96vh; border-radius: 16px 16px 0 0; padding: 16px 14px 22px; }
  .ax-m-chart { height: 46vh; min-height: 240px; }
  .ax-m-filtros { grid-template-columns: repeat(2, 1fr); }
  .header-user { max-width: 90px; padding: 4px 8px; margin-right: 6px; }
}

/* ════════════════════════════════════════════════════
   MUELLE · importación de Excel externo
   ════════════════════════════════════════════════════ */
.mu-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 10px;
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 15px 16px; margin-bottom: 12px; box-shadow: var(--shadow-sm);
}
.mu-title { font-size: 18px; font-weight: 800; letter-spacing: -0.3px; }
.mu-sub   { font-size: 12px; color: var(--slate-lt); margin-top: 3px; line-height: 1.4; }

.mu-drop {
  display: block; text-align: center; cursor: pointer; position: relative;
  background: var(--white); border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 30px 18px; margin-bottom: 12px; transition: border-color .15s, background .15s;
}
.mu-drop:active { border-color: var(--green); background: var(--green-lt); }
.mu-drop-ico { font-size: 34px; margin-bottom: 8px; }
.mu-drop-t   { font-size: 15px; font-weight: 700; color: var(--slate); }
.mu-drop-s   { font-size: 12px; color: var(--slate-lt); margin-top: 4px; line-height: 1.45; }
.mu-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

.mu-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.mu-kpi {
  background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px; border-left: 3px solid var(--kc); min-width: 0;
}
.mu-kpi-v { font-size: 19px; font-weight: 800; color: var(--kc); line-height: 1.15; word-break: break-word; }
.mu-kpi-l { font-size: 11px; color: var(--slate-lt); margin-top: 3px; }

.mu-rango { font-size: 12px; color: var(--slate-mid); text-align: center; margin-top: 10px; }
.mu-info  { font-size: 13px; color: var(--slate-mid); line-height: 1.5; }
.mu-vacio { font-size: 13px; color: var(--slate-lt); text-align: center; padding: 20px; }
.mu-cargando {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 40px 16px; font-size: 13px; color: var(--slate-lt);
}
.mu-pasos { font-size: 12px; color: var(--slate-mid); line-height: 1.95; }

.mu-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mu-chip {
  font-size: 11px; color: var(--slate-mid); background: var(--bg);
  border: 1px solid var(--border); border-radius: 20px; padding: 4px 11px;
}

.mu-nota {
  font-size: 12px; color: var(--slate-mid); background: var(--bg);
  border-radius: var(--radius-sm); padding: 9px 12px; margin-top: 10px; line-height: 1.5;
}
.mu-nota-ok   { background: var(--green-lt); color: var(--green); }
.mu-nota-warn { background: var(--amber-lt); color: var(--amber); }

.mu-map-row {
  display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px;
  align-items: center; padding: 8px 0; border-bottom: 1px solid var(--border);
}
.mu-map-row:last-child { border-bottom: none; }
.mu-map-lbl { font-size: 13px; font-weight: 600; color: var(--slate); }
.mu-map-row select {
  width: 100%; padding: 8px 10px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--white);
  font-family: var(--font); font-size: 13px; color: var(--slate); outline: none; min-width: 0;
}
.mu-map-row select:focus { border-color: var(--green); }

.mu-tabla-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.mu-tabla { width: 100%; border-collapse: collapse; font-size: 11px; }
.mu-tabla th {
  background: var(--bg); text-align: left; padding: 7px 9px; white-space: nowrap;
  font-size: 10px; font-weight: 700; color: var(--slate-mid);
  text-transform: uppercase; letter-spacing: .3px;
}
.mu-tabla td { padding: 7px 9px; border-top: 1px solid var(--border); color: var(--slate); white-space: nowrap; }

.mu-lote {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.mu-lote:last-child { border-bottom: none; }
.mu-lote-info { flex: 1; min-width: 0; }
.mu-lote-arch { font-size: 13px; font-weight: 600; color: var(--slate);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mu-lote-meta { font-size: 11px; color: var(--slate-lt); margin-top: 2px; }
.mu-lote-ant  { font-size: 10px; color: var(--slate-lt); flex-shrink: 0; }
.mu-del {
  background: var(--red-lt); color: var(--red); border: none; border-radius: var(--radius-sm);
  padding: 6px 11px; font-family: var(--font); font-size: 12px; font-weight: 600;
  cursor: pointer; flex-shrink: 0;
}

@media (max-width: 640px) {
  .mu-kpis { grid-template-columns: repeat(2, 1fr); }
  .mu-map-row { grid-template-columns: 1fr; gap: 5px; align-items: stretch; }
}

/* ════════════════════════════════════════════════════
   SELECTOR DE TRANSPORTISTA (bultos)
   ════════════════════════════════════════════════════ */
.ag-ov {
  position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 300;
  display: flex; align-items: flex-end; justify-content: center;
}
.ag-panel {
  background: #fff; border-radius: 16px 16px 0 0; padding: 20px 20px 32px;
  width: 100%; max-width: 480px; max-height: 92vh; overflow-y: auto;
}
.ag-handle { width: 36px; height: 4px; background: var(--border); border-radius: 2px; margin: 0 auto 16px; }
.ag-tit { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.ag-sub { font-size: 12px; color: var(--slate-lt); margin-bottom: 16px; }

.ag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.ag-btn {
  padding: 15px 6px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--bg); font-family: var(--font); font-size: 13px; font-weight: 700;
  color: var(--slate-mid); cursor: pointer; transition: all .15s;
}
.ag-btn.on { background: var(--green-lt); border-color: var(--green); color: var(--green); }
.ag-btn:active { transform: scale(.96); }
.ag-otro { border-style: dashed; }

.ag-otro-wrap { display: none; margin-bottom: 12px; }
.ag-lbl { display: block; font-size: 11px; font-weight: 700; color: var(--slate-mid); margin-bottom: 5px; }
.ag-input {
  width: 100%; padding: 12px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 15px;
  font-weight: 700; letter-spacing: .5px; color: var(--slate);
  text-transform: uppercase; outline: none;
}
.ag-input:focus { border-color: var(--green); }
.ag-prev { font-size: 11px; color: var(--slate-lt); margin-top: 6px; }
.ag-prev b { color: var(--green); letter-spacing: .4px; }

.ag-recientes { margin-top: 10px; }
.ag-rec-t { font-size: 10px; font-weight: 700; color: var(--slate-lt);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 6px; }
.ag-rec {
  display: inline-block; margin: 0 5px 5px 0; padding: 6px 11px; border-radius: 16px;
  background: var(--bg); border: 1px solid var(--border);
  font-family: var(--font); font-size: 12px; font-weight: 600;
  color: var(--slate-mid); cursor: pointer;
}
.ag-rec:active { background: var(--green-lt); border-color: var(--green); color: var(--green); }

.ag-ok {
  width: 100%; padding: 13px; background: var(--green); color: #fff; border: none;
  border-radius: var(--radius-sm); font-family: var(--font); font-size: 14px;
  font-weight: 700; cursor: pointer; margin-bottom: 8px; opacity: .45;
}
.ag-ok:not(:disabled) { opacity: 1; }
.ag-cancel {
  width: 100%; padding: 11px; background: none; color: var(--slate-mid);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--font); font-size: 13px; cursor: pointer;
}

/* ════════════════════════════════════════════════════
   MODO SUPERVISOR
   ════════════════════════════════════════════════════ */

/* ── Bloque de acceso + búsqueda en Referencias y Bultos ── */
.sup-bloque {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 12px;
}
.sup-btn-abrir {
  flex: 0 0 auto;
  background: var(--bg);
  color: var(--slate-mid);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
}
.sup-btn-abrir:active { transform: scale(.97); }
.sup-btn-abrir.on {
  background: var(--green-lt);
  color: var(--green);
  border-color: var(--green-mid);
}
.sup-busca { flex: 1; min-width: 0; }
/* Los resultados ocupan todo el ancho del bloque, no solo el del buscador */
.sup-res {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  z-index: 60;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: 340px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.sup-res-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background .12s;
}
.sup-res-item:last-child { border-bottom: none; }
.sup-res-item:active { background: var(--bg); }
.sup-res-body { flex: 1; min-width: 0; }
.sup-res-tit {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.sup-res-meta {
  font-size: 11px;
  color: var(--slate-lt);
  margin-top: 3px;
  line-height: 1.45;
}
.sup-res-est {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
}
.sup-res-est.e-ok   { background: var(--green-lt); color: var(--green); }
.sup-res-est.e-mid  { background: #DBEAFE;        color: #1D4ED8; }
.sup-res-est.e-pend { background: var(--amber-lt); color: var(--amber); }
.sup-res-est.e-post { background: var(--red-lt);   color: var(--red); }
.sup-res-ed {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
}
.sup-sin {
  padding: 14px 12px;
  font-size: 12px;
  color: var(--slate-lt);
  text-align: center;
}
.sup-badge {
  display: none;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 800;
  background: var(--green-lt);
  color: var(--green);
  padding: 3px 7px;
  border-radius: 5px;
}

/* ── Overlay (login y editor) ── */
.sup-ov {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 9000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: supFade .18s ease;
}
@keyframes supFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes supUp   { from { transform: translateY(26px); } to { transform: translateY(0); } }

/* ── Panel de login ── */
.sup-panel {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  border-radius: 18px 18px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  animation: supUp .22s cubic-bezier(.2,.8,.3,1);
  box-shadow: 0 -8px 30px rgba(0,0,0,.18);
}
.sup-handle {
  width: 42px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 16px;
}
.sup-tit {
  font-size: 17px;
  font-weight: 800;
  color: var(--slate);
}
.sup-sub {
  font-size: 12px;
  color: var(--slate-lt);
  margin: 3px 0 18px;
}
.sup-lbl {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-mid);
  margin-bottom: 5px;
}
.sup-in {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 13px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  color: var(--slate);
  background: var(--white);
  outline: none;
  transition: border-color .15s;
}
.sup-in:focus { border-color: var(--green-mid); }
.sup-in-sm { padding: 7px 10px; font-size: 12px; }
.sup-ta { min-height: 62px; resize: vertical; line-height: 1.5; }
.sup-pass-wrap { position: relative; }
.sup-pass-wrap .sup-in { padding-right: 46px; }
.sup-ver {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 17px;
  padding: 5px 7px;
  cursor: pointer;
  line-height: 1;
}
.sup-reglas {
  font-size: 10.5px;
  color: var(--slate-lt);
  margin-top: 7px;
}
.sup-err {
  display: none;
  background: var(--red-lt);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  margin-top: 12px;
}
.sup-ok, .sup-cancel {
  width: 100%;
  padding: 13px;
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  margin-top: 14px;
}
.sup-ok     { background: var(--green); color: #fff; }
.sup-ok:active { background: var(--green-dk); }
.sup-cancel { background: var(--bg); color: var(--slate-mid); margin-top: 8px; }

/* ── Editor de pedido ── */
.sup-ov-edit { align-items: stretch; }
.sup-edit {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  background: var(--bg);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 14px calc(28px + env(safe-area-inset-bottom));
  animation: supUp .2s cubic-bezier(.2,.8,.3,1);
}
.sup-edit-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.sup-edit-tit { font-size: 16px; font-weight: 800; color: var(--slate); }
.sup-edit-sub { font-size: 11.5px; color: var(--slate-lt); margin-top: 2px; }
.sup-aviso {
  background: var(--amber-lt);
  color: var(--amber);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 11.5px;
  font-weight: 600;
  margin-bottom: 12px;
}
.sup-nota {
  font-size: 10.5px;
  color: var(--slate-lt);
  margin-top: 8px;
  line-height: 1.5;
}
.sup-posdata {
  background: var(--red-lt);
  color: var(--red);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
  margin-top: 8px;
}

/* Estado del control */
.sup-estados { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sup-est {
  padding: 10px 4px;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-mid);
  cursor: pointer;
  transition: all .15s;
}
.sup-est.on { background: var(--green); color: #fff; border-color: var(--green); }

/* Transportista */
.sup-ag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.sup-ag {
  padding: 10px 4px;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-mid);
  cursor: pointer;
  transition: all .15s;
}
.sup-ag.on { background: var(--green); color: #fff; border-color: var(--green); }
.sup-ag-otro.on { background: var(--slate-mid); border-color: var(--slate-mid); }
.sup-ag-actual { font-size: 11px; color: var(--slate-lt); margin-top: 7px; }

/* Referencias */
.sup-refs { display: flex; flex-direction: column; gap: 8px; }
.sup-ref {
  border: 1px solid var(--border);
  border-left: 3px solid var(--slate-lt);
  border-radius: var(--radius-sm);
  padding: 9px 11px;
  background: var(--white);
}
.sup-ref.ok         { border-left-color: var(--green); }
.sup-ref.falta      { border-left-color: var(--red); }
.sup-ref.incidencia { border-left-color: var(--amber); }
.sup-ref.excluida   { opacity: .55; border-left-color: var(--slate-lt); }
.sup-ref-cab { display: flex; align-items: center; gap: 8px; }
.sup-ref-id {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sup-ref-est {
  flex: 0 0 auto;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--slate-lt);
}
.sup-ref-est.est-ok         { background: var(--green-lt); color: var(--green); }
.sup-ref-est.est-falta      { background: var(--red-lt);   color: var(--red); }
.sup-ref-est.est-incidencia { background: var(--amber-lt); color: var(--amber); }
.sup-ref-desig {
  font-size: 11px;
  color: var(--slate-mid);
  margin: 4px 0 7px;
  line-height: 1.4;
}
.sup-ref-fila { display: flex; align-items: center; gap: 7px; }
.sup-ref-fila label {
  flex: 0 0 auto;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--slate-mid);
}
.sup-ref-fila .sup-in-sm { flex: 1; min-width: 0; }
.sup-ref-qty {
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 700;
  color: var(--slate-mid);
  font-variant-numeric: tabular-nums;
}
.sup-ref-btns { display: flex; gap: 5px; margin-top: 8px; }
.sup-rb {
  flex: 1;
  padding: 7px 2px;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-mid);
  cursor: pointer;
  transition: all .13s;
}
.sup-rb.on { background: var(--green); color: #fff; border-color: var(--green); }
.sup-rb-exc { flex: 1.7; font-size: 10.5px; }
.sup-rb-exc.on { background: var(--slate-mid); border-color: var(--slate-mid); }

/* Lista de cambios pendientes */
.sup-cambios { margin-top: 10px; }
.sup-cambios-t {
  font-size: 10.5px;
  font-weight: 800;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 6px;
}
.sup-cambio {
  background: var(--green-lt);
  border-radius: 5px;
  padding: 6px 9px;
  font-size: 11px;
  color: var(--slate-mid);
  line-height: 1.5;
  margin-bottom: 4px;
}
.sup-cambio b { color: var(--slate); }

/* ── Filtro por día en "Otros días" (Bultos) ── */
.bul-dias {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 4px 0 10px;
  scrollbar-width: none;
}
.bul-dias::-webkit-scrollbar { display: none; }
.bul-dia-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 11px;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: 20px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--slate-mid);
  cursor: pointer;
  white-space: nowrap;
  transition: all .14s;
}
.bul-dia-chip.on {
  background: var(--amber);
  border-color: var(--amber);
  color: #fff;
}
.bul-dia-n {
  font-size: 10px;
  font-weight: 800;
  background: var(--bg);
  color: var(--slate-mid);
  border-radius: 9px;
  padding: 1px 6px;
  font-variant-numeric: tabular-nums;
}
.bul-dia-chip.on .bul-dia-n { background: rgba(255,255,255,.26); color: #fff; }
.bul-dia-todos { border-style: dashed; }
.bul-post-badge {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .3px;
  background: var(--red-lt);
  color: var(--red);
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

@media (min-width: 560px) {
  .sup-ov { align-items: center; }
  .sup-panel { border-radius: 18px; padding-bottom: 22px; }
  .sup-ov-edit { align-items: stretch; }
  .sup-edit { max-height: 100vh; }
}

/* ── Fila de pedido en "Otros días" (Bultos) ── */
.bul-otro-row {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-bottom: 8px;
}
.bul-otro-tit {
  font-size: 13px;
  font-weight: 700;
  color: var(--slate);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
.bul-otro-meta {
  font-size: 11px;
  color: var(--slate-lt);
  line-height: 1.5;
  margin-top: 3px;
}
.bul-otro-acc { display: flex; gap: 6px; margin-top: 9px; }
.bul-otro-btn {
  flex: 1;
  padding: 7px 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--slate-mid);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.bul-otro-btn:active { transform: scale(.98); }
.bul-otro-btn.forzar {
  background: var(--amber-lt);
  color: var(--amber);
  border-color: var(--amber-lt);
}

/* ── El Muelle · aviso de módulo en desarrollo ── */
.mu-wip-tag {
  display: inline-block;
  vertical-align: middle;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .4px;
  text-transform: uppercase;
  background: var(--amber-lt);
  color: var(--amber);
  border: 1px solid var(--amber);
  padding: 2px 7px;
  border-radius: 20px;
  margin-left: 7px;
}
.mu-wip {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  background: repeating-linear-gradient(
    45deg, var(--amber-lt), var(--amber-lt) 11px,
    #FDE9B0 11px, #FDE9B0 22px);
  border: 1.5px solid var(--amber);
  border-radius: var(--radius);
  padding: 13px 15px;
  margin-bottom: 14px;
}
.mu-wip-ico { font-size: 24px; line-height: 1; flex: 0 0 auto; }
.mu-wip-t {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--amber);
  margin-bottom: 3px;
}
.mu-wip-s {
  font-size: 11.5px;
  color: #7C4A08;
  line-height: 1.55;
}

/* ── El Muelle · falta la tabla en la base de datos ── */
.mu-falta {
  background: var(--white);
  border: 1.5px dashed var(--amber);
  border-radius: var(--radius);
  padding: 16px 15px;
  text-align: center;
}
.mu-falta-t {
  font-size: 14px;
  font-weight: 800;
  color: var(--amber);
  margin-bottom: 6px;
}
.mu-falta-s {
  font-size: 12px;
  color: var(--slate-mid);
  line-height: 1.6;
}
.mu-falta-s b {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 11.5px;
  color: var(--slate);
}

/* ── Buscador de supervisor bloqueado ── */
.sup-busca-lock {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px 13px;
  background: var(--bg);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: all .15s;
}
.sup-busca-lock:active { transform: scale(.99); }
.sup-busca-lock:hover { border-color: var(--green-mid); background: var(--green-lt); }
.sup-lock-ico { font-size: 14px; flex: 0 0 auto; opacity: .65; }
.sup-lock-txt {
  font-size: 12px;
  font-weight: 600;
  color: var(--slate-lt);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Otros días: aviso de atrasados ── */
.bul-aviso-atraso, .bul-aviso-ok {
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 11.5px;
  line-height: 1.5;
  margin: 2px 0 10px;
}
.bul-aviso-atraso { background: var(--red-lt); color: var(--red); font-weight: 600; }
.bul-aviso-ok     { background: var(--green-lt); color: var(--green); }

/* ── Otros días: estado de cada pedido ── */
.bul-est-badge {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  padding: 2px 6px;
  border-radius: 4px;
  white-space: nowrap;
}
.bul-est-badge.sin    { background: var(--amber-lt); color: var(--amber); }
.bul-est-badge.medio  { background: #DBEAFE;        color: #1D4ED8; }
.bul-est-badge.atraso { background: var(--red-lt);   color: var(--red); }

.bul-otro-row.sinctrl  { border-left-color: var(--slate-lt); }
.bul-otro-row.atrasado { border-left-color: var(--red); background: #FFFCFC; }

/* Chip de un día atrasado */
.bul-dia-chip.atrasado {
  border-color: var(--red);
  color: var(--red);
}
.bul-dia-chip.atrasado.on {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}

/* ── Indicador pulsable (Bultos) ── */
.stat-btn {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 8px 9px;
  text-align: center;
  box-shadow: var(--shadow-sm);
  font-family: var(--font);
  cursor: pointer;
  transition: all .15s;
}
.stat-btn:active { transform: scale(.97); }
.stat-btn:hover { border-color: var(--green-mid); }
.stat-btn-v { font-size: 24px; font-weight: 700; line-height: 1.1; }
.stat-btn-l { font-size: 11px; color: var(--slate-lt); margin-top: 2px; }
.stat-btn-mas {
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--green);
  margin-top: 5px;
}

/* ── Modal de los indicadores ── */
.bul-modal-ov {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 8500;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: supFade .18s ease;
}
.bul-modal {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: 18px 18px 0 0;
  animation: supUp .22s cubic-bezier(.2,.8,.3,1);
}
.bul-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  background: var(--white);
  border-radius: 18px 18px 0 0;
  border-bottom: 1px solid var(--border);
}
.bul-modal-tit { font-size: 16px; font-weight: 800; color: var(--slate); }
.bul-modal-sub { font-size: 11.5px; color: var(--slate-lt); margin-top: 2px; }
.bul-modal-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 14px calc(22px + env(safe-area-inset-bottom));
}

/* Pestañas dentro del modal */
.bul-tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.bul-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 6px;
  border: 1.5px solid var(--border);
  background: var(--white);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  color: var(--slate-mid);
  cursor: pointer;
}
.bul-tab.on { background: var(--green); border-color: var(--green); color: #fff; }
.bul-tab-n {
  font-size: 10px;
  font-weight: 800;
  background: var(--bg);
  color: var(--slate-mid);
  border-radius: 9px;
  padding: 1px 6px;
}
.bul-tab.on .bul-tab-n { background: rgba(255,255,255,.26); color: #fff; }

/* Agrupación por día dentro del modal */
.bul-grupo { margin-bottom: 14px; }
.bul-grupo-cab {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11.5px;
  font-weight: 800;
  color: var(--slate-mid);
  text-transform: uppercase;
  letter-spacing: .3px;
  padding: 4px 0 7px;
  position: sticky;
  top: -12px;
  background: var(--bg);
  z-index: 1;
}
.bul-grupo-cab.atrasado { color: var(--red); }
.bul-grupo-n {
  font-size: 10px;
  font-weight: 800;
  background: var(--white);
  border: 1px solid var(--border);
  color: var(--slate-mid);
  border-radius: 9px;
  padding: 1px 7px;
}
.bul-ayer-kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.bul-otro-row.completado { border-left-color: var(--green); }
.bul-est-badge.hecho { background: var(--green-lt); color: var(--green); }

@media (min-width: 560px) {
  .bul-modal-ov { align-items: center; }
  .bul-modal { border-radius: 18px; max-height: 86vh; }
  .bul-modal-head { border-radius: 18px 18px 0 0; }
}

/* ── Franja de comparación con el día anterior (Bultos) ── */
.bul-franja {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 13px;
  margin-bottom: 12px;
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 3px solid var(--slate-lt);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: all .15s;
}
.bul-franja:active { transform: scale(.99); }
.bul-franja:hover { border-left-color: var(--green); }
.bul-franja-ico { font-size: 15px; flex: 0 0 auto; }
.bul-franja-txt {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  color: var(--slate-mid);
  line-height: 1.4;
}
.bul-franja-txt b { color: var(--slate); font-weight: 800; }
.bul-franja-mas {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--green);
}

/* Distintivo de incidencia en las filas de los modales */
.bul-est-badge.inc { background: var(--amber-lt); color: var(--amber); }

/* Botón de recargar el análisis cuando hay cambios sin recoger */
.ax-icon-btn.ax-sucio {
  background: var(--amber-lt);
  color: var(--amber);
  border-color: var(--amber);
  animation: axPulso 1.6s ease-in-out infinite;
}
@keyframes axPulso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(180,83,9,.35); }
  50%      { box-shadow: 0 0 0 5px rgba(180,83,9,0); }
}

/* ── Indicador de versión cargada ── */
.cp-version {
  position: fixed;
  right: 8px;
  bottom: calc(8px + env(safe-area-inset-bottom));
  z-index: 300;
  background: rgba(30, 41, 59, .62);
  color: #fff;
  border: none;
  border-radius: 20px;
  padding: 4px 10px;
  font-family: ui-monospace, Menlo, monospace;
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: .3px;
  cursor: pointer;
  opacity: .42;
  transition: opacity .15s, background .15s;
}
.cp-version:hover,
.cp-version:active { opacity: 1; }
/* Si el index pide una versión y se ha cargado otra, se ve a la legua */
.cp-version.desfase {
  background: var(--red);
  opacity: 1;
  animation: cpAviso 1.4s ease-in-out infinite;
}
@keyframes cpAviso {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,.5); }
  50%      { box-shadow: 0 0 0 6px rgba(192,57,43,0); }
}
@media print { .cp-version { display: none; } }
