:root {
  --azul: #1433FF; --azul-hover: #0E27CC; --lima: #D7FF3D; --tinta: #0B1033; --gris: #F2F3F7;
  --borde: #DDE0EC; --texto-suave: #565B78; --rojo: #C62828; --blanco: #FFFFFF;
  --radio: 14px; --sombra: 0 18px 40px -24px rgba(11, 16, 51, .45);
  --fuente: Inter, system-ui, -apple-system, 'Segoe UI', Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: var(--fuente); font-size: 15px; color: var(--tinta); background: var(--gris); }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.barra { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--tinta); color: var(--blanco); }
.marca { color: var(--blanco); text-decoration: none; font-size: 17px; }
.marca b { color: var(--lima); font-weight: 900; letter-spacing: -.01em; }
.barra__usuario { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.barra .btn-link { color: var(--lima); }

main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); box-shadow: var(--sombra); }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 6px; padding: 11px 18px; border: 0; border-radius: 30px; background: var(--azul); color: var(--blanco); font-weight: 700; cursor: pointer; text-decoration: none; transition: background .2s; }
.btn:hover { background: var(--azul-hover); }
.btn--wa { background: var(--lima); color: var(--tinta); }
.btn--wa:hover { background: #C6F02A; }
.btn--linea { background: transparent; color: var(--azul); box-shadow: inset 0 0 0 1.5px var(--azul); }
.btn--linea:hover { background: rgba(20, 51, 255, .08); }
.btn-link { background: none; border: 0; padding: 4px 0; color: var(--azul); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.peligro { color: var(--rojo); }
label { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; }
input, select, textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--borde); border-radius: 10px; background: var(--blanco); font-weight: 400; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(20, 51, 255, .35); outline-offset: 1px; }

.login { display: grid; place-items: center; min-height: 70vh; }
.login__form { display: grid; gap: 14px; width: min(100%, 380px); padding: 28px; }
.login__form h1 { margin: 0 0 4px; font-size: 24px; }
.error { margin: 0; color: var(--rojo); font-size: 14px; }

.resumen { display: grid; gap: 10px; margin-bottom: 14px; }
.resumen__nuevos { margin: 0; color: var(--texto-suave); }
.resumen__nuevos b { color: var(--tinta); }
.etapas { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.etapa { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--borde); border-radius: 30px; background: var(--blanco); cursor: pointer; font-size: 14px; white-space: nowrap; }
.etapa b { font-variant-numeric: tabular-nums; }
.etapa[aria-selected="true"] { background: var(--azul); border-color: var(--azul); color: var(--blanco); }

.filtros { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 12px; }
.lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 14px 16px; background: var(--blanco); border: 1px solid var(--borde); border-radius: var(--radio); cursor: pointer; transition: border-color .2s, transform .2s; }
.item:hover { border-color: var(--azul); }
.item__nombre { font-weight: 700; overflow-wrap: anywhere; }
.item__meta { grid-column: 1 / -1; color: var(--texto-suave); font-size: 13.5px; overflow-wrap: anywhere; }
.chip { justify-self: end; align-self: start; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; background: var(--gris); }
.chip--nuevo { background: var(--lima); }
.chip--cerrado { background: var(--azul); color: var(--blanco); }
.chip--perdido { background: #F3D6D6; }
.temp { font-size: 12px; font-weight: 700; }
.temp--caliente { color: var(--rojo); }
.temp--tibio { color: #B26A00; }
.temp--frio { color: var(--azul); }
.vacio { color: var(--texto-suave); text-align: center; padding: 32px 0; }
.paginas { display: flex; justify-content: space-between; margin-top: 12px; }

.ficha { position: fixed; inset: 0; z-index: 10; background: rgba(11, 16, 51, .45); display: flex; justify-content: flex-end; }
.ficha__in { position: relative; width: min(100%, 520px); height: 100%; overflow-y: auto; padding: 22px 18px 40px; background: var(--blanco); box-shadow: -20px 0 50px -30px rgba(11, 16, 51, .6); }
.ficha__cerrar { position: absolute; top: 10px; right: 12px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--gris); font-size: 24px; line-height: 1; cursor: pointer; }
.ficha__origen { margin: 0; font-size: 12px; letter-spacing: 1.2px; text-transform: uppercase; color: var(--azul); font-weight: 700; }
.ficha h2 { margin: 6px 48px 4px 0; font-size: 24px; line-height: 1.15; overflow-wrap: anywhere; }
.ficha__sub { margin: 0 0 14px; color: var(--texto-suave); overflow-wrap: anywhere; }
.ficha__acciones { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.ficha__campos { display: grid; gap: 12px; padding: 16px; margin-bottom: 16px; background: var(--gris); border-radius: var(--radio); }
.ficha__nota { display: grid; gap: 8px; margin-bottom: 18px; }
.ficha__nota .btn { justify-self: start; }
.ficha h3 { margin: 0 0 8px; font-size: 16px; }
.historial { list-style: none; margin: 0 0 20px; padding: 0; border-left: 2px solid var(--borde); }
.historial li { position: relative; padding: 0 0 14px 16px; }
.historial li::before { content: ""; position: absolute; left: -6px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: var(--azul); }
.historial li.lead_web::before { background: var(--lima); box-shadow: 0 0 0 1.5px var(--tinta); }
.historial small { display: block; color: var(--texto-suave); font-size: 12.5px; }
.historial p { margin: 2px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }

.aviso { position: fixed; left: 50%; bottom: 18px; z-index: 20; transform: translateX(-50%); padding: 10px 16px; border-radius: 30px; background: var(--tinta); color: var(--blanco); font-size: 14px; box-shadow: var(--sombra); }

@media (min-width: 768px) {
  main { padding: 24px; }
  .filtros { grid-template-columns: 1fr 240px; }
  .item { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; align-items: center; }
  .item__meta { grid-column: auto; }
  .ficha__campos { grid-template-columns: repeat(3, 1fr); }
  .ficha__in { padding: 28px 28px 40px; }
}
