/* Cotizador · estética base: calco de WhatsApp Web oscuro (ChatSim), adaptada a una app real. */
@font-face {
  font-family: "Roboto Variable"; font-style: normal; font-weight: 100 900; font-stretch: 100%;
  src: url(/static/assets/RobotoVariable.woff2) format("woff2");
}
:root {
  --fuente: "Roboto Variable", Roboto, "Helvetica Neue", Helvetica, sans-serif;
  --fondo: #111b21; --fondo: #161717;
  --panel: #1d1f1f; --panel-2: #242626; --borde: rgba(255,255,255,.08);
  --texto: #fafafa; --texto-2: rgba(255,255,255,.62); --texto-3: #8a8d8d;
  --acento: #21c063; --acento-t: #0b1a12; --alerta: #ffd279; --error: #f15c6d; --info: #53bdeb;
  --burbuja-entrante: #242626; --burbuja-saliente: #144d37; --burbuja-hora: rgba(255,255,255,.6);
  --leido: #53bdeb; --enviado: rgba(255,255,255,.6);
  --doc-caja-entrante: #1d1f1f; --doc-caja-saliente: #103e2c;
  --scroll-thumb: rgba(255,255,255,.16);
  --radio: 8px;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
#raiz { height: 100%; }
html, body { height: 100%; background: var(--fondo); overflow: hidden; }
body { font-family: var(--fuente); color: var(--texto); font-size: 14.5px; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
svg { fill: currentColor; }
svg[fill=none] { fill: none; }
* { scrollbar-width: thin; scrollbar-color: var(--scroll-thumb) transparent; }
[hidden] { display: none !important; }

/* ---------- login ---------- */
.login { height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: min(360px, 100%); background: var(--panel); border: 1px solid var(--borde); border-radius: 14px; padding: 28px 24px; display: grid; gap: 14px; }
.login h1 { font-size: 22px; font-weight: 600; }
.login p { color: var(--texto-2); font-size: 13.5px; margin-top: -8px; }
.marca { width: 44px; height: 44px; border-radius: 12px; background: var(--acento); color: var(--acento-t); display: grid; place-items: center; }
.marca svg { width: 26px; height: 26px; }

label.campo { display: grid; gap: 5px; font-size: 12.5px; color: var(--texto-2); }
input, select, textarea {
  background: var(--panel-2); border: 1px solid transparent; border-radius: 8px; padding: 9px 11px; width: 100%; outline: none; font-size: 14.5px;
}
input:focus, select:focus, textarea:focus { border-color: var(--acento); }
input::placeholder, textarea::placeholder { color: var(--texto-3); }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, #8a8d8d 50%), linear-gradient(135deg, #8a8d8d 50%, transparent 50%); background-position: calc(100% - 17px) 50%, calc(100% - 12px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
.btn-p { background: var(--acento); color: var(--acento-t); font-weight: 600; padding: 9px 16px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; }
.btn-p:hover { filter: brightness(1.08); }
.btn-p:disabled { opacity: .45; cursor: not-allowed; }
.btn-s { background: var(--panel-2); padding: 8px 14px; border-radius: 999px; display: inline-flex; align-items: center; gap: 6px; justify-content: center; font-size: 13.5px; }
.btn-s:hover { background: #2e3030; }
.btn-s.peligro { color: var(--error); }
.btn-s svg, .btn-p svg { width: 18px; height: 18px; }
.error { color: var(--error); font-size: 13px; min-height: 18px; }

/* ---------- marco ---------- */
.app { height: 100%; display: grid; grid-template-columns: 68px 1fr; grid-template-rows: minmax(0, 1fr); position: relative; }
.rail { background: #0f1010; border-right: 1px solid var(--borde); display: flex; flex-direction: column; align-items: center; padding: 12px 0; gap: 6px; }
.rail .marca { margin-bottom: 10px; width: 38px; height: 38px; border-radius: 10px; }
.rail .marca svg { width: 22px; height: 22px; }
.rail button { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; color: var(--texto-2); position: relative; }
.rail button:hover { background: var(--panel); color: var(--texto); }
.rail button.activo { background: var(--panel-2); color: var(--acento); }
.rail button svg { width: 24px; height: 24px; }
.rail .esp { flex: 1; }
.insignia { position: absolute; top: 3px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--acento); color: var(--acento-t); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.vista { display: none; min-width: 0; min-height: 0; height: 100%; grid-template-rows: minmax(0, 1fr); }
.app[data-vista=chats] #v-chats, .app[data-vista=solicitudes] #v-solicitudes, .app[data-vista=proveedores] #v-proveedores { display: grid; }

/* ---------- avatar / etiquetas ---------- */
.avatar { width: 46px; height: 46px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 600; font-size: 16px; color: #fff; background: #4a5568; }
.avatar.ruben { background: #1f7a5a; } .avatar.desconocido { background: #6b5b3a; }
.etq { display: inline-block; font-size: 11.5px; font-weight: 500; padding: 2px 8px; border-radius: 999px; background: #2e3030; color: var(--texto-2); white-space: nowrap; }
.etq.enviada { background: #263a4d; color: #8cc4f5; }
.etq.respondio, .etq.cerrada { background: #1a4a35; color: #6fe3a4; }
.etq.sin_respuesta, .etq.cancelada { background: #4a3d1f; color: #ffd279; }
.etq.descartado { background: #4a2229; color: #f4929f; }
.etq.desc { background: #4a3d1f; color: #ffd279; }

/* ---------- vista chats (3 columnas) ---------- */
#v-chats { grid-template-columns: 380px minmax(0, 1fr) 340px; }
.col-lista { background: var(--fondo); border-right: 1px solid var(--borde); display: flex; flex-direction: column; min-height: 0; }
.col-cab { height: 60px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0 16px; }
.col-cab h2 { font-size: 20px; font-weight: 600; }
.buscador { padding: 0 12px 8px; }
.buscador input { border-radius: 999px; padding-left: 16px; }
.filtros { display: flex; gap: 8px; padding: 4px 12px 10px; }
.filtros button { padding: 5px 13px; border-radius: 999px; background: var(--panel); color: var(--texto-2); font-size: 13.5px; }
.filtros button.activo { background: #144d37; color: #d7f7e5; }
.chats { flex: 1; overflow-y: auto; min-height: 0; }
.chat-item { display: flex; gap: 12px; align-items: center; padding: 10px 14px; width: 100%; text-align: left; border-bottom: 1px solid rgba(255,255,255,.03); }
.chat-item:hover { background: var(--panel); }
.chat-item.activo { background: var(--panel-2); }
.chat-item .cuerpo { flex: 1; min-width: 0; display: grid; gap: 3px; }
.chat-item .l1, .chat-item .l2, .chat-item .l3 { display: flex; justify-content: space-between; gap: 8px; align-items: center; min-width: 0; }
.chat-item .nombre { font-size: 16px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-item .hora-l { font-size: 12px; color: var(--texto-3); flex: none; }
.chat-item .hora-l.nuevo { color: var(--acento); }
.chat-item .ultimo { font-size: 13.5px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { background: var(--acento); color: var(--acento-t); font-size: 12px; font-weight: 700; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.vacio { padding: 36px 24px; text-align: center; color: var(--texto-3); font-size: 14px; line-height: 1.5; }

/* ---------- chat central ---------- */
.col-chat { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--fondo); position: relative; }
.chat-vacio { margin: auto; text-align: center; color: var(--texto-3); padding: 24px; }
.chat-vacio h3 { color: var(--texto-2); font-weight: 500; font-size: 20px; margin-bottom: 6px; }
.cabecera { height: 60px; flex: none; display: flex; align-items: center; padding: 0 14px 0 16px; gap: 12px; background: var(--fondo); border-bottom: 1px solid var(--borde); position: relative; z-index: 2; }
.cabecera .avatar { width: 40px; height: 40px; font-size: 14px; }
.cabecera .info { flex: 1; min-width: 0; }
.cabecera .nombre { font-size: 16.5px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cabecera .estado { font-size: 13px; color: var(--texto-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icono-btn { width: 40px; height: 40px; border-radius: 50%; display: none; place-items: center; color: var(--texto-2); flex: none; }
.icono-btn:hover { background: var(--panel); }
.icono-btn svg { width: 24px; height: 24px; }
.conversacion { flex: 1; position: relative; min-height: 0; }
.conversacion .fondo { position: absolute; inset: 0; background: var(--fondo); }
.conversacion .fondo::after { content: ""; position: absolute; inset: 0; background-color: rgba(255,255,255,.1); opacity: .6;
  -webkit-mask-image: url(/static/assets/doodle-whatsapp.svg); mask-image: url(/static/assets/doodle-whatsapp.svg);
  -webkit-mask-size: 432px 768px; mask-size: 432px 768px; }
.lista { position: absolute; inset: 0; overflow-y: auto; display: flex; flex-direction: column; padding: 12px 6% 12px; }
.fila { flex: none; display: flex; align-items: center; position: relative; margin-bottom: 2px; }
.fila.nuevo-grupo { margin-top: 9px; }
.fila.in { justify-content: flex-start; } .fila.out { justify-content: flex-end; }
.burbuja { position: relative; max-width: min(520px, 78%); border-radius: 7.5px; color: var(--texto); }
.in .burbuja { background: var(--burbuja-entrante); } .out .burbuja { background: var(--burbuja-saliente); }
.in.cola .burbuja { border-top-left-radius: 0; } .out.cola .burbuja { border-top-right-radius: 0; }
.cola-svg { position: absolute; top: 0; width: 8px; height: 13px; display: none; }
.cola .cola-svg { display: block; }
.in .cola-svg { left: -8px; fill: var(--burbuja-entrante); } .out .cola-svg { right: -8px; fill: var(--burbuja-saliente); }
.b-texto { padding: 7px 7px 9px 9px; line-height: 19px; }
.b-texto .txt, .caption { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14.2px; line-height: 19px; }
.b-texto .espaciador { display: inline-block; height: 0; vertical-align: baseline; }
.hora { font-size: 12px; line-height: 15px; color: var(--burbuja-hora); white-space: nowrap; display: inline-flex; align-items: center; }
.b-texto .hora { position: absolute; right: 7px; bottom: 3px; }
.hora .check { margin-left: 2px; width: 16px; height: 11px; }
.hora .check.leido { color: var(--leido); } .hora .check.enviado, .hora .check.entregado, .hora .check.pendiente { color: var(--enviado); }
.hora .check.fallido { color: var(--error); font-weight: 700; width: auto; }
.hora .check svg { width: 16px; height: 11px; display: block; }
.plantilla-tag { display: block; font-size: 11.5px; color: var(--alerta); margin-bottom: 3px; letter-spacing: .02em; }
.error-msg { display: block; font-size: 12px; color: var(--error); margin-top: 4px; }
.b-imagenes { padding: 3px; }
.b-imagenes .img { display: block; max-width: 100%; width: 320px; max-height: 300px; object-fit: cover; border-radius: 5px; background: #2a2c2c; cursor: zoom-in; }
.b-imagenes .caption { padding: 5px 4px 0 6px; }
.b-imagenes .pie, .b-doc .pie { height: 18px; display: flex; justify-content: flex-end; align-items: flex-end; padding: 0 4px 0 0; }
.b-doc { padding: 3px; width: 320px; max-width: 100%; }
.b-doc a.caja { display: flex; align-items: center; border-radius: 6px; padding: 11px 14px 14px 14px; color: inherit; text-decoration: none; gap: 10px; }
.in .b-doc .caja { background: var(--doc-caja-entrante); } .out .b-doc .caja { background: var(--doc-caja-saliente); }
.b-doc .icono-doc { width: 24px; height: 28.5px; flex: none; }
.b-doc .nombre-doc { font-size: 14.2px; line-height: 19px; overflow-wrap: anywhere; }
.b-doc .meta { font-size: 12px; color: var(--burbuja-hora); margin-top: 2px; }
.b-doc .dl { margin-left: auto; color: var(--texto-2); } .b-doc .dl svg { width: 22px; height: 22px; }
.b-doc .caption { padding: 5px 4px 0 6px; }
.chip { flex: none; display: flex; justify-content: center; margin: 12px 0; }
.chip span { background: #1d1f1f; color: var(--burbuja-hora); font-size: 12.5px; padding: 5px 12px 6px; border-radius: 7.5px; }

.compositor { flex: none; background: var(--fondo); padding: 8px 12px 12px 14px; position: relative; z-index: 2; border-top: 1px solid var(--borde); }
.compositor .pildora { min-height: 48px; border-radius: 24px; background: var(--panel-2); display: flex; align-items: flex-end; padding: 4px 6px 4px 14px; gap: 6px; }
.compositor textarea { background: none; border: 0; resize: none; max-height: 120px; padding: 11px 0; line-height: 20px; height: 42px; font-size: 15px; }
.compositor .enviar { width: 40px; height: 40px; border-radius: 50%; background: var(--acento); color: var(--acento-t); display: grid; place-items: center; flex: none; }
.compositor .enviar:disabled { background: #3a3d3d; color: #777; cursor: not-allowed; }
.compositor .enviar svg { width: 22px; height: 22px; }
.bloqueo { display: flex; gap: 10px; align-items: flex-start; background: #2b2619; border: 1px solid #5a4a1f; color: var(--alerta); border-radius: 10px; padding: 10px 14px; font-size: 13.5px; line-height: 1.45; }
.bloqueo svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.bloqueo b { display: block; margin-bottom: 1px; }

/* ---------- panel derecho ---------- */
.col-panel { background: var(--fondo); border-left: 1px solid var(--borde); overflow-y: auto; min-height: 0; }
.panel-cab { height: 60px; display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--borde); font-weight: 500; font-size: 16px; }
.panel-cuerpo { padding: 14px 16px 24px; display: grid; gap: 14px; }
.tarjeta { background: var(--panel); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
.tarjeta h4 { font-size: 15px; font-weight: 600; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; font-size: 13.5px; }
.kv dt { color: var(--texto-3); } .kv dd { overflow-wrap: anywhere; }
.rejilla2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.total-est { background: var(--panel-2); border-radius: 10px; padding: 10px 12px; display: grid; gap: 2px; }
.total-est b { font-size: 19px; font-weight: 600; }
.total-est small { color: var(--texto-3); font-size: 12px; }
.guardado { font-size: 12px; color: var(--acento); min-height: 16px; }
.enlace { color: var(--info); font-size: 13.5px; text-align: left; }

/* ---------- solicitudes ---------- */
#v-solicitudes { grid-template-columns: 320px minmax(0, 1fr); }
.sol-item { width: 100%; text-align: left; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.03); display: grid; gap: 4px; }
.sol-item:hover { background: var(--panel); } .sol-item.activo { background: var(--panel-2); }
.sol-item .l1 { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.sol-item .cod { font-weight: 600; color: var(--acento); font-size: 13px; }
.sol-item .eq { font-size: 15.5px; } .sol-item .sub { font-size: 12.5px; color: var(--texto-3); }
.tablero { overflow-y: auto; min-height: 0; padding: 18px 22px 40px; min-width: 0; }
.tablero-cab { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; margin-bottom: 14px; }
.tablero-cab h2 { font-size: 22px; font-weight: 600; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tablero-cab .meta { color: var(--texto-2); font-size: 14px; margin-top: 6px; line-height: 1.5; }
.acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.aviso { background: var(--panel); border-left: 3px solid var(--alerta); border-radius: 6px; padding: 8px 12px; font-size: 13px; color: var(--texto-2); margin-bottom: 12px; }
table.comp { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border-radius: 12px; overflow: hidden; font-size: 14px; }
.comp th { text-align: left; font-weight: 500; font-size: 12px; color: var(--texto-3); text-transform: uppercase; letter-spacing: .04em; padding: 11px 10px; background: #191b1b; white-space: nowrap; }
.comp td { padding: 9px 8px; border-top: 1px solid var(--borde); vertical-align: middle; }
.comp tr.barato td { background: rgba(33,192,99,.09); }
.comp tr.ganador td { background: rgba(83,189,235,.1); }
.comp td input, .comp td select { padding: 6px 8px; font-size: 14px; min-width: 64px; }
.comp td select[data-k=estado] { min-width: 128px; }
.comp td select[data-k=iva_incluido] { min-width: 112px; }
.comp td input.nota-p { margin-top: 6px; width: 100%; min-width: 150px; font-size: 13px; padding: 5px 8px; background: transparent; border-color: var(--borde); }
.comp td input.precio { min-width: 118px; text-align: right; }
.comp td input.num { max-width: 66px; min-width: 56px; text-align: right; }
.comp td:first-child { min-width: 150px; }
.comp .prov-n { font-weight: 500; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.comp .total { font-weight: 600; white-space: nowrap; text-align: right; }
.comp .total small { display: block; font-weight: 400; color: var(--texto-3); font-size: 11.5px; }
.sello { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--acento); color: var(--acento-t); font-weight: 600; white-space: nowrap; }
.sello.gan { background: var(--info); }
.comp .acc { white-space: nowrap; }
.comp .acc .btn-s + .btn-s { margin-left: 6px; }
.comp .acc .solo-ico { padding: 6px 8px; }
.comp .acc .solo-ico svg { width: 17px; height: 17px; }
.comp .acc .btn-s { padding: 6px 10px; font-size: 12.5px; }
.comp-envoltura { overflow-x: auto; }

/* ---------- proveedores ---------- */
#v-proveedores { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
.barra { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 22px; border-bottom: 1px solid var(--borde); flex-wrap: wrap; }
.barra h2 { font-size: 20px; font-weight: 600; }
.barra .herr { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.barra input, .barra select { width: 220px; }
.cuerpo-scroll { overflow-y: auto; padding: 16px 22px 40px; min-height: 0; }
table.lista-p { width: 100%; border-collapse: separate; border-spacing: 0; background: var(--panel); border-radius: 12px; overflow: hidden; }
.lista-p th { text-align: left; font-size: 12px; font-weight: 500; text-transform: uppercase; color: var(--texto-3); padding: 11px 12px; background: #191b1b; letter-spacing: .04em; }
.lista-p td { padding: 11px 12px; border-top: 1px solid var(--borde); }
.lista-p .sub { color: var(--texto-3); font-size: 12.5px; }
.cats { display: flex; gap: 5px; flex-wrap: wrap; }

/* ---------- modal ---------- */
.modal-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { background: var(--panel); border-radius: 14px; width: min(560px, 100%); max-height: 100%; overflow-y: auto; padding: 22px; display: grid; gap: 14px; border: 1px solid var(--borde); }
.modal h3 { font-size: 19px; font-weight: 600; }
.modal .pie { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.provs-check { display: grid; gap: 4px; max-height: 210px; overflow-y: auto; background: var(--panel-2); border-radius: 8px; padding: 6px; }
.provs-check label { display: flex; gap: 10px; align-items: center; padding: 6px 8px; border-radius: 6px; font-size: 14px; cursor: pointer; }
.provs-check label:hover { background: #2e3030; }
.provs-check label.off { opacity: .5; cursor: not-allowed; }
.provs-check input { width: 18px; height: 18px; accent-color: var(--acento); flex: none; }
.provs-check small { color: var(--texto-3); margin-left: auto; }
.check-linea { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.check-linea input { width: 18px; height: 18px; accent-color: var(--acento); }

/* ---------- simulador ---------- */
.sim { position: fixed; right: 18px; bottom: 18px; width: 340px; background: var(--panel); border: 1px solid #5a4a1f; border-radius: 14px; box-shadow: 0 10px 40px rgba(0,0,0,.5); z-index: 40; padding: 14px; display: grid; gap: 10px; }
.sim h4 { display: flex; align-items: center; justify-content: space-between; font-size: 14.5px; color: var(--alerta); }
.sim h4 button { color: var(--texto-2); } .sim h4 svg { width: 20px; height: 20px; }
.sim textarea { min-height: 62px; resize: vertical; }
.sim .fila-b { display: flex; gap: 8px; flex-wrap: wrap; }
.sim small { color: var(--texto-3); font-size: 12px; line-height: 1.4; }

#avisos { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; pointer-events: none; }
.aviso-t { background: #323535; border: 1px solid var(--borde); padding: 10px 16px; border-radius: 10px; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.5); max-width: 90vw; }
.aviso-t.err { background: #4a2229; color: #ffc6cd; }
.visor { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 60; display: grid; place-items: center; padding: 20px; }
.visor img { max-width: 100%; max-height: 100%; border-radius: 6px; }

/* ---------- móvil: una pantalla a la vez ---------- */
@media (max-width: 980px) and (min-width: 761px) {
  #v-chats { grid-template-columns: 330px minmax(0, 1fr); }
  .col-panel { display: none; }
  #v-chats[data-pantalla=panel] { grid-template-columns: 1fr; }
  #v-chats[data-pantalla=panel] .col-lista, #v-chats[data-pantalla=panel] .col-chat { display: none; }
  #v-chats[data-pantalla=panel] .col-panel { display: block; }
  .icono-btn.btn-panel { display: grid; }
}
@media (max-width: 760px) {
  html, body { overflow: hidden; }
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) 58px; padding-bottom: env(safe-area-inset-bottom); }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; padding: 0 6px; border-right: 0; border-top: 1px solid var(--borde); }
  .rail .marca, .rail .esp { display: none; }
  .rail button { width: 52px; height: 48px; }
  .vista { grid-row: 1; }
  #v-chats, #v-solicitudes { grid-template-columns: 1fr; }
  #v-chats .col-lista, #v-chats .col-chat, #v-chats .col-panel { display: none; }
  #v-chats[data-pantalla=lista] .col-lista { display: flex; }
  #v-chats[data-pantalla=chat] .col-chat { display: flex; }
  #v-chats[data-pantalla=panel] .col-panel { display: block; }
  #v-solicitudes .col-lista { display: flex; } #v-solicitudes .tablero { display: none; }
  #v-solicitudes[data-pantalla=detalle] .col-lista { display: none; }
  #v-solicitudes[data-pantalla=detalle] .tablero { display: block; }
  .icono-btn.atras, .icono-btn.btn-panel { display: grid; }
  .lista { padding: 10px 14px; }
  .burbuja { max-width: 86%; }
  .b-imagenes .img { width: 100%; } .b-doc { width: 100%; }
  .tablero { padding: 14px 14px 30px; }
  .barra { padding: 12px 14px; } .barra input, .barra select { width: 100%; }
  .cuerpo-scroll { padding: 12px 14px 30px; }
  /* tablas como tarjetas */
  table.comp, table.lista-p, .comp tbody, .lista-p tbody, .comp tr, .lista-p tr, .comp td, .lista-p td { display: block; width: 100%; }
  .comp thead, .lista-p thead { display: none; }
  table.comp, table.lista-p { background: none; }
  .comp tr, .lista-p tr { background: var(--panel); border-radius: 12px; margin-bottom: 10px; padding: 8px 4px; }
  .comp tr.barato { outline: 1.5px solid rgba(33,192,99,.55); } .comp tr.barato td { background: none; }
  .comp tr.ganador { outline: 1.5px solid rgba(83,189,235,.6); } .comp tr.ganador td { background: none; }
  .comp td, .lista-p td { border-top: 0; padding: 5px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
  .comp td::before, .lista-p td::before { content: attr(data-l); color: var(--texto-3); font-size: 12.5px; flex: none; }
  .comp td[data-l=Proveedor]::before, .lista-p td[data-l=Proveedor]::before, .lista-p td[data-l=Nombre]::before { content: none; }
  .comp td input, .comp td select { max-width: 60%; }
  .comp td[data-l=Proveedor] { flex-wrap: wrap; }
  .comp td input.nota-p { max-width: 100%; margin-top: 2px; }
  .comp td.total { flex-wrap: wrap; }
  .comp td input.num { max-width: 90px; }
  .comp .acc { flex-wrap: wrap; }
  .sim { left: 10px; right: 10px; bottom: 68px; width: auto; }
  .modal { padding: 18px; }
  .panel-cab { padding: 0 8px; }
}

/* ---------- fase 2: IA ---------- */
.app { grid-template-rows: auto minmax(0, 1fr); }
.rail { grid-row: 1 / 3; }
.banner-ia { grid-column: 2; grid-row: 1; font-size: 13px; padding: 7px 16px; border-bottom: 1px solid var(--borde); background: #1d1f1f; color: var(--texto-2); }
.banner-ia.ambar { background: #2b2619; color: var(--alerta); }
.banner-ia.gris { background: #2a2c2c; color: #c5c8c8; }
.banner-ia.info { background: #172833; color: #8cc4f5; }
.vista { grid-column: 2; grid-row: 2; }
.punto { position: absolute; right: 7px; bottom: 7px; width: 9px; height: 9px; border-radius: 50%; background: #666; border: 2px solid #0f1010; }
.punto.verde { background: var(--acento); } .punto.ambar { background: var(--alerta); } .punto.gris { background: #6b6e6e; }
.ia-tag { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .05em; padding: 1px 6px; border-radius: 5px; background: #2d2a55; color: #b9b3ff; vertical-align: middle; margin-right: 4px; }
.ia-tag.humano { background: #3b3320; color: var(--alerta); }
.autor-ia { display: table; margin-bottom: 3px; }
.out.ia-msg .burbuja { background: #1c3a52; } .cola .ia-msg .cola-svg, .out.ia-msg .cola-svg { fill: #1c3a52; }
.ia-barra { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 16px; font-size: 13px; background: #1d1f1f; border-bottom: 1px solid var(--borde); color: var(--texto-2); }
.ia-barra.pausada { background: #2b2619; color: var(--alerta); }
.ia-barra .btn-s { padding: 4px 12px; font-size: 12.5px; margin-left: auto; }
.hint { font-size: 11.5px; color: var(--texto-3); line-height: 1.35; min-height: 0; overflow-wrap: anywhere; }
.alerta-p { background: #2b2619; border: 1px solid #5a4a1f; color: var(--alerta); border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; display: grid; gap: 4px; }
.alerta-p .btn-s { justify-self: start; padding: 4px 10px; font-size: 12px; }
.etq.completa { background: #14573a; color: #8ff0bd; }
.etq.humano { background: #4a3d1f; color: #ffd279; } .etq.rojo { background: #4a2229; color: #f4929f; }

.resumen { background: var(--panel); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; display: grid; gap: 10px; border: 1px solid var(--borde); }
.resumen-cab { display: flex; gap: 10px 16px; align-items: center; flex-wrap: wrap; }
.resumen-cab h3 { font-size: 16px; font-weight: 600; }
.resumen-cab .hora-act { font-size: 12.5px; color: var(--texto-3); }
.resumen-cab .der { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.resumen-texto { white-space: pre-wrap; line-height: 1.5; font-size: 14.5px; }
.chips-alerta { display: flex; gap: 6px; flex-wrap: wrap; }
.chips-alerta span { font-size: 12.5px; background: #3a3320; color: var(--alerta); border-radius: 8px; padding: 3px 9px; }
.resumen .pend { font-size: 13px; color: #8cc4f5; background: #172833; border-radius: 8px; padding: 7px 10px; }
.interruptor { display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; cursor: pointer; user-select: none; }
.interruptor input { display: none; }
.interruptor i { width: 38px; height: 22px; border-radius: 11px; background: #4a4d4d; position: relative; transition: background .15s; flex: none; }
.interruptor i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.interruptor input:checked + i { background: var(--acento); } .interruptor input:checked + i::after { transform: translateX(16px); }
.sub-p { font-size: 12px; color: var(--texto-3); margin-top: 2px; font-weight: 400; display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.bitacora { display: grid; gap: 8px; max-height: 60vh; overflow-y: auto; }
.accion { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; font-size: 13px; display: grid; gap: 3px; }
.accion .t { display: flex; gap: 8px; align-items: center; color: var(--texto-2); font-size: 12px; }
.accion .t b { color: var(--texto); font-weight: 600; font-size: 13px; } .accion .t .tok { margin-left: auto; }
.accion pre { white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; color: var(--texto-2); font-size: 12.5px; }
.accion.err { outline: 1px solid #7a2c37; } .accion.err .e { color: #f4929f; }
.sim hr { border: 0; border-top: 1px solid var(--borde); }
.sim .fila-b.sep { padding-top: 2px; }

@media (max-width: 760px) {
  .app { grid-template-rows: auto minmax(0, 1fr) 58px; }
  .banner-ia { grid-column: 1; grid-row: 1; padding: 6px 12px; font-size: 12.5px; }
  .vista { grid-column: 1; grid-row: 2; }
  .rail { grid-row: 3; grid-column: 1; }
  .ia-barra { padding: 6px 10px; flex-wrap: wrap; }
  .resumen-cab .der { margin-left: 0; }
  .sim { bottom: 68px; }
}
