/* Demand Panel — estilos de la pestaña "sales". Sólo variables de app.css (claro y oscuro salen solos). */

/* ── Lista (2026-10-14, pedido del dueño): desplegables arriba y una tabla de a 10. ── */
.vn-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.vn-fs { display: contents; } /* las regiones que se repintan no cuentan para el armado */
.vn-f .cb-b { min-width: 172px; }
.vn-f-j .cb-b { min-width: 210px; }
.vn-q { flex: 1 1 220px; max-width: 340px; }
.vn-q input { height: 40px; }
.vn-clr { font-size: 13px; padding: 6px 4px; background: none; border: 0; cursor: pointer; }
.vn-tbl { overflow: hidden; }
/* La misma grilla en el encabezado y en cada fila. */
.vn-row { display: grid; grid-template-columns: minmax(0, 1.6fr) 88px 136px 120px 128px 118px minmax(0, 1.3fr) 48px; /* fijos: cada fila es su propia grilla */ align-items: center; column-gap: 12px; padding: 9px 18px; border-top: 1px solid var(--border); color: inherit; }
.vn-rows > .vn-row:first-child { border-top: 0; }
a.vn-row:hover { background: var(--surface-2); }
.vn-row.act { box-shadow: inset 3px 0 0 var(--blue); }
[dir=rtl] .vn-row.act { box-shadow: inset -3px 0 0 var(--blue); }
.vn-hd { padding-block: 9px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; background: var(--surface-2); border-top: 0; border-bottom: 1px solid var(--border); }
.vn-hd > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vn-c-v { display: flex; align-items: center; gap: 10px; min-width: 0; }
.vn-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.vn-t b, .vn-t small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vn-t b { font-size: 13.5px; font-weight: 600; } .vn-t small { font-size: 12px; color: var(--muted); }
.vn-n { text-align: end; white-space: nowrap; font-family: var(--mono); font-variant-numeric: tabular-nums; font-size: 13px; }
/* Con otra moneda (js/moneda.js): el USD de referencia va DEBAJO del monto local, alineado a la derecha (2026-10-21). En el
   rate el "/ 1M" queda en el primer renglón: el texto (anónimo, order 0), después la unidad (order 1) y el USD abajo. */
