/* ═══════════════════════════════════════════════════════════════
   Contacts page — funnel pills, table cells, form-validation error
   ═══════════════════════════════════════════════════════════════ */

.temp-pill {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 11px; font-weight: 700;
    text-transform: uppercase; letter-spacing: .03em;
}
.temp-pill--cold     { background: #E8F1FC; color: var(--blue-700); border-color: #C8DAF5; }
.temp-pill--warm     { background: var(--gold-100); color: var(--gold-600); border-color: #F0D890; }
.temp-pill--hot      { background: var(--red-100); color: var(--red-500); border-color: var(--red-border); }
.temp-pill--customer { background: var(--green-100); color: var(--green-500); border-color: var(--green-border); }

/* Contacts table cells */
.data-table .th, .data-table th.th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px; font-weight: 700;
    color: var(--gray-500);
    text-transform: uppercase; letter-spacing: .06em;
}
.data-table .th.right, .data-table th.right { text-align: right; }
.data-table .td, .data-table td.td {
    padding: 12px 14px;
    font-size: 13px;
    color: var(--gray-700);
}
.data-table .td.right, .data-table td.right { text-align: right; }

/* Avatar bubble used in name cell */
.grid-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue-700), var(--blue-500));
    color: #fff;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 12px;
    flex-shrink: 0;
}

/* Form-validation error message */
.field-error {
    color: var(--red-500);
    font-size: 11px;
    margin-top: 4px;
    display: block;
}

/* InputSelect inside svc-field looks like the rest of the form */
.svc-field__input select,
.svc-field__input .form-control {
    background: transparent;
    border: none;
    outline: none;
    color: var(--gray-800);
    font-size: 13px;
    flex: 1;
}

@keyframes crm-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* ── Barra de la lista de contactos (hallazgo móvil 16, 9-nov-2026) ──
   Escritorio y tableta: buscar, los filtros y «Solo nuevos» en una fila que se parte, y «Nuevo contacto» a la derecha.
   Teléfono: buscar a lo ancho; debajo «Filtros (n)» y «Nuevo contacto» lado a lado; los filtros se despliegan a lo ancho. */
.contacts-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 12px; }
.contacts-toolbar__search { flex: 1 1 220px; min-width: 200px; margin-bottom: 0; }
.contacts-toolbar__filters { display: contents; }
.contacts-toolbar__filter-list { display: contents; }
.contacts-toolbar__filter-list .form-control { flex: 0 0 170px; width: 170px; }
.contacts-toolbar__filter-list .contacts-only-new { white-space: nowrap; }
.contacts-toolbar__new { margin-left: auto; white-space: nowrap; }

@media (max-width: 600px) {
    .contacts-toolbar__search { flex: 1 1 100%; min-width: 0; }
    .contacts-toolbar__filters { display: block; flex: 1 1 0; min-width: 0; }
    .contacts-toolbar__filters .crm-collapsible__toggle { height: 44px; margin-bottom: 0; }
    .contacts-toolbar__new { flex: 1 1 0; margin-left: 0; min-height: 44px; padding-left: 12px; padding-right: 12px; }
    .contacts-toolbar__filters.crm-collapsible--open { flex: 1 1 100%; order: 2; }
    .contacts-toolbar__filters.crm-collapsible--open .crm-collapsible__toggle { margin-bottom: 8px; }
    .contacts-toolbar__filter-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
    .contacts-toolbar__filter-list .form-control { width: 100%; flex: none; }
    .contacts-toolbar__filter-list .contacts-only-new { grid-column: 1 / -1; justify-content: center; }
    .crm-collapsible:not(.crm-collapsible--open) .contacts-toolbar__filter-list { display: none; }
}

/* ── Lista de contactos en el teléfono (V02 staging, 9-nov-2026) ──
   En el iPhone la tabla seguía con sus columnas de escritorio: el nombre en tres líneas, el correo partido y el teléfono cortado al borde.
   Bajo 600 px cada contacto es una fila compacta: avatar y nombre; el correo; el teléfono (o «Sin teléfono»); y temperatura, estado del lead
   y las acciones en la última línea. Origen y alta quedan en la ficha. Escritorio y tableta no cambian. */
.contacts-table__icon, .contacts-table__none { display: none; }

@media (max-width: 600px) {
    .contacts-table, .contacts-table tbody { display: block; width: 100%; }
    .contacts-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .contacts-table tbody tr { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 14px; }
    .data-table.contacts-table .td { display: block; padding: 0; min-width: 0; text-align: left; overflow-wrap: anywhere; }
    .data-table.contacts-table .contacts-table__name { flex: 1 1 100%; }
    .data-table.contacts-table .contacts-table__email,
    .data-table.contacts-table .contacts-table__phone { flex: 1 1 100%; padding-left: 42px; color: var(--gray-700); }
    .data-table.contacts-table .contacts-table__source,
    .data-table.contacts-table .contacts-table__created { display: none; }
    .data-table.contacts-table .contacts-table__temp { flex: 0 0 auto; padding-left: 42px; }
    .data-table.contacts-table .contacts-table__status { flex: 0 1 auto; }
    .data-table.contacts-table .contacts-table__actions { flex: 0 0 auto; margin-left: auto; }
    .contacts-table__actions .comms-btn { min-width: 44px; justify-content: center; }
    .contacts-table__icon { display: inline-block; margin-right: 6px; color: var(--gray-500); }
    .contacts-table__dash { display: none; }
    .contacts-table__none { display: inline; color: var(--gray-500); }
    /* Un campo vacío no se dibuja en el teléfono: ni «—» bajo el nombre (sin empresa) ni junto a la temperatura (sin estado del lead). */
    .data-table.contacts-table .contacts-table__status--empty { display: none; }
}
