/* MotoLead · panel de Nestor Motos. Paleta del logo: naranja #F05000, negro #201818, plata #E0E0E8. */
:root {
  --naranja: #f05000;
  --naranja-oscuro: #c84200;
  --negro: #201818;
  --plata: #e0e0e8;
  --fondo: #f4f4f6;
  --blanco: #ffffff;
  --texto: #201818;
  --texto-suave: #6b6570;
  --borde: #d9d9e0;
  --verde: #1f8a4c;
  --rojo: #c62828;
  --radio: 10px;
  --sombra: 0 1px 3px rgba(32, 24, 24, 0.08), 0 4px 14px rgba(32, 24, 24, 0.05);
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; background: var(--fondo); color: var(--texto); line-height: 1.45; }
a { color: var(--naranja-oscuro); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .5rem; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; color: var(--texto); }

/* Barra superior */
.barra { display: flex; align-items: center; gap: 1.5rem; padding: .55rem 1.25rem; background: var(--negro); color: var(--plata); box-shadow: var(--sombra); position: sticky; top: 0; z-index: 10; }
.barra .marca img { height: 34px; display: block; }
.nav { display: flex; gap: .25rem; }
.nav a { color: var(--plata); padding: .4rem .8rem; border-radius: 999px; font-weight: 600; }
.nav a:hover { background: rgba(255,255,255,.08); text-decoration: none; }
.nav a.activo { background: var(--naranja); color: #fff; }
.quien { margin-left: auto; display: flex; align-items: center; gap: .75rem; font-size: .95rem; }
.quien form { margin: 0; }

.contenido { max-width: 1200px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }
.pie { text-align: center; color: var(--texto-suave); font-size: .8rem; padding: 1rem; }
.volver { margin: 0 0 .75rem; }

/* Tarjetas y formularios */
.tarjeta { background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.tarjeta.angosta { max-width: 420px; margin: 3rem auto; }
.tarjeta.destacada { border-left: 5px solid var(--naranja); }
.tarjeta.vacio { color: var(--texto-suave); text-align: center; padding: 2.5rem 1rem; }
.formulario { display: flex; flex-direction: column; gap: .8rem; }
.formulario label { display: flex; flex-direction: column; gap: .3rem; font-weight: 600; font-size: .9rem; }
input, select, textarea { font: inherit; padding: .55rem .7rem; border: 1px solid var(--borde); border-radius: 8px; background: #fff; color: var(--texto); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--naranja); outline-offset: 1px; border-color: var(--naranja); }
textarea { resize: vertical; }
.enlace { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; }
.nota { color: var(--texto-suave); font-size: .85rem; }
.error { color: var(--rojo); background: #fdecea; padding: .5rem .75rem; border-radius: 8px; }
.aviso { background: #fff4ec; border: 1px solid #f8c9ae; color: var(--naranja-oscuro); padding: .6rem .9rem; border-radius: 8px; margin-bottom: 1rem; }
.en-linea { display: inline-flex; gap: .5rem; align-items: center; margin: .25rem 0; }
.en-linea label { display: inline-flex; gap: .5rem; align-items: center; font-size: .9rem; }

/* Botones */
.boton { display: inline-block; font: inherit; font-weight: 700; padding: .6rem 1.1rem; border-radius: 8px; border: 2px solid var(--naranja); background: var(--naranja); color: #fff; cursor: pointer; text-decoration: none; }
.boton:hover { background: var(--naranja-oscuro); border-color: var(--naranja-oscuro); text-decoration: none; }
.boton.fantasma { background: transparent; color: var(--naranja-oscuro); }
.boton.fantasma:hover { background: #fff1ea; }
.barra .boton.fantasma { color: var(--plata); border-color: rgba(255,255,255,.35); }
.barra .boton.fantasma:hover { background: rgba(255,255,255,.08); }
.boton.chico { padding: .35rem .75rem; font-size: .85rem; }
.boton.verde { background: var(--verde); border-color: var(--verde); }
.boton.verde:hover { background: #176c3b; border-color: #176c3b; }
.botonera { display: flex; flex-wrap: wrap; gap: .6rem; margin: .9rem 0 .5rem; }
.botonera form { margin: 0; }

/* Chips de estado */
.chip { display: inline-block; font: inherit; font-size: .8rem; font-weight: 700; padding: .25rem .65rem; border-radius: 999px; border: 2px solid transparent; background: var(--plata); color: var(--negro); cursor: pointer; white-space: nowrap; }
.chip b { font-weight: 800; margin-left: .25rem; }
.chip.marcado { border-color: var(--negro); }
.estado-nuevo { background: #ffe1d1; color: #8a2f00; }
.estado-contactado { background: #e3ecff; color: #1d3f8c; }
.estado-calificado { background: #fff1b8; color: #7a5a00; }
.estado-en_directo { background: #e6d9ff; color: #4b1e8c; }
.estado-venta { background: #d6f2df; color: #145c33; }
.estado-perdido { background: #ececec; color: #555; }
.totales { display: flex; flex-wrap: wrap; gap: .4rem; }
.encabezado { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.estados { display: flex; flex-wrap: wrap; gap: .4rem; }

/* Filtros */
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: .9rem; }
.filtros input[name="q"] { flex: 1 1 220px; }

/* Tabla */
.tabla-envoltorio { overflow-x: auto; background: var(--blanco); border-radius: var(--radio); box-shadow: var(--sombra); }
.tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.tabla th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--texto-suave); padding: .7rem .8rem; border-bottom: 2px solid var(--borde); }
.tabla td { padding: .65rem .8rem; border-bottom: 1px solid var(--borde); vertical-align: top; }
.tabla tr:last-child td { border-bottom: 0; }
.tabla tr.libre td:first-child { box-shadow: inset 4px 0 0 var(--naranja); }
.tabla tr.recien { animation: destello 1.5s ease-out; }
.tabla tr.inactivo { opacity: .55; }
.tabla .nombre { font-weight: 700; color: var(--negro); }
.sub { color: var(--texto-suave); font-size: .8rem; }
.cuando { white-space: nowrap; color: var(--texto-suave); font-size: .85rem; }
.acciones { white-space: nowrap; text-align: right; }
.acciones form { display: inline; }
@keyframes destello { from { background: #fff1ea; } to { background: transparent; } }

/* Ficha */
.ficha { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }
.ficha .columna.ancha { grid-column: span 1; }
.titulo-ficha { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.datos { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: .75rem 0 0; font-size: .95rem; }
.datos dt { color: var(--texto-suave); font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; padding-top: .15rem; }
.datos dd { margin: 0; }
.escenario { padding: .6rem 0; border-top: 1px solid var(--borde); }
.escenario:first-of-type { border-top: 0; }
.escenario-titulo { font-weight: 700; }
.escenario ul { margin: .3rem 0 0; padding-left: 1.1rem; }
.historial { list-style: none; margin: 1rem 0 0; padding: 0; }
.evento { display: grid; grid-template-columns: max-content max-content 1fr; gap: .6rem; padding: .4rem 0; border-top: 1px solid var(--borde); font-size: .9rem; }
.evento .cuando { font-size: .8rem; }
.evento .quien { font-weight: 700; }
.evento.tipo-nota .que { white-space: pre-wrap; }
.evento.tipo-bot .quien { color: var(--naranja-oscuro); }
.chat { display: flex; flex-direction: column; gap: .4rem; max-height: 420px; overflow-y: auto; padding: .25rem; background: var(--fondo); border-radius: 8px; }
.burbuja { max-width: 85%; padding: .45rem .7rem; border-radius: 12px; font-size: .9rem; }
.burbuja.entrante { align-self: flex-start; background: #fff; border-bottom-left-radius: 3px; }
.burbuja.saliente { align-self: flex-end; background: #ffe1d1; border-bottom-right-radius: 3px; }
.burbuja .hora { font-size: .7rem; color: var(--texto-suave); text-align: right; margin-top: .15rem; }

/* Celular */
@media (max-width: 800px) {
  .barra { gap: .75rem; padding: .5rem .75rem; }
  .barra .marca img { height: 26px; }
  .quien span { display: none; }
  .ficha { grid-template-columns: 1fr; }
  .datos { grid-template-columns: 1fr; gap: .1rem; }
  .datos dt { margin-top: .5rem; }
  .tabla th:nth-child(1), .tabla td:nth-child(1), .tabla th:nth-child(5), .tabla td:nth-child(5) { display: none; }
  .evento { grid-template-columns: 1fr; gap: .1rem; }
}

/* Seguimiento */
.tabla tr.frio td:first-child { box-shadow: inset 4px 0 0 #f2c200; }
.tabla tr.muy-frio td:first-child { box-shadow: inset 4px 0 0 var(--rojo); }
.tabla tr.vencido .cuando { color: var(--rojo); font-weight: 700; }
.pista { display: inline-block; font-size: .72rem; padding: .1rem .45rem; border-radius: 999px; background: #fff1b8; color: #7a5a00; margin-left: .3rem; }
.pista.roja { background: #fdecea; color: var(--rojo); }
.insignia { display: inline-block; min-width: 1.3rem; padding: 0 .35rem; border-radius: 999px; background: var(--naranja); color: #fff; font-size: .72rem; text-align: center; margin-left: .3rem; }
.nav a.activo .insignia { background: #fff; color: var(--naranja); }
code { background: #f0f0f3; padding: .05rem .3rem; border-radius: 4px; font-size: .9em; }
.formulario label.check { flex-direction: row; align-items: center; gap: .5rem; font-weight: 500; }
.exportar { display: flex; gap: .5rem; flex-wrap: wrap; margin-left: auto; }
