/* Compras e inventario: Qué comprar, Órdenes de compra, Proveedores, Traspasos, Kardex y Pedimentos.
   Todo con prefijo cmp- para no chocar con otras pantallas; usa los tokens de base.css. */

/* ---------- utilidades */
.cmp-ok { color: var(--ok); }
.cmp-aviso { color: var(--aviso); }
.cmp-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.cmp-nowrap { white-space: nowrap; }
.sin-sub, .sin-sub:hover { text-decoration: none; }
.cmp-etq { font-size: var(--t-xs); font-weight: 600; color: var(--texto-2); margin-bottom: 6px; }
.cmp-desc { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-prod { min-width: 180px; max-width: 360px; }
.cmp-prod .trunca { max-width: 360px; margin-top: 2px; }
.cmp-motivo { display: block; min-width: 200px; max-width: 360px; white-space: normal; font-size: var(--t-xs); line-height: 1.4; color: var(--texto-2); }

/* ---------- tabla compacta dentro de tarjetas y paneles */
table.cmp-mini { width: 100%; border-collapse: collapse; font-size: var(--t-ui); }
.cmp-mini th { text-align: left; font-size: var(--t-xs); font-weight: 600; color: var(--texto-2); background: var(--papel-2); padding: 8px 10px; border-bottom: 1px solid var(--linea); white-space: nowrap; }
.cmp-mini td { padding: 9px 10px; border-bottom: 1px solid #EEF0F3; vertical-align: middle; }
.cmp-mini th.num, .cmp-mini td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cmp-mini tfoot td { background: var(--papel-2); font-size: var(--t-xs); font-weight: 600; color: var(--texto-2); border-bottom: 0; white-space: nowrap; }
.cmp-mini tfoot td.num { color: var(--tinta); }
.cmp-mini td .l1 { display: block; }
.cmp-mini td .l2 { display: block; font-size: var(--t-xs); margin-top: 1px; }
.cmp-chips-ped { display: flex; flex-wrap: wrap; gap: 4px; }
.cmp-chips-ped .chip { height: 24px; font-size: 11.5px; }

/* ---------- Qué comprar */
.cmp-sel { width: 18px; height: 18px; accent-color: var(--rojo); cursor: pointer; flex: none; margin: 0; }
.cmp-chk-todos { display: inline-flex; align-items: center; gap: 8px; font-size: var(--t-xs); font-weight: 600; color: var(--texto-2); padding: 0 6px; cursor: pointer; white-space: nowrap; }
.cmp-prod-celda { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cmp-prod-celda .l2 { max-width: 300px; }
.cmp-tel-desc { display: block; font-size: var(--t-xs); font-weight: 400; color: var(--tenue); margin-top: 2px; }
.cmp-tel-sel { display: inline-block; width: 16px; height: 16px; color: var(--rojo); margin-right: 6px; vertical-align: -3px; }
.cmp-cant { display: inline-flex; justify-content: flex-end; }
.cmp-cant .cantidad { height: 32px; }
.cmp-cant .cantidad input { width: 58px; font-size: var(--t-ui); }
.cmp-cant .cantidad button { width: 28px; }
.cmp-prov-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 14px; margin: 10px 0 12px; background: var(--papel); border: 1px solid var(--linea); border-radius: var(--r-md); font-size: var(--t-ui); }
.cmp-prov-info > .ic { width: 20px; height: 20px; color: var(--texto-2); flex: none; }
.cmp-barra-sel {
  position: sticky; bottom: 16px; z-index: 20; margin-top: 12px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--grafito); color: #fff; border-radius: var(--r-lg); padding: 10px 12px 10px 16px; box-shadow: var(--s-3);
}
.cmp-barra-sel .info { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: var(--t-ui); }
.cmp-barra-sel .info span { font-size: var(--t-xs); color: var(--grafito-texto); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-barra-sel .btn.fantasma { color: #fff; border-color: rgba(255, 255, 255, .25); background: transparent; }
.cmp-barra-sel .btn.fantasma:hover { background: var(--grafito-2); }
.cmp-conf-oc { padding: 10px 12px; border: 1px solid var(--linea); border-radius: var(--r-md); background: var(--papel-2); }
.cmp-formula { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: var(--t-ui); line-height: 1.45; color: var(--texto-2); }
.cmp-formula b { color: var(--tinta); }
.cmp-panel-cant { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 12px 14px; border: 1px solid var(--linea); border-radius: var(--r-md); }
.cmp-panel-cant > b { min-width: 110px; text-align: right; font-size: var(--t-md); }
.cmp-ruta-mini { width: 36px; height: 36px; border-radius: 10px; background: var(--papel-3); display: inline-flex; align-items: center; justify-content: center; gap: 2px; flex: none; }
.cmp-ruta-mini i { width: 7px; height: 7px; border-radius: 2px; display: inline-block; }
.cmp-ruta-mini .ic { width: 12px; height: 12px; color: var(--tenue); }
.cmp-mini-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 0; border: 1px solid var(--linea); border-radius: var(--r-md); overflow: hidden; }
.cmp-mini-kpis > div { padding: 10px 12px; border-right: 1px solid #EEF0F3; min-width: 0; background: var(--papel); }
.cmp-mini-kpis > div:last-child { border-right: 0; }
.cmp-mini-kpis .e { font-size: var(--t-xs); color: var(--tenue); font-weight: 600; }
.cmp-mini-kpis .v { font: 600 var(--t-lg)/1.25 var(--f-marca); margin-top: 3px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Órdenes de compra */
.cmp-oc-buscar { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; }
.cmp-oc-lineas { border: 1px solid var(--linea); border-radius: var(--r-md); overflow: hidden; }
.cmp-oc-linea { display: grid; grid-template-columns: minmax(0, 1fr) auto 120px auto; gap: 12px; align-items: center; padding: 10px 12px; border-bottom: 1px solid #EEF0F3; }
.cmp-oc-linea:last-child { border-bottom: 0; }
.cmp-oc-linea .prod { min-width: 0; }
.cmp-oc-linea .imp { text-align: right; }
.cmp-total-oc { font-size: var(--t-md); color: var(--tinta); margin-left: 4px; }
.cmp-partidas-movil { padding: 0 14px 6px; }
.cmp-costo-total { display: flex; justify-content: space-between; gap: 16px; padding: 12px 14px; border-radius: var(--r-md); background: var(--papel-2); border: 1px solid var(--linea); }
.cmp-costo-total .v { font: 700 var(--t-xl)/1.15 var(--f-marca); margin-top: 2px; font-variant-numeric: tabular-nums; }

/* ---------- Proveedores */
.cmp-colson .tarjeta-cabeza .ic-cab { background: var(--info-50); color: var(--info); }
.cmp-colson-lista .renglon .der .t { color: var(--info); }
.cmp-conectado { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Traspasos */
.cmp-ruta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--linea); border-radius: var(--r-md); background: var(--papel-2); }
.cmp-ruta > .ic, .cmp-ruta-celda > .ic { width: 14px; height: 14px; color: var(--tenue); }
.cmp-ruta-celda { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }

/* ---------- Kardex */
.cmp-kdx-barra { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.cmp-kdx-busca { flex: 1 1 320px; min-width: 0; max-width: 520px; }
.cmp-kdx-alm .selector { min-width: 220px; }
.cmp-kdx-ficha .ficha-cab .ico-g .ic { width: 26px; height: 26px; }
.cmp-kdx-ficha .alm-celda[title] { transition: background .12s; }
.cmp-kdx-ficha .alm-celda[title]:hover { background: var(--papel-2); }
.cmp-mov { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.cmp-mov-ic { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--papel-3); color: var(--texto-2); flex: none; }
.cmp-mov-ic .ic { width: 15px; height: 15px; }
.cmp-mov-ic.ent { background: var(--ok-50); color: var(--ok); }
.cmp-mov-ic.sal { background: var(--neutro-50); color: var(--neutro); }
.cmp-mov .l1, .cmp-mov .l2 { white-space: nowrap; }
.cmp-doc { white-space: nowrap; }
.tabla tbody tr.cmp-fila-hist td { background: #FBFBFC; }
.tabla tbody tr.cmp-fila-hist .l1 { font-weight: 500; }

/* ---------- Pedimentos */
.cmp-ad { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 14px; align-items: stretch; }
.cmp-ad-lado { border-radius: var(--r-md); padding: 14px; border: 1px solid var(--linea); min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.cmp-ad-lado.antes { background: var(--papel-2); }
.cmp-ad-lado.despues { background: var(--papel); border-color: #CFE6D9; box-shadow: inset 3px 0 0 var(--ok-punto); }
.cmp-ad-etq { display: flex; align-items: center; gap: 6px; font-size: var(--t-xs); font-weight: 700; color: var(--texto-2); }
.cmp-ad-etq .ic { width: 16px; height: 16px; }
.cmp-ad-lado.despues .cmp-ad-etq .ic { color: var(--ok-punto); }
.cmp-ad-flecha { display: grid; place-items: center; color: var(--tenue); }
.cmp-ad-flecha .ic { width: 22px; height: 22px; }
.cmp-odoo-desc { font-family: var(--f-mono); font-size: 12.5px; line-height: 1.55; color: var(--texto-2); background: var(--papel); border: 1px dashed var(--linea-2); border-radius: var(--r-sm); padding: 10px 12px; word-break: break-word; }
.cmp-odoo-desc.inline { display: inline; padding: 1px 6px; border-style: solid; }
.cmp-odoo-desc mark { background: var(--aviso-50); color: var(--aviso); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.cmp-ad-lista { margin: 0; padding-left: 18px; font-size: var(--t-xs); color: var(--texto-2); line-height: 1.5; }
.cmp-nuevo-desc { font: 600 var(--t-sm)/1.4 var(--f-ui); }
.cmp-ped-chip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--t-xs); padding: 8px 10px; border-radius: var(--r-sm); background: var(--info-50); color: var(--info); }
.cmp-ped-chip .ic { width: 16px; height: 16px; }
.cmp-ped-chip .mono { font-size: 12.5px; color: var(--tinta); }
.cmp-cfdi { border-radius: var(--r-sm); background: var(--grafito); color: #DCE1E7; padding: 10px 12px; }
.cmp-cfdi-t { font-size: var(--t-micro); color: var(--grafito-texto); margin-bottom: 4px; font-weight: 600; }
.cmp-cfdi code { display: block; font-family: var(--f-mono); font-size: 12px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; color: #9CD5F8; }
.cmp-ad-pie { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.cmp-peps { display: flex; flex-direction: column; gap: 6px; }
.cmp-peps-fila { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--linea); border-radius: var(--r-md); background: var(--papel-2); }
.cmp-peps-fila.toma { background: var(--papel); border-color: #CFE6D9; }
.cmp-peps-fila .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: var(--t-xs); font-weight: 700; background: var(--papel-3); color: var(--texto-2); flex: none; }
.cmp-peps-fila.toma .n { background: var(--ok-50); color: var(--ok); }
.cmp-peps-fila .mono { font-size: 12.5px; }
.cmp-ped-partes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.cmp-ped-partes > div { border: 1px solid var(--linea); border-radius: var(--r-sm); padding: 8px 10px; background: var(--papel-2); min-width: 0; }
.cmp-ped-partes .mono { display: block; font-size: var(--t-lg); color: var(--tinta); }
.cmp-ped-partes small { display: block; font-size: var(--t-micro); color: var(--tenue); margin-top: 2px; }

/* ---------- celular */
@media (max-width: 760px) {
  .cmp-barra-sel { bottom: calc(var(--abajo) + var(--seg-b) + 10px); margin-right: 62px; padding: 10px 12px; gap: 8px; }
  .cmp-barra-sel .info { flex-basis: 100%; }
  .cmp-barra-sel .btn { flex: 1; }
  .cmp-oc-linea { grid-template-columns: minmax(0, 1fr) auto; }
  .cmp-oc-linea .prod { grid-column: 1 / -1; }
  .cmp-oc-linea .imp { text-align: left; }
  .cmp-panel-cant { grid-template-columns: minmax(0, 1fr) auto; }
  .cmp-panel-cant > div:first-child { grid-column: 1 / -1; }
  .cmp-ad { grid-template-columns: minmax(0, 1fr); }
  .cmp-ad-flecha { transform: rotate(90deg); height: 22px; }
  .cmp-ped-partes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-kdx-busca { flex-basis: 100%; max-width: none; }
  .cmp-kdx-alm, .cmp-kdx-alm .selector { width: 100%; }
  .cmp-costo-total { flex-direction: column; }
  .cmp-costo-total .derecha { text-align: left; }
  .cmp-mini-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cmp-mini-kpis > div:nth-child(2n) { border-right: 0; }
  .cmp-mini-kpis > div:nth-child(-n+2) { border-bottom: 1px solid #EEF0F3; }
  .cmp-prov-info .btn { width: 100%; }
}
