/* Pipeline ordenado (diseño aprobado por JM): encabezado en una línea, tres números, una fila de filtros, columnas de
   trabajo sin scroll lateral en 1440 px, franja de cierre a la derecha y tarjeta compacta con un solo código de color.
   Se carga después de pipeline.css y onboarding.css y solo actúa dentro de .tablero-ordenado y de la vista rápida.
   CSP del dashboard: sin estilos en línea; todo va por clases. */

.tablero-ordenado {
  --po-fondo: #fafaf8;
  --po-col: #f3f2ee;
  --po-borde: #e7e5e0;
  --po-tinta: #18181b;
  --po-gris: #5f5f66;
  --po-acento: #4b2e83;
  --po-rojo-bg: #fee4e2;
  --po-rojo-fg: #b42318;
  --po-ambar-bg: #fef0c7;
  --po-ambar-fg: #93370d;
  --po-neutro-bg: #f1f0ec;
  --po-neutro-fg: #3f3f46;
  --pipe-radio-col: 14px;
  --pipe-radio-card: 10px;
  color: var(--po-tinta);
}

body:has(.tablero-ordenado:not([hidden])) {
  background: #fafaf8;
}

/* ---------- Encabezado ---------- */

.tablero-ordenado .phead {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding-block: 24px 12px;
}

.phead-titulo {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.phead-titulo .page-title {
  margin: 0;
}

/* El manual pasa de banner a un «?» al lado del título. */
.tablero-ordenado .pipeline-manual {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--po-borde);
  border-radius: 50%;
  background: #fff;
  color: var(--po-tinta);
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
}

.tablero-ordenado .pipeline-manual:hover,
.tablero-ordenado .pipeline-manual:focus-visible {
  border-color: var(--po-acento);
  background: #f4effb;
  color: var(--po-acento);
}

.phead-buscar {
  flex: 1 1 280px;
  max-width: 440px;
  margin-left: auto;
}

.phead-buscar input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--po-borde);
  border-radius: 10px;
  background: #fff;
}

.tablero-ordenado .dash-head-acciones {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tablero-ordenado .phead-nuevo {
  min-height: 44px;
  padding-inline: 16px;
  border: 1px solid #18181b;
  border-radius: 10px;
  background: #18181b;
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}

.tablero-ordenado .phead-nuevo:hover {
  background: #2e2e33;
}

.pmenu {
  position: relative;
}

.tablero-ordenado .pmenu-btn {
  width: 44px;
  min-width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--po-borde);
  border-radius: 10px;
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.pmenu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: grid;
  min-width: 248px;
  padding: 6px;
  border: 1px solid var(--po-borde);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 10px 30px rgb(24 24 27 / 0.12);
}

.pmenu-panel[hidden] {
  display: none;
}

.pmenu-item {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--po-tinta);
  font: inherit;
  font-size: 14px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.pmenu-item[hidden] {
  display: none;
}

.pmenu-item:hover,
.pmenu-item:focus-visible {
  background: var(--po-col);
}

.pmenu-item[aria-disabled="true"] {
  color: var(--po-gris);
}

.pmenu-item#sonido[aria-pressed="true"]::after {
  content: "Encendido";
  margin-left: auto;
  color: var(--po-gris);
  font-size: 12px;
}

.pmenu-item#sonido[aria-pressed="false"]::after {
  content: "Apagado";
  margin-left: auto;
  color: var(--po-gris);
  font-size: 12px;
}

.pmenu-vista {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 44px;
  padding: 4px 12px;
}

.pmenu-vista[hidden],
.pmenu-vista:has(.segmento[hidden]) {
  display: none;
}

.pmenu-etiqueta {
  font-size: 14px;
}

.tablero-ordenado .dash-sub {
  margin: 0 0 8px;
}

.tablero-ordenado .dash-sub[hidden] {
  display: none;
}

/* ---------- Tres números ---------- */

