/* Demand Panel — estilos de la pestaña "messages" y del chat compartido (.dpc, lo usa también Sales). Sólo variables
   de app.css (claro y oscuro salen solos). */

/* ── Chat (componente) ── */
.dpc { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--bg); }
.dpc > .th-h { flex-shrink: 0; }
.dpc-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 4px; overscroll-behavior: contain; }
.dpc-body .day { margin: 10px 0 6px; }
.dpc-body .bub { margin-top: 2px; }
.dpc-body .bub.last { margin-bottom: 6px; }
.dpc-who { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 0 4px; }
.dpc-tx { white-space: pre-wrap; overflow-wrap: anywhere; }
.dpc-body .bub-in { display: flex; flex-direction: column; gap: 6px; }
.dpc-body .bub-in .att { margin: 0; align-self: flex-start; }
.bub.team .bub-in { background: var(--accent-soft); color: var(--text); }
.bub.failed .bub-in { opacity: .65; }
.dpc-avsp { width: 22px; flex-shrink: 0; }
.bub.them > .avatar.xs { margin-bottom: calc(11px * 1.5 + 3px); }
.dpc-body .bub small { min-height: 16px; flex-wrap: wrap; gap: 6px; }
.dpc-fail { display: inline-flex; align-items: center; gap: 4px; color: var(--red); font-weight: 600; }
.dpc-retry { color: var(--accent-ink); font-weight: 700; font-size: 11.5px; text-decoration: underline; text-underline-offset: 2px; }
/* Fotos en una burbuja: una sola, hasta 240 px; varias, grilla de dos columnas de cuadrados. */
.dpc-imgs { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; width: 240px; max-width: 100%; }
.dpc-imgs.n2, .dpc-imgs.n3, .dpc-imgs.n4 { grid-template-columns: repeat(2, minmax(0, 1fr)); width: 260px; }
.dpc-imgs.n3 > .dpc-img:first-child { grid-column: 1 / -1; }
.dpc-img { display: block; border-radius: 10px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; min-height: 60px; }
.dpc-img img { width: 100%; min-width: 0; display: block; max-height: 320px; object-fit: cover; }
.dpc-imgs:not(.n1) .dpc-img img { aspect-ratio: 1; height: auto; }
.dpc-imgs.n3 > .dpc-img:first-child img { aspect-ratio: 2 / 1; }
.dpc-img:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dpc-body .bub-in.con-foto { padding: 4px; }
.dpc-body .bub-in.con-foto .dpc-tx { padding: 4px 8px 6px; }
.dpc-sys { align-self: center; max-width: min(92%, 520px); margin: 8px 0; padding: 9px 14px; border-radius: 12px; background: var(--surface-2); border: 1px dashed var(--border-2); color: var(--text-2); font-size: 12.5px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.dpc-sys .ic-p { text-align: start; }
.dpc-sys .ic-p > svg { color: var(--accent); }
.dpc-sys small { font-size: 11px; color: var(--muted); }
.dpc-typing { display: flex; align-items: center; gap: 8px; padding: 0 18px 10px; color: var(--muted); }
.dpc-typing .typing { padding: 8px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.dpc-typing small { font-size: 12px; }
.dpc { position: relative; }
.dpc-comp { position: relative; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.dpc-clip { width: 44px; height: 44px; border-radius: 22px; }
.dpc-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dpc-comp .btn-send:disabled { opacity: .5; cursor: progress; }
/* La tira de fotos por mandar (arriba del cuadro de texto, a todo el ancho). */
.dpc-adj { flex: 1 0 100%; order: -1; min-width: 0; }
.dpc-adj:empty { display: none; }
.dpc-ais { display: flex; flex-wrap: wrap; gap: 8px; }
.dpc-ai { position: relative; width: 64px; height: 64px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface-2); overflow: hidden; flex-shrink: 0; }
.dpc-ai-p { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.dpc-ai-p img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dpc-ai.subiendo .dpc-ai-p img { opacity: .55; }
.dpc-ai.error { border-color: var(--red); }
.dpc-ai.error .dpc-ai-p img { opacity: .35; }
.dpc-ai-pr { position: absolute; inset-inline: 6px; inset-block-end: 6px; height: 4px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.dpc-ai-pr i { display: block; height: 100%; background: var(--accent); transition: width .15s; }
.dpc-ai-e { position: absolute; inset-block-end: 4px; inset-inline-start: 4px; width: 20px; height: 20px; border-radius: 50%; background: var(--surface); color: var(--red); display: grid; place-items: center; }
.dpc-ai-x { position: absolute; inset-block-start: 3px; inset-inline-end: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--surface); color: var(--text); display: grid; place-items: center; box-shadow: var(--shadow); }
.dpc-ai-x:hover { color: var(--red); }
.dpc-adj-err { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; color: var(--red); font-size: 12.5px; }
.dpc-adj-err b { font-weight: 600; overflow-wrap: anywhere; }
/* Arrastrando fotos encima de la conversación. */
.dpc.drag::after { content: attr(data-drop); position: absolute; inset: 8px; z-index: 5; display: grid; place-items: center; padding: 16px; text-align: center; border: 2px dashed var(--accent); border-radius: 14px; background: var(--accent-soft); color: var(--accent-ink); font-weight: 700; font-size: 15px; pointer-events: none; }
/* El visor de una foto. */
.dpc-lb-ov .ov-panel { max-width: 920px; }
.dpc-lb { position: relative; display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; overflow: hidden; min-height: 160px; }
.dpc-lb img { max-width: 100%; max-height: 72vh; object-fit: contain; display: block; }
.dpc-lb-n { position: absolute; inset-block-start: 50%; transform: translateY(-50%); background: var(--surface); box-shadow: var(--shadow); color: var(--text); }
.dpc-lb-n.prev { inset-inline-start: 10px; } .dpc-lb-n.next { inset-inline-end: 10px; }
[dir=rtl] .dpc-lb-n .ic { transform: scaleX(-1); }
.dpc-lb-ov .ov-foot { justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.dpc-lb-t { min-width: 0; overflow-wrap: anywhere; }
.dpc-comp textarea { flex: 1; min-width: 0; min-height: 44px; max-height: 140px; height: 44px; resize: none; padding: 11px 16px; border: 1px solid var(--border-2); border-radius: 22px; background: var(--surface-2); font-size: 14.5px; line-height: 1.45; outline: none; transition: border-color .15s, box-shadow .15s; display: block; }
.dpc-comp textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.dpc-comp .btn-send { margin-bottom: 0; }
.dpc-ro { padding: 12px 16px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--text-2); flex-shrink: 0; }
.dpc-ro .ic-p { justify-content: center; }
.dpc-sk { display: flex; flex-direction: column; gap: 12px; padding-top: 6px; }
.dpc-sk .sk { height: 40px; border-radius: 16px; }
.dpc-sk .r { align-self: flex-end; }
.dpc-empty { margin: auto 0; }

/* ── Pestaña: lista + conversación + contexto ── */
.dpm-lh { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.dpm-lh-t { display: flex; align-items: center; gap: 8px; min-width: 0; }
/* Open Sale Tab · Navigate to Sale: juntos en un renglón; si no entran al lado del título, bajan juntos. */
.dpm-lh-b { display: flex; gap: 6px; flex-wrap: nowrap; margin-inline-start: auto; }
.dpm-lh-b .btn { height: 30px; padding: 0 10px; font-size: 12.5px; white-space: nowrap; }
.dpm-lh h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.dpm-it { align-items: center; }
.dpm-it .ci-t { gap: 2px; }
.dpm-it.unr .ci-r b { font-weight: 700; }
.dpm-it.unr .ci-l { color: var(--text) !important; font-weight: 600; }
.dpm-sub { align-items: flex-start; font-size: 12px; line-height: 1.35; color: var(--muted); min-width: 0; }
.dpm-sub-i { display: flex; align-items: flex-start; gap: 4px; min-width: 0; }
.dpm-sub-i > span:last-child { min-width: 0; } /* en francés / alemán / filipino no entra en una línea: baja a la segunda */
/* La fila es un <div>: el link de la conversación la cubre entera y los botones de la venta van por encima. */
.dpm-it { position: relative; }
.dpm-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.dpm-hit:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* A la derecha de la venta: la cantidad (cifra en mono) y, en el último renglón, Open Sale Tab · Navigate to Sale. */
.dpm-q { flex-shrink: 0; font-size: 12px; font-weight: 600; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.dpm-vbs { display: inline-flex; gap: 2px; flex-shrink: 0; }
.dpm-it .dpm-vb { position: relative; z-index: 2; width: 26px; height: 26px; border-radius: 7px; color: var(--muted); }
.dpm-it .dpm-vb:hover, .dpm-it .dpm-vb:focus-visible { background: var(--surface-3); color: var(--accent-ink); }
/* El soporte, fijo arriba (isotipo + "Fijado"); en la compu queda pegado al tope de la caja al bajar. */
.dpm-pin { display: inline-flex; align-items: center; gap: 3px; flex-shrink: 0; font-size: 11.5px; font-weight: 600; color: var(--accent-ink); white-space: nowrap; }
.dpm-it-sup { position: sticky; top: 0; z-index: 3; background: var(--surface); }
.dpm-it-sup:hover { background: var(--surface-2); }
.dpm-it-sup.on { background: var(--surface); background-image: linear-gradient(var(--accent-soft), var(--accent-soft)); }
.dpm-sup-show { display: flex; align-items: center; gap: 6px; width: 100%; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; font-weight: 600; color: var(--muted); text-align: start; }
.dpm-sup-show:hover { color: var(--accent-ink); background: var(--surface-2); }
.dpm-sup-show .unread { margin-inline-start: auto; }
.dpm-vacio { padding: 8px 0; }
.dpm-dot { flex-shrink: 0; }
.dpm-sup { width: 40px; height: 40px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex-shrink: 0; }
.dpm-sup img.ag-iso { width: 26px; height: 26px; display: block; }
.dpm-sup.sm { width: 32px; height: 32px; border-radius: 8px; }
.dpm-sup.sm img.ag-iso { width: 20px; height: 20px; }
.dpm .msg-c > .dpc { height: 100%; }
.dpm .th-h { min-height: 64px; }
.dpm .th-t b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dpm-ctx-b { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dpm-ctx-b .btn { margin-top: 0; }
/* "View Order Info": sólo cuando el panel de la derecha no se ve (≤ 1280 px, como app.css). */
.dpm-info-b { flex-shrink: 0; }
@media (min-width: 1281px) { .dpm-info-b { display: none; } }
.dpm-ctx-ov .ctx .card { padding: 0; border: 0; background: none; }
.dpm-pick { height: 100%; display: grid; place-items: center; padding: 24px; }
.dpm-pick .empty p { max-width: 360px; }
.dpm-ctx-t { min-width: 0; }
.dpm-ctx-t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dpm-ign { overflow-wrap: anywhere; }
.msg-r .ctx .kv { margin-top: 4px; }
.msg-r .ctx .ctx-g .glogo { flex-shrink: 0; }

@media (max-width: 899px) {
  .dpm-mlist .cl-head { padding: 14px; }
  .dpm-mlist .cl-body { overflow: visible; }
  .dpm-mlist .citem:last-child { border-bottom: 0; }
  .dpm-it-sup { position: relative; } /* en el teléfono la lista es la página: el fijo va primero, sin pegarse */
  .dpm-it .dpm-vb { width: 32px; height: 32px; } /* más fácil de tocar */
  .dpm-info-b { padding: 0 10px; }
  .dpm-m .dpc { height: 100%; }
  .dpm-m .th-h { min-height: 56px; }
  .dpc-body { padding: 14px 12px; }
  .dpc-typing { padding: 0 12px 8px; }
  .dpc-comp { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .dpc-comp textarea { font-size: 16px !important; }
  .dpc-imgs { width: 200px; } .dpc-imgs:not(.n1) { width: 220px; }
}
/* Tablet (900–1180 px, 2026-11-27): el menú está siempre entero al costado y queda menos ancho para el chat: la lista más
   angosta, sin la pastilla del estado, "Go to Order" sólo con su ícono (el nombre sigue en el title y el aria-label) y "View Order Info" se corta con "…". */
@media (min-width: 900px) and (max-width: 1180px) {
  .msg-layout { grid-template-columns: 260px minmax(0, 1fr); }
  .dpm-ir-o span { display: none; }
  .dpm-info-b { max-width: 150px; min-width: 0; }
  .dpm .th-h > .hide-xs { display: none; } /* el estado ya está en la fila de la lista y en View Order Info */
}
/* En el teléfono el nombre se ve igual (pedido del dueño); si no entra, se corta con … y va entero en el title. */
.dpm-info-b { max-width: 42vw; } .dpm-info-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Con otra moneda: el USD de referencia debajo del monto (total del panel de la venta). */
.ctx .kv dd .mx-usd { display: block; text-align: end; line-height: 1.25; }
.ctx .kv dd > .mx-usd { flex-basis: 100%; }
.ctx .kv dd:has(> .mx-usd) { flex-wrap: wrap; row-gap: 0; }

/* La guía del chat de soporte fijado (2026-11-26, tabs/messages.js › abrirGuia): el MISMO cartel que el recorrido guiado
   (.tour-block / .tour-spot / .tour-pop de app.css: colores del tema, sin animación con "reducir movimiento"). */
.dpm-guia-pop .tp-step { display: inline-flex; align-items: center; gap: 4px; }
.dpm-guia-pop p { line-height: 1.5; }
.dpm-guia-pop .tp-f { margin-top: 14px; }
/* La orden CERRADA (2026-11-27): en el lugar del cuadro de texto, con su MISMO alto (65 px; en el teléfono 61 + la zona
   segura), un renglón deshabilitado y el link al chat de soporte. Reabierta por el staff, vuelve el cuadro. Nada se mueve. */
.dpc-compw { flex-shrink: 0; }
.dpc-closed { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 14px; min-height: 65px; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--surface-2); font-size: 13px; color: var(--muted); }
.dpc-closed .ic-p { min-width: 0; }
.dpc-closed-a { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; }
@media (max-width: 899px) {
  .dpc-closed { min-height: calc(61px + env(safe-area-inset-bottom)); padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
}