@media (min-width: 900px) { .vn-c-r:has(.mx-usd) { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; column-gap: 4px; } }
.vn-c-r .muted, .sd-card .kv dd .muted { order: 1; }
.vn-c-r .mx-usd { order: 2; flex-basis: 100%; }
.vn-n .mx-usd, .sd-card .kv dd .mx-usd, .vn-up-q .mx-usd { display: block; text-align: end; line-height: 1.25; }
.sd-card .kv dd:has(.mx-usd) { flex-wrap: wrap; row-gap: 0; }
.sd-card .kv dd .mx-usd { order: 2; flex-basis: 100%; }
.vn-c-t b { font-size: 14px; font-weight: 650; }
.vn-c-p, .vn-c-e { min-width: 0; }
.vn-c-p { padding-inline-start: 6px; } /* aire entre el total (a la derecha) y la prueba */
.vn-pr { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.vn-pr-t { overflow: hidden; text-overflow: ellipsis; }
.vn-pr.ok { color: var(--green); }
.vn-pr.falta { color: var(--amber); }
.vn-pr em { font-style: normal; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--green-soft); font-size: 11px; display: inline-grid; place-items: center; font-family: var(--mono); font-variant-numeric: tabular-nums; }
/* "Upload Proof" (2026-10-19): la prueba que falta se sube desde la fila. Ámbar = lo que pide atención. */
.vn-up { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 28px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--amber); background: var(--amber-soft); color: var(--amber); font-size: 12.5px; font-weight: 650; white-space: nowrap; cursor: pointer; transition: background-color .15s, color .15s; }
.vn-up > span { overflow: hidden; text-overflow: ellipsis; }
.vn-up .ic { flex-shrink: 0; }
.vn-up:hover { background: var(--amber); color: var(--on-accent); }
.vn-up:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.vn-up-v { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); min-width: 0; }
.vn-up-q { flex-shrink: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.vn-c-w { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 12px; }
.vn-fi { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.vn-fi small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vn-c-w .vn-fi { overflow: hidden; }
/* Mensajes nuevos: su propia columna, al final y alineada en todas las filas (pedido del dueño, 2026-10-20). */
.vn-c-u { display: flex; justify-content: flex-end; min-width: 0; }
.vn-unr { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 99px; background: var(--accent); color: var(--on-accent); font-size: 11.5px; font-weight: 700; flex-shrink: 0; }
.vn-sk-l { display: block; height: 30px; border-radius: 8px; grid-column: 1 / -1; }
/* Paginador: "Mostrando 1–10 de 46" y los números. */
.vn-pag { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding-top: 10px; }
.vn-pag-b { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.vn-pag-n { min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--text); font: inherit; font-size: 13px; font-weight: 600; font-family: var(--mono); font-variant-numeric: tabular-nums; cursor: pointer; }
.vn-pag-n:hover { background: var(--surface-2); }
.vn-pag-n.on { background: var(--accent-soft); color: var(--accent-ink); border-color: var(--accent); cursor: default; }
.vn-pag-e { color: var(--muted); padding: 0 2px; }
.vn-pag-x { display: inline-flex; align-items: center; gap: 4px; border-color: var(--border-2); background: var(--surface); }
.vn-pag-x:disabled { opacity: .45; cursor: default; }
.vn-pag-x:disabled:hover { background: var(--surface); }
[dir=rtl] .vn-pag-x .ic { transform: scaleX(-1); }

/* ── Detalle ── */
.sd .back { margin-bottom: -6px; }
/* Compu (pedido del dueño, 2026-10-15): el chat en el centro (lo ancho) y los datos de la orden a la derecha (lo angosto). */
.sd-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 400px); gap: 18px; align-items: start; }
.sd-info-col { min-width: 0; }
.sd-info-col .sd-bar { flex-wrap: wrap; }
.sd-info-col .sd-bar .btn { flex: 1 1 auto; min-width: 0; white-space: normal; height: auto; min-height: 42px; line-height: 1.2; text-align: center; }
.sd-card > * + * { margin-top: 18px; }
.sd-card .od-h { align-items: center; }
.sd-card .od-h h2 { font-size: 20px; font-weight: 700; letter-spacing: -.02em; overflow-wrap: anywhere; }
.sd-sub { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.sd-due { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--blue-soft); color: var(--blue); font-weight: 600; }
.sd-due b { font-size: 18px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sd-due.late { background: var(--red-soft); color: var(--red); }
.sd-tl li { min-width: 0; }
.sd-tl small { line-height: 1.3; }
.sd-tl em { font-style: normal; font-size: 11px; color: var(--muted); line-height: 1.3; }
.sd-ign { font-weight: 600; overflow-wrap: anywhere; }
.sd-nota { padding: 12px 14px; border-radius: 12px; background: var(--surface-2); }
.sd-nota small { font-size: 12px; color: var(--muted); font-weight: 600; }
.sd-nota p { font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.sd-bar { display: flex; justify-content: flex-end; gap: 10px; padding-top: 16px; border-top: 1px solid var(--border); }
.sd-info { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; }
.sd-info > svg { margin-top: 1px; }
.sd-info p { flex: 1; color: var(--text); font-size: 13.5px; }
.sd-np { margin: 0; }
.sd-pfs { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.sd-pf { position: relative; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; background: var(--surface); min-width: 0; }
.sd-pf-v { display: block; width: 100%; aspect-ratio: 4 / 3; background: var(--surface-2); position: relative; }
.sd-pf-v img, .sd-pf-v video { width: 100%; height: 100%; object-fit: cover; display: block; }
.sd-pf-f { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.sd-pf-f .ic { width: 28px; height: 28px; }
.sd-play { position: absolute; inset: 0; margin: auto; width: 32px; height: 32px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: var(--on-accent); display: grid; place-items: center; }
.sd-pf-t { display: flex; flex-direction: column; padding: 6px 9px 8px; min-width: 0; }
.sd-pf-n { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sd-pf-t small { font-size: 11.5px; color: var(--muted); }
.sd-pf-x { position: absolute; top: 6px; inset-inline-end: 6px; background: var(--surface); box-shadow: var(--shadow); color: var(--red); }
.sd-pf-x:hover { background: var(--red-soft); color: var(--red); }
/* El chat: alto de la ventana y fijo mientras se recorren los datos de la orden. */
.sd-chat { position: sticky; top: calc(var(--top) + 16px); height: calc(100vh - var(--top) - 96px); min-height: 460px; display: flex; flex-direction: column; }
.sd-chat .dpc { flex: 1; min-height: 0; }
.sd-chat-h { border-radius: var(--r) var(--r) 0 0; }
.sd-chat-i { width: 32px; height: 32px; border-radius: 9px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.sd-seg { width: 100%; }
.sd-seg button { flex: 1; justify-content: center; }
.sd-nl { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--accent); color: var(--on-accent) !important; font-size: 11px; display: inline-grid; place-items: center; }

/* ── Completar ── */
.co-ov .ov-panel { max-width: 560px; }
.co-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.co-drop { cursor: pointer; transition: border-color .15s, background .15s; }
.co-drop.on { border-color: var(--accent); background: var(--accent-soft); }
.co-drop b { font-size: 14px; }
.co-drop small { font-size: 12px; }
.co-list { display: flex; flex-direction: column; gap: 8px; }
.co-it { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.co-it.error { border-color: var(--red); background: var(--red-soft); }
.co-prev { width: 48px; height: 48px; border-radius: 9px; overflow: hidden; background: var(--surface-2); flex-shrink: 0; display: grid; place-items: center; }
.co-prev img, .co-prev video { width: 100%; height: 100%; object-fit: cover; display: block; }
.co-prev .sd-pf-f .ic { width: 22px; height: 22px; }
.co-t { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.co-n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-t small { font-size: 12px; }
.co-err { color: var(--red); }
.co-ok { color: var(--green); }
.co-it.error .prog, .co-it.listo .prog { display: none; }
.co-it.ok .prog i { background: var(--green); }
.co-it .sd-pfs { margin-top: 6px; }
.co-ov .ov-body .sd-pfs { margin-top: 8px; }

/* ── Cancelar ── */
.ca-ov .ov-panel { max-width: 520px; }
.ca-warn { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 12px; background: var(--amber-soft); }
.ca-warn > svg { color: var(--amber); margin-top: 1px; }
.ca-warn b { font-size: 14px; }
.ca-warn p { font-size: 13px; color: var(--text-2); }
.ca-st { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 6px 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; }
.ca-st-t { display: flex; flex-direction: column; }
.ca-st-t b { font-size: 18px; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.ca-st small { grid-column: 1 / -1; font-size: 12.5px; }
.ca-pips { display: inline-flex; gap: 6px; }
.ca-pips i { width: 28px; height: 8px; border-radius: 99px; background: var(--surface-3); }
.ca-pips i.on { background: var(--red); }
.ca-pips i.next { background: var(--red-soft); box-shadow: inset 0 0 0 1.5px var(--red); }
.ca-mot .radio { min-height: 46px; padding: 10px 14px; font-size: 14px; }

/* ── Visor ── */
.pv-ov .ov-panel { max-width: 860px; }
.pv { display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; overflow: hidden; }
.pv img, .pv video { max-width: 100%; max-height: 70vh; object-fit: contain; display: block; }

@media (max-width: 1180px) and (min-width: 900px) {
  .sd-grid { grid-template-columns: minmax(0, 1fr) 330px; }
}
/* Tablet apaisada / compu chica (900–1279): las 8 columnas no entran (la tabla se cortaba a la derecha). Cada venta va en
   dos renglones con columnas fijas, así quedan alineadas entre filas: producto · cantidad · rate · total arriba; cuándo ·
   prueba · estado · mensajes abajo. El encabezado usa la misma grilla (dos renglones de títulos). */
@media (min-width: 900px) and (max-width: 1279px) {
  .vn-row { grid-template-columns: minmax(0, 1fr) 132px 150px 112px; grid-template-areas: "v q r t" "w p e u"; row-gap: 4px; padding: 10px 16px; }
  .vn-c-v { grid-area: v; } .vn-c-q { grid-area: q; } .vn-c-r { grid-area: r; } .vn-c-t { grid-area: t; }
  .vn-c-w { grid-area: w; } .vn-c-p { grid-area: p; } .vn-c-e { grid-area: e; justify-self: end; } .vn-c-u { grid-area: u; }
  .vn-hd > span:first-child { grid-area: v; }
  .vn-hd { row-gap: 2px; }
  .vn-hd .vn-c-e { justify-self: stretch; text-align: end; }
  .vn-c-p { padding-inline-start: 0; justify-self: end; }
  .vn-hd .vn-c-p { justify-self: stretch; text-align: end; }
}
@media (max-width: 768px) {
  /* Los filtros: una grilla de dos columnas de desplegables a todo el ancho. */
  .vn-ctl { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
  .vn-f .cb-b, .vn-f-j .cb-b { min-width: 0; }
  .vn-f-j .cb-pop { inset-inline-start: auto; inset-inline-end: 0; width: calc(200% + 8px); }
  .vn-q { max-width: none; }
  .vn-q input { height: 40px; font-size: 16px; } /* 16px: iOS no hace zoom al tocar */
  .vn-clr { grid-column: 1 / -1; justify-self: start; padding-block: 2px; }
}
@media (max-width: 899px) {
  /* Teléfono: dos renglones por venta — producto y total arriba; cuándo, la prueba (sólo el ícono) y el estado abajo. */
  .vn-hd { display: none; }
  .vn-row { grid-template-columns: minmax(0, 1fr) auto auto auto; grid-template-areas: "v v v t" "w p e u"; row-gap: 6px; column-gap: 10px; padding: 10px 14px; }
  .vn-c-v { grid-area: v; } .vn-c-t { grid-area: t; } .vn-c-e { grid-area: e; justify-self: end; } .vn-c-w { grid-area: w; } .vn-c-p { grid-area: p; } .vn-c-u { grid-area: u; }
  .vn-c-u { width: 44px; } /* el mismo ancho en todas las filas (con o sin mensajes nuevos): el estado queda alineado */
  /* Con "Upload Proof" la fila suma un renglón para el botón: al lado del estado no le dejaba lugar a la cuenta regresiva. */
  .vn-row.con-up { grid-template-areas: "v v v t" "w w e u" "p p p p"; }
  .vn-row.con-up .vn-c-p { padding-inline-start: 0; }
  .vn-c-q, .vn-c-r { display: none; }
  .vn-pr-t { display: none; }
  .vn-up { height: 36px; }
  .vn-pr.no { display: none; }
  .vn-pag { justify-content: center; }
  .vn-pag-n { min-width: 40px; height: 40px; } /* al tacto */
  .vn-pag-i { flex-basis: 100%; text-align: center; }
  .vn-pag-x span { display: none; }
  .sd-card .od-h h2 { font-size: 18px; }
  .sd-tl em { display: none; }
  /* La botonera queda a mano, arriba de la barra de abajo. */
  .sd-bar { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 5; margin: 0 -16px -16px; padding: 12px 16px; background: var(--surface); border-radius: 0 0 var(--r) var(--r); }
  .sd-bar .btn { flex: 1 1 0; min-width: 0; height: auto; min-height: 46px; white-space: normal; line-height: 1.2; text-align: center; } /* en francés / alemán no entran en una línea */
  .sd-m .sd-chat { position: static; height: calc(100vh - var(--top) - 190px); height: calc(100dvh - var(--top) - 190px - env(safe-area-inset-bottom)); min-height: 380px; }
  .sd-pfs { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
  .ca-pips i { width: 22px; }
  /* Textos largos (ES / PT): los dos botones apilados, el de cancelar abajo de todo. */
  .ca-ov .ov-foot { flex-wrap: wrap; }
  .ca-ov .ov-foot .btn { flex: 1 1 100%; white-space: normal; min-width: 0; text-align: center; }
  .ca-ov .ov-foot { flex-direction: column-reverse; }
}

/* Quién del equipo hizo el paso ("por Ana", api/ventas.js › GET /ventas/:id). */
.sd-por { display: block; font-size: 11.5px; color: var(--muted); font-style: normal; }