.pnumeros {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.pnumeros[hidden] {
  display: none;
}

.pnumero {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-height: 64px;
  padding: 12px 18px;
  border: 1px solid var(--po-borde);
  border-radius: 14px;
  background: #fff;
  color: var(--po-tinta);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.pnumero-n {
  font-size: 30px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.pnumero-t {
  font-size: 14px;
}

.pnumero.is-rojo {
  border-color: #fecdca;
  background: #fef3f2;
  color: var(--po-rojo-fg);
}

.pnumero.is-ambar {
  border-color: #fedf89;
  background: #fffaeb;
  color: var(--po-ambar-fg);
}

.pnumero[aria-pressed="true"] {
  outline: 2px solid currentColor;
  outline-offset: -2px;
}

.pnumero:hover {
  border-color: currentColor;
}

/* ---------- Filtros: una fila ---------- */

.tablero-ordenado .filters {
  margin-bottom: 12px;
}

.tablero-ordenado .fbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  overflow: visible;
}

.tablero-ordenado .fbar select,
.tablero-ordenado .fbar .seg,
.tablero-ordenado .fbar .pill,
.tablero-ordenado .fbar .pselect {
  min-height: 40px;
}

.tablero-ordenado .fstrip {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 12px;
  overflow: visible;
  border: 1px solid var(--po-borde);
  border-radius: 12px;
  background: #fff;
}

.tablero-ordenado .fstrip[hidden] {
  display: none;
}

.tablero-ordenado .results:not(.sr-only) {
  margin: 0 0 8px;
  color: var(--po-gris);
  font-size: 12px;
}

/* ---------- Tablero ---------- */

.kanban.kanban-ordenado {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  grid-auto-flow: unset;
  overflow-x: auto;
  scroll-snap-type: none;
}

.col.col-ordenada {
  flex: 1 1 0;
  min-width: 170px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: var(--po-col);
}

.col-ordenada .col-head {
  padding: 12px 12px 4px;
}

.col-ordenada .col-head-row {
  align-items: flex-start;
}

.col-ordenada .col-title,
.zona-cierre .col-title {
  display: -webkit-box;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: anywhere;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.col-ordenada .col-count {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #fff;
  color: var(--po-neutro-fg);
  font-size: 12px;
  font-weight: 600;
}

.col-ordenada .col-list {
  gap: 8px;
  min-height: 44px;
  padding: 6px 8px 10px;
}

/* Columna vacía: angosta, con el nombre en vertical; sigue siendo destino para soltar. */
.col.col-ordenada.col-vacia {
  flex: 0 0 56px;
  min-width: 56px;
}

.col-vacia .col-head-row {
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.col-vacia .col-title {
  display: block;
  max-height: 220px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.col-vacia .col-count {
  margin-left: 0;
}

.col-vacia .col-list {
  padding-inline: 4px;
}

.col-vacia .col-empty {
  font-size: 11px;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.col-mas-li {
  list-style: none;
}

.col-ordenada .col-more {
  width: 100%;
  min-height: 36px;
  border: 1px dashed #d6d3cc;
  border-radius: 10px;
  background: transparent;
  color: var(--po-tinta);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
}

.col-ordenada .col-more:hover {
  background: #fff;
}

/* ---------- Franja de cierre ---------- */

.kanban-cierre {
  position: sticky;
  right: 0;
  z-index: 2;
  display: flex;
  flex: 0 0 140px;
  flex-direction: column;
  gap: 8px;
  padding-left: 4px;
  background: var(--po-fondo);
}

.col.zona-cierre {
  display: grid;
  gap: 2px;
  min-height: 92px;
  padding: 10px 12px;
  border: 1.5px dashed #d4d4d8;
  border-radius: 12px;
  background: #f7f7f8;
  color: var(--po-neutro-fg);
}

.zona-cierre.is-ganado {
  border-color: #75e0a7;
  background: #f0fbf4;
  color: #067647;
}

.zona-cierre.is-perdido {
  border-color: #fda29b;
  background: #fef6f5;
  color: var(--po-rojo-fg);
}

.zona-cab {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 6px;
}

.zona-cierre .col-count {
  color: inherit;
  font-size: 16px;
  font-weight: 650;
}

.zona-ayuda {
  margin: 0;
  font-size: 11px;
  opacity: 0.85;
}

.zona-cierre .zona-link {
  justify-self: start;
  color: inherit;
  font-size: 12px;
}

.zona-cierre.can-drop {
  border-width: 2px;
}

.zona-cierre.is-over {
  border-style: solid;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}

/* ---------- Tarjeta compacta ---------- */

.card.pcard {
  position: relative;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--po-borde);
  border-radius: 10px;
  background: #fff;
  box-shadow: none;
  color: var(--po-tinta);
  font-size: 13px;
  line-height: 1.4;
}

.card.pcard:hover {
  border-color: #cfccc4;
  box-shadow: 0 1px 2px rgb(24 24 27 / 0.06);
}

.card.pcard .card-name {
  display: block;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  padding: 0 28px 0 0;
  color: var(--po-tinta);
  font-size: 14px;
  font-weight: 650;
  line-height: 1.3;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.pcard .card-contacto {
  margin: 0;
  overflow: hidden;
  color: var(--po-gris);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Chip y próximo paso fluyen como texto: en columnas angostas el paso baja de línea; máximo 2 líneas. */
.pcard .card-proxima {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow-wrap: normal;
  word-break: normal;
  margin: 4px 0 0;
  padding: 0;
  border: 0;
  font-size: 12px;
  line-height: 1.45;
}

.pcard .card-proxima span {
  display: inline;
}

.pcard .card-paso {
  color: var(--po-tinta);
  font-weight: 400;
}

.pcard .card-proxima .fchip {
  display: inline;
  margin-right: 2px;
  padding: 1px 7px;
}

.fchip {
  display: inline-flex;
  flex: none;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  line-height: 1.6;
  white-space: nowrap;
}

.fchip.is-rojo {
  background: #fee4e2;
  color: #b42318;
}

.fchip.is-ambar {
  background: #fef0c7;
  color: #93370d;
}

.fchip.is-gris {
  background: #f1f0ec;
  color: #3f3f46;
}

.pcard .card-spam {
  margin: 2px 0 0;
  color: var(--po-neutro-fg);
  font-size: 11px;
}

.pcard .card-pie {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  margin-top: 6px;
  color: var(--po-tinta);
}

.pcard .card-valor {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pcard .card-valor.is-vacio {
  color: var(--po-gris);
  font-weight: 400;
}

.pcard .card-unidad {
  color: var(--po-gris);
  font-size: 11px;
  font-weight: 400;
}

.card-origen {
  flex: none;
  padding: 0 6px;
  border-radius: 6px;
  background: #efeaf7;
  color: #4b2e83;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
}

.pcard .card-resp.av {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: 26px;
  height: 26px;
  margin-left: auto;
  border-radius: 50%;
  color: #fff;
  font-size: 11px;
  font-weight: 650;
}

.pcard .card-resp.av.is-vacio {
  background: #e4e4e7;
  color: #3f3f46;
}

/* Menú ⋯ de la tarjeta (mover, cambiar pipeline, eliminar): arriba a la derecha. */
.pcard .card-foot.card-mas {
  position: absolute;
  top: 6px;
  right: 6px;
  bottom: auto;
  z-index: 3;
  display: block;
  width: auto;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  opacity: 1;
}

.pcard .card-mas > summary {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  color: var(--po-gris);
  font-size: 16px;
  line-height: 1;
}

.pcard .card-mas > summary:hover,
.pcard .card-mas[open] > summary {
  background: var(--po-col);
  color: var(--po-tinta);
}

.pcard .card-mas-menu {
  top: calc(100% + 4px);
  right: 0;
  bottom: auto;
  z-index: 5;
  gap: 8px;
  min-width: 180px;
  border-radius: 10px;
}

.pcard .card-mas-menu .move-select {
  width: 100%;
}

.pcard .card-mas-menu .is-peligro {
  color: #b42318;
}

@media (hover: hover) and (pointer: fine) {
  .pcard .card-foot.card-mas {
    opacity: 0;
  }

  .pcard:hover .card-foot.card-mas,
  .pcard:focus-within .card-foot.card-mas,
  .pcard .card-foot.card-mas[open] {
    opacity: 1;
  }
}

@media (pointer: coarse) {
  .pcard .card-mas > summary {
    width: 44px;
    height: 44px;
  }

  .pcard .card-name {
    padding-right: 44px;
  }

  .col-ordenada .col-more {
    min-height: 44px;
  }

  .tablero-ordenado .pipeline-manual {
    width: 44px;
    height: 44px;
  }
}

/* ---------- Vista rápida: panel lateral derecho ---------- */

.dialog:has(.vr) {
  width: min(520px, 100vw);
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-left: 1px solid #e7e5e0;
  background: #fff;
}

.vr {
  color: #18181b;
}

.vr-cab {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
  border-bottom: 1px solid #efede8;
  background: #fff;
}

.vr-cab h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}

.vr-contacto {
  margin: 4px 0 0;
  color: #5f5f66;
  font-size: 13px;
}

.vr-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0 0;
}

.vr-chip {
  padding: 1px 8px;
  border-radius: 999px;
  background: #f1f0ec;
  color: #3f3f46;
  font-size: 12px;
  line-height: 1.7;
}

.vr-chip.is-explee {
  background: #efeaf7;
  color: #4b2e83;
}

.vr .cliente-rapido-cerrar {
  width: 44px;
  height: 44px;
  border-color: #e7e5e0;
}

.vr-etapas {
  display: flex;
  gap: 4px;
  margin: 0;
  padding: 14px 24px;
  list-style: none;
  border-bottom: 1px solid #efede8;
}

.vr-etapas li {
  flex: 1 1 0;
  min-width: 0;
  padding-top: 8px;
  border-top: 4px solid #e7e5e0;
  color: #5f5f66;
  font-size: 11px;
  line-height: 1.3;
}

.vr-etapas li.is-hecha {
  border-top-color: #b9a6d9;
}

.vr-etapas li.is-actual {
  border-top-color: #4b2e83;
  color: #18181b;
  font-weight: 650;
}

.vr-etapa-nombre {
  display: -webkit-box;
  overflow: hidden;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.vr-ahora {
  margin: 16px 24px;
  padding: 16px;
  border: 1px solid #e7e5e0;
  border-radius: 12px;
  background: #fafaf8;
}

.vr-sec-titulo {
  margin: 0 0 8px;
  color: #5f5f66;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.vr-ahora-tarea {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.vr-ahora-meta,
.vr-meta {
  margin: 4px 0 0;
  color: #5f5f66;
  font-size: 12px;
}

.vr-ahora-botones {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.vr-ahora-botones .btn {
  min-height: 44px;
  border-radius: 10px;
}

.vr-ahora-botones .btn:not(.btn-quiet) {
  border-color: #18181b;
  background: #18181b;
  color: #fff;
}

.vr-ahora-zona:not(:empty) {
  margin-top: 12px;
  border-top: 1px solid #e7e5e0;
}

.vr-ahora-zona .cliente-rapido-form {
  padding: 14px 0 0;
}

.vr-mover {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 12px;
}

.vr-mover select {
  flex: 1 1 180px;
  min-height: 44px;
}

.vr-ahora-mas {
  margin: 12px 0 0;
  color: #5f5f66;
  font-size: 12px;
}

.vr-ahora-mas .link-btn {
  font-size: 12px;
}

.vr-sec {
  padding: 14px 24px;
  border-top: 1px solid #efede8;
}

.vr-sec[hidden] {
  display: none;
}

.vr-dijo {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.vr-cuerpo p {
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
}

.vr-cuerpo .vr-meta {
  font-size: 12px;
}

.vr-borrador {
  padding: 12px;
  border: 1px solid #e7e5e0;
  border-radius: 10px;
  background: #fafaf8;
  white-space: pre-wrap;
}

.vr-copiar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.vr-datos {
  display: grid;
  gap: 6px;
  margin: 0;
}

.vr-dato {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 8px;
  font-size: 14px;
}

.vr-dato dt {
  color: #5f5f66;
}

.vr-dato dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.vr-agregar {
  color: #4b2e83;
  font-weight: 600;
  text-decoration: none;
}

.vr-actividad {
  border-top: 1px solid #efede8;
}

.vr-actividad > summary {
  min-height: 44px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.vr .cliente-rapido-pie {
  padding: 14px 24px 22px;
}

/* ---------- Teléfono ---------- */

@media (max-width: 760px) {
  .pnumeros {
    grid-template-columns: 1fr;
  }

  .phead-buscar {
    flex: 1 1 100%;
    max-width: none;
    order: 3;
    margin-left: 0;
  }

  .tablero-ordenado .dash-head-acciones {
    margin-left: auto;
  }

  .col.col-ordenada {
    flex: 0 0 78vw;
    min-width: 0;
  }

  .kanban-cierre {
    position: static;
    flex: 0 0 60vw;
  }

  .dialog:has(.vr) {
    width: 100vw;
  }

  .vr-cab,
  .vr-etapas,
  .vr-sec,
  .vr-actividad > summary,
  .vr .cliente-rapido-pie {
    padding-inline: 16px;
  }

  .vr-ahora {
    margin-inline: 16px;
  }
}

/* ---------- Prospección (0071): resumen a la izquierda del tablero y puerta de entrada al pipeline ---------- */

.col-prospeccion {
  display: grid;
  flex: 0 0 168px;
  gap: 6px;
  align-content: start;
  padding: 12px;
  border: 1.5px dashed #d4d4d8;
  border-radius: 14px;
  background: #fff;
  color: var(--po-neutro-fg);
}

.col-prospeccion-t {
  margin: 0;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.col-prospeccion-n {
  margin: 0;
  color: var(--ink, #16141a);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.col-prospeccion-ayuda {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.col-prospeccion-filas {
  margin: 4px 0;
}

.col-prospeccion-filas > div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid #e4e4e7;
  font-size: 13px;
}

.col-prospeccion-filas dt {
  min-width: 0;
  overflow-wrap: anywhere;
}

.col-prospeccion-filas dd {
  margin: 0;
  color: var(--ink, #16141a);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.col-prospeccion-filas .is-rojo dt,
.col-prospeccion-filas .is-rojo dd {
  color: var(--po-rojo-fg);
  font-weight: 650;
}

.col-prospeccion .zona-link {
  justify-self: start;
  font-size: 13px;
}

.zona-cierre.is-pipeline {
  border-color: #16141a;
  background: #fff;
  color: #16141a;
}

@media (max-width: 760px) {
  .col-prospeccion {
    flex: 0 0 60vw;
  }
}

/* Prospección (13-nov-2026): qué hace la IA y qué le toca a una persona. */
.col-prospeccion-filas .col-prospeccion-sep {
  margin-top: 6px;
  border-top: 2px solid #d4d4d8;
}

.pcard .card-auto {
  margin: 2px 0 0;
  color: #1d4ed8;
  font-size: 11px;
}
