/* Estética PNQ (la misma base que el backoffice) + bandeja de conversaciones */
:root {
  --hu-azul: #004687;
  --hu-azul-2: #1E73BE;
  --hu-azul-texto: #002060;
  --hu-celeste: #dee9f6;
  --tinta: #212529;
  --linea: #e3e7ec;
  --fondo: #f4f6f8;
  --verde-ok: #1a9d5b;
  --ambar: #b57200;
  --rojo: #c0392b;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: Calibri, "Segoe UI", Arial, sans-serif; background: var(--fondo); color: var(--tinta); }

.pnq { max-width: 1600px; margin: 18px auto 50px; background: #fff; box-shadow: 0 0 14px rgba(0, 40, 80, .14); }
.pnq-head { display: flex; border: 1px solid #000; }
.pnq-head .brand { width: 60%; padding: 10px 4%; border-right: 1px solid #000; display: flex; align-items: baseline; gap: 6px; }
.pnq-head .humi { font-family: "Arial Black", Arial, sans-serif; font-weight: 900; font-style: italic; font-size: 38px; color: var(--hu-azul); line-height: 1; }
.pnq-head .pnq-script { font-family: "Segoe Script", "Brush Script MT", cursive; font-size: 32px; color: #9dc3e6; line-height: 1; }
.pnq-head .right { flex: 1; display: grid; place-items: center; padding: 8px; }
.pnq-head .interno { font-size: 13px; font-weight: 700; color: #fff; background: var(--hu-azul); padding: 4px 10px; border-radius: 3px; }
.pnq-sub { display: flex; align-items: center; background: var(--hu-celeste); border: 1px solid #000; border-top: none; }
.pnq-sub .cell { padding: 8px 14px; font-size: 16px; color: var(--hu-azul-texto); border-right: 1px solid #000; }
.pnq-sub .cell:last-child { border-right: none; }
.pnq-sub .grow { flex: 1; }
.pnq-menu { background: #f6f7f8; border-bottom: 1px solid #ddd; padding: 0 18px; display: flex; gap: 4px; align-items: stretch; font-size: 14px; }
.pnq-menu a { color: #444; text-decoration: none; padding: 9px 14px; border-bottom: 3px solid transparent; }
.pnq-menu a.on { color: var(--hu-azul); font-weight: 700; border-bottom-color: var(--hu-azul-2); }
.pnq-menu a:hover { color: var(--hu-azul); }
.pnq-menu .sep { flex: 1; }

.pnq-body { padding: 14px 18px 26px; }
.pnq-title { display: inline-block; font-size: 27px; color: var(--hu-azul-2); font-weight: 600; background: linear-gradient(90deg, #b5e061 0%, #f5d63d 100%); padding: 1px 10px 3px 2px; margin: 8px 0 14px; line-height: 1.15; }
.seccion { font-size: 17px; color: var(--hu-azul-texto); margin: 22px 0 8px; }
.seccion small { font-weight: 400; color: #667; font-size: 13px; margin-left: 6px; }

.pnq-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 4px 0 14px; }
.pnq-kpi { border: 1px solid #b9cbe0; }
.pnq-kpi .k { background: var(--hu-celeste); color: var(--hu-azul-texto); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 6px 10px; border-bottom: 1px solid #b9cbe0; }
.pnq-kpi .v { font-size: 30px; font-weight: 700; color: var(--hu-azul-texto); padding: 8px 10px 2px; line-height: 1; }
.pnq-kpi .f { font-size: 12px; color: #667; padding: 0 10px 9px; }
.pnq-kpi.alerta .v { color: var(--ambar); }

.pnq-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; margin-bottom: 10px; }
.pnq-controls label { font-weight: 700; color: #333; }
select, input { font: inherit; font-size: 13.5px; padding: 5px 8px; border: 1px solid #aaa; border-radius: 3px; background: #fff; }
.pnq-controls .buscar { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.pnq-controls .buscar input { min-width: 220px; }

.pnq-btn { font: inherit; font-size: 14px; font-weight: 600; color: #fff; border: 2px solid transparent; border-radius: 5px; padding: 6px 14px; cursor: pointer; text-decoration: none; display: inline-block; white-space: nowrap; }
.pnq-btn.azul { background: var(--hu-azul-2); border-color: #185f9e; }
.pnq-btn.cian { background: #5bc0de; border-color: #31b0d5; }
.pnq-btn.gris { background: #8f99a3; border-color: #7a848e; }
.pnq-btn:hover { filter: brightness(.95); }

.pnq-scroll { overflow-x: auto; border: 1px solid #cfcfcf; }
table.pnq-tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.pnq-tbl thead th { background: #8f8f8f; color: #fff; font-weight: 700; font-size: 12px; padding: 8px 9px; text-align: left; border: 1px solid #7d7d7d; white-space: nowrap; }
.pnq-tbl tbody td { padding: 7px 9px; border: 1px solid #dcdcdc; vertical-align: middle; }
.pnq-tbl tbody tr:nth-child(even) { background: #f6f8fa; }
.pnq-tbl tbody tr.fila-enlace { cursor: pointer; }
.pnq-tbl tbody tr:hover { background: #eaf3fb; }
.pnq-tbl tr.inactivo td { color: #999; }
.pnq-tbl .vacio { text-align: center; padding: 22px; color: #667; }
.pnq-tbl .barra { width: 160px; }
.pnq-tbl progress { width: 150px; height: 10px; }
.nw { white-space: nowrap; }
.mono, .cod, .tagchip { font-family: ui-monospace, Consolas, monospace; }
.cod { font-size: 12px; font-weight: 600; color: var(--hu-azul); white-space: nowrap; text-decoration: none; }
.tagchip { font-size: 11.5px; font-weight: 700; background: #eef2f6; padding: 2px 6px; border-radius: 4px; white-space: nowrap; }
.est { font-weight: 600; }
.est.p-pend { color: #96551a; }
.est.p-prep { color: #1a6b3c; }
.est.p-real { color: #10538f; }
.flag { color: var(--ambar); font-weight: 700; font-size: 12px; }
.canal { display: inline-block; color: #fff; font-size: 10px; font-weight: 800; border-radius: 3px; padding: 1px 4px; margin-left: 5px; vertical-align: 1px; }
.canal.whatsapp { background: #25d366; }
.canal.telegram { background: #2aa3df; }
.cico { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 800; border: 2px solid rgba(0, 0, 0, .15); text-decoration: none; }
.cico.azul { background: var(--hu-azul-2); }
.cico.gris { background: #b9c2cb; }
.lnk { color: var(--hu-azul-2); text-decoration: none; white-space: nowrap; }
.lnk:hover { text-decoration: underline; }
.gris { color: #999; }
.pnq-note { font-size: 12.5px; color: #667; margin-top: 10px; line-height: 1.5; }

.aviso { border-radius: 5px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }
.aviso.ok { background: #e8f6ee; border: 1px solid #9fd8b6; color: #145c34; }
.aviso.error { background: #fdecea; border: 1px solid #f1b0a8; color: #8a1f14; }
.aviso.info { background: #fff8ea; border: 1px solid #f3d9a0; }
.aviso a { color: #7a5200; font-weight: 700; text-decoration: none; }

.en-linea { display: flex; gap: 6px; align-items: center; }
.en-linea select { max-width: 230px; }
.en-linea input { width: 140px; }
.formulario { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; font-size: 14px; }
.formulario label { display: flex; flex-direction: column; gap: 4px; font-weight: 700; color: #333; }

.dhead { background: var(--hu-azul); color: #fff; padding: 18px 22px; margin-top: 8px; }
.dhead .c { font-family: ui-monospace, Consolas, monospace; font-size: 16px; font-weight: 700; }
.dhead .t { font-size: 14px; opacity: .85; margin-top: 3px; }
.detalle { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); border: 1px solid var(--linea); border-top: none; }
.dsec { padding: 16px 22px; border-bottom: 1px solid var(--linea); }
.dsec h5 { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hu-azul-texto); background: var(--hu-celeste); margin: -16px -22px 12px; padding: 7px 22px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 7px 14px; font-size: 14px; }
.kv .k { color: #667; }
.pre { white-space: pre-wrap; }
.med { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.med th { font-size: 11.5px; text-transform: uppercase; color: #667; text-align: left; padding: 0 8px 7px 0; }
.med td { padding: 7px 8px 7px 0; border-top: 1px solid #eef1f4; }
.dl { color: var(--hu-azul); font-weight: 600; font-size: 13px; text-decoration: none; border: 1px solid #b9cbe0; padding: 4px 10px; border-radius: 4px; }

@media (max-width: 980px) {
  .pnq-kpis { grid-template-columns: repeat(2, 1fr); }
  .pnq-head .humi { font-size: 28px; }
  .pnq-controls .buscar { margin-left: 0; }
}


.pnq-head .titulo-app { font-size: 17px; font-weight: 700; color: var(--hu-azul-texto); }
.enlace { background: none; border: none; color: var(--hu-azul-2); font: inherit; font-size: 15px; cursor: pointer; }
.enlace:hover { text-decoration: underline; }
.pnq-btn.verde { background: var(--verde-ok); border-color: #147a47; }
.aviso.neutro { background: #f4f6f8; border: 1px solid #d9dfe6; color: #445; }

/* Acceso */
.entrar { max-width: 380px; margin: 30px auto 40px; }
.formulario.columna { flex-direction: column; align-items: stretch; margin-top: 14px; }
.formulario.columna input { font-size: 15px; padding: 8px 10px; }
.formulario.columna .pnq-btn { margin-top: 6px; padding: 9px; font-size: 15px; }

/* Lista */
.pestanas { display: flex; gap: 6px; border-bottom: 2px solid var(--linea); margin-bottom: 12px; }
.pestanas a { text-decoration: none; color: #445; padding: 8px 14px; font-size: 15px; border-bottom: 3px solid transparent; margin-bottom: -2px; }
.pestanas a.on { color: var(--hu-azul); font-weight: 700; border-bottom-color: var(--hu-azul-2); }
.pestanas .n { display: inline-block; min-width: 22px; text-align: center; font-size: 12px; font-weight: 700; background: #e3e9f0; border-radius: 10px; padding: 1px 6px; }
.pestanas a:first-child .n { background: var(--ambar); color: #fff; }
.lista-conv { display: flex; flex-direction: column; border: 1px solid var(--linea); }
.conv { display: grid; grid-template-columns: minmax(200px, 1.1fr) 2fr auto; gap: 16px; align-items: center; padding: 12px 16px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--linea); }
.conv:last-child { border-bottom: none; }
.conv:hover { background: #eaf3fb; }
.conv.ayuda { background: #fff8ea; border-left: 4px solid var(--ambar); }
.conv .quien b { font-size: 15px; }
.conv .sub { font-size: 12.5px; color: #667; margin-top: 2px; }
.conv .ultimo { font-size: 13.5px; color: #445; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv .derecha { text-align: right; }
.lista-conv .vacio { padding: 30px; text-align: center; color: #667; font-size: 15px; }
.estado { display: inline-block; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 12px; white-space: nowrap; }
.estado.ayuda { background: var(--ambar); color: #fff; }
.estado.atiende { background: var(--hu-azul-2); color: #fff; }
.estado.bot { background: #e3e9f0; color: #445; }
.canal { font-size: 10.5px; padding: 1px 6px; }

/* Conversación */
.conv-cab { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin: 4px 0 12px; }
.conv-cab h1 { font-size: 24px; color: var(--hu-azul-texto); margin: 6px 0 4px; }
.conv-cuerpo { display: grid; grid-template-columns: 1fr 320px; gap: 18px; align-items: start; }
.chat-col { min-width: 0; }
.chat { border: 1px solid var(--linea); background: #f7f9fb; height: 58vh; min-height: 360px; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.anteriores { align-self: center; font-size: 13px; color: var(--hu-azul-2); margin-bottom: 6px; }
.msg { max-width: 78%; padding: 7px 11px 8px; border-radius: 10px; font-size: 14px; line-height: 1.4; }
.msg .cab-msg { font-size: 11.5px; color: #667; margin-bottom: 2px; }
.msg .texto { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.operario { align-self: flex-start; background: #fff; border: 1px solid #dde3ea; }
.msg.asistente { align-self: flex-end; background: #e8eef6; }
.msg.equipo { align-self: flex-end; background: #d6e7fb; border: 1px solid #b9d3f2; }
.msg.nota { align-self: flex-end; background: #fff4cc; border: 1px solid #f1de94; }
.msg.sistema { align-self: center; background: none; font-size: 12px; color: #778; padding: 0; }
.msg .botones { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.msg .botones span { font-size: 12px; background: #fff; border: 1px solid #c5d3e3; border-radius: 12px; padding: 1px 8px; color: #445; }
.msg .adjunto { display: inline-block; margin-top: 4px; color: var(--hu-azul); font-weight: 600; text-decoration: none; }
.msg .adjunto small { color: #667; font-weight: 400; }
.msg .miniatura { display: block; max-width: 240px; max-height: 240px; margin-top: 4px; border-radius: 6px; }
.nuevos { background: #fff8ea; border: 1px solid #f3d9a0; border-top: none; padding: 6px 12px; font-size: 13.5px; }
.responder { margin-top: 10px; }
.responder textarea { width: 100%; font: inherit; font-size: 14.5px; padding: 9px 11px; border: 1px solid #aaa; border-radius: 4px; resize: vertical; }
.responder .fila { display: flex; gap: 8px; justify-content: flex-end; align-items: center; margin-top: 6px; }
.responder .fila .pnq-note { margin: 0 auto 0 0; }
.contexto { border: 1px solid var(--linea); }
.contexto section { padding: 12px 14px; border-bottom: 1px solid var(--linea); }
.contexto section:last-child { border-bottom: none; }
.contexto h5 { font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--hu-azul-texto); background: var(--hu-celeste); margin: -12px -14px 10px; padding: 6px 14px; }
.contexto .kv { grid-template-columns: 96px 1fr; font-size: 13.5px; gap: 5px 10px; }
.contexto .registros { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.contexto .registros small { color: #667; }
.err { color: var(--rojo); }

@media (max-width: 900px) {
  .pnq { margin: 0; }
  .conv { grid-template-columns: 1fr; gap: 4px; }
  .conv .derecha { text-align: left; }
  .conv-cuerpo { grid-template-columns: 1fr; }
  .chat { height: 50vh; }
  .msg { max-width: 92%; }
  .pnq-head .brand { width: auto; }
}
