button:focus-visible, input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--ink-pleno);
  color: var(--text-body);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.phone {
  width: 100%;
  max-width: 480px;
  height: 100dvh;
  max-height: 900px;
  background: var(--ink);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  transition: background-color 0.25s ease;
}

@media (min-width: 540px) {
  .phone {
    border-radius: var(--radius-card);
  }
}

.top {
  padding: 0 16px;
  height: 51px;
  border-bottom: 1px solid var(--header-border);
  flex-shrink: 0;
  background: var(--header-bg);
  color: var(--header-text);
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

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

.top-r {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-btn);
  background: var(--accent);
  display: grid;
  place-items: center;
  color: var(--bubble-user-text);
  font-family: 'Exo 2';
  font-weight: 800;
  font-size: 13px;
}

.logo-img {
  height: 32px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  border-radius: var(--radius-btn);
  display: block;
}

.top-txt b {
  font-family: 'Exo 2';
  font-weight: 800;
  font-size: 15px;
  display: block;
  line-height: 1.2;
  color: var(--header-text);
}

.top-txt span {
  font-size: 11px;
  color: var(--text-dim);
  display: block;
  font-weight: 400;
}

.pill {
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--header-text);
  background: transparent;
  border: 1px solid var(--header-border);
  padding: 4px 9px;
  border-radius: var(--radius-badge);
  white-space: nowrap;
}

.pill.gris {
  color: var(--text-dim);
  border-color: var(--header-border);
}

/* Theme toggle btn */
.btn-theme {
  background: transparent;
  border: 1px solid var(--header-border);
  color: var(--header-text);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-theme:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
}

.vista {
  flex: 1;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  -webkit-overflow-scrolling: touch;
}

.vista.on {
  display: flex;
}

/* ==========================================================================
   ONBOARDING — PANTALLA INICIAL DE CAPTURA SIMPLE
   ========================================================================== */
.onboarding-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 32px 24px;
  animation: sube 0.3s ease both;
}

.onboarding-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  padding: 5px 12px;
  background: var(--grey-surface);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-badge);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-main);
  margin-bottom: 18px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.onboarding-badge svg {
  color: var(--accent);
}

.onboarding-tit {
  font-family: 'Exo 2', sans-serif;
  font-size: 26px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.2;
  margin-bottom: 10px;
}

.onboarding-sub {
  font-family: 'Manrope', sans-serif;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 28px;
}

.onboarding-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-family: 'Manrope', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: 0.02em;
}

.form-input {
  width: 100%;
  padding: 13px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-family: 'Manrope', sans-serif;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-main);
  outline: none;
  transition: all 0.2s ease;
}

.form-input:focus {
  border-color: var(--accent);
  background: var(--bg-page);
  box-shadow: 0 0 0 3px rgba(242, 130, 13, 0.15);
}

.form-input::placeholder {
  color: var(--text-dim);
}

.btn-onboarding {
  margin-top: 10px;
  width: 100%;
  padding: 14px 20px;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: var(--bubble-user-text);
  font-family: 'Manrope', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(242, 130, 13, 0.35);
  transition: all 0.2s ease;
}

.btn-onboarding:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(242, 130, 13, 0.45);
}

.btn-onboarding:active {
  transform: translateY(0);
}

.onboarding-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--text-dim);
  font-size: 11.5px;
  text-align: center;
}

.onboarding-footer svg {
  flex-shrink: 0;
}

/* Chat */
.hilo {
  flex: 1;
  overflow-y: auto;
  padding: 20px 18px 8px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 84%;
  padding: 12px 15px;
  font-size: 15px;
  line-height: 1.45;
  border-radius: var(--radius-bubble);
  font-weight: 400;
  animation: sube 0.28s ease both;
}

.msg.ia {
  background: var(--bubble-ia);
  color: var(--text-body);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  border: 1px solid var(--card-border);
}

.msg.yo {
  background: var(--bubble-user);
  color: var(--bubble-user-text);
  border-bottom-right-radius: 4px;
  align-self: flex-end;
  font-weight: 500;
}

.msg b {
  font-weight: 700;
  color: var(--text-main);
}

.msg.yo b {
  color: var(--bubble-user-text);
}

@keyframes sube {
  from {
    opacity: 0;
    transform: translateY(9px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.escribiendo {
  display: flex;
  gap: 4px;
  padding: 15px;
}

.escribiendo i {
  width: 6px;
  height: 6px;
  background: var(--text-dim);
  border-radius: 50%;
  animation: pulso 1.2s infinite;
}

.escribiendo i:nth-child(2) {
  animation-delay: 0.18s;
}

.escribiendo i:nth-child(3) {
  animation-delay: 0.36s;
}

@keyframes pulso {
  0%, 60%, 100% { opacity: 0.3; }
  30% { opacity: 1; }
}

.chips {
  padding: 8px 16px 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--ink);
  flex-shrink: 0;
}

.chip {
  padding: 10px 16px;
  min-height: 42px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-chip);
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-body);
  transition: all 0.15s ease;
}

.chip:active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bubble-user-text);
}

.chip.cta {
  border-color: var(--accent);
  color: var(--accent);
}

.chip.permuta {
  border-color: var(--wa);
  color: var(--wa);
}

.barra {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 12px 16px;
  border-top: 1px solid var(--line-divider);
  background: var(--ink);
  flex-shrink: 0;
}

.barra input {
  flex: 1;
  padding: 13px 16px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-chip);
  font-size: 15px;
  font-weight: 400;
  font-family: inherit;
  background: var(--surface-2);
  color: var(--text-body);
  outline: none;
}

.barra input::placeholder {
  color: var(--text-dim);
}

.barra input:focus {
  border-color: var(--accent);
}

.enviar {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent);
  color: var(--bubble-user-text);
  display: grid;
  place-items: center;
  cursor: pointer;
}

.enviar:disabled {
  background: var(--surface-2);
  color: var(--text-dim);
}

/* Resultados */
.match-head {
  padding: 18px 18px 4px;
  flex-shrink: 0;
}

.match-head h2 {
  font-family: 'Exo 2';
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 5px;
  color: var(--text-main);
}

.match-head p {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  font-weight: 400;
}

.match-head p b {
  color: var(--text-body);
  font-weight: 600;
}

.plazos {
  display: flex;
  gap: 7px;
  padding: 14px 18px 0;
  flex-shrink: 0;
}

.plazo {
  flex: 1;
  padding: 11px 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-btn);
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-muted);
}

.plazo.on {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

.ajuste {
  margin: 14px 16px 0;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  flex-shrink: 0;
}

.ajuste-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 15px;
  cursor: pointer;
}

.ajuste-head div b {
  font-size: 13.5px;
  font-weight: 600;
  display: block;
  color: var(--text-body);
}

.ajuste-head div small {
  font-size: 11.5px;
  color: var(--text-dim);
  font-weight: 400;
}

.switch {
  width: 42px;
  height: 25px;
  border-radius: 14px;
  background: var(--line-divider);
  position: relative;
  flex-shrink: 0;
  transition: 0.2s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: var(--text-main);
  transition: 0.2s;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ajuste.on .switch {
  background: var(--accent);
}

.ajuste.on .switch::after {
  transform: translateX(17px);
  background: var(--bubble-user-text);
}

.ajuste-body {
  display: none;
  padding: 4px 15px 16px;
  border-top: 1px solid var(--line-divider);
}

.ajuste.on .ajuste-body {
  display: block;
}

.slider-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 12px 0 10px;
}

.slider-top small {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.slider-top b {
  font-family: 'Exo 2';
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
}

.slider-top b i {
  font-style: normal;
  font-size: 12px;
  color: var(--text-dim);
  font-weight: 600;
  font-family: 'Manrope';
}

input[type=range] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 4px;
  background: var(--line-divider);
  outline: none;
  margin: 2px 0;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(242, 130, 13, 0.4);
  border: 3px solid var(--ink);
}

input[type=range]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: 3px solid var(--ink);
}

.conteo {
  font-size: 12.5px;
  color: var(--text-muted);
  margin-top: 11px;
  font-weight: 400;
}

.conteo b {
  color: var(--accent);
  font-weight: 700;
}

.lista {
  padding: 14px 16px 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   DISEÑO DE CARDS HORIZONTALES — SISTEMA UNIFICADO PLANTILLA MAESTRA
   ========================================================================== */
.card-auto {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  overflow: hidden;
  display: flex;
  flex-direction: row;
  min-height: 175px;
  transition: all 0.2s ease-in-out;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  animation: sube 0.3s ease both;
}

.card-auto:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  transform: translateY(-2px);
}

/* Columna Izquierda: Foto */
.card-foto {
  width: 42%;
  min-width: 140px;
  max-width: 180px;
  background: var(--grey-surface);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-right: 1px solid var(--card-border);
  flex-shrink: 0;
}

.card-foto img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 65%;
  display: block;
  transition: transform 0.3s ease;
}

.card-foto svg {
  opacity: 0.25;
  color: var(--text-dim);
}

.card-auto:hover .card-foto img {
  transform: scale(1.05);
}

/* Columna Derecha: Contenido & Datos */
.card-info {
  flex: 1;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-width: 0;
}

/* Cabecera de la Info: Título + Badge Plan */
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 2px;
}

.card-title {
  font-family: 'Exo 2', sans-serif;
  font-size: 16px;
  font-weight: 800;
  color: var(--text-main);
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge Plan */
.badge-plan {
  font-family: 'Manrope', sans-serif;
  font-weight: 700;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--radius-badge);
  white-space: nowrap;
  flex-shrink: 0;
}

.badge-plan.casa {
  background: var(--accent);
  color: var(--bubble-user-text);
}

.badge-plan.banco {
  background: transparent;
  border: 1px solid var(--card-border);
  color: var(--text-main);
}

/* Specs del Vehículo */
.card-specs {
  font-family: 'Manrope', sans-serif;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-specs b {
  color: var(--text-main);
  font-weight: 700;
}

/* Bloque Financiero (Fondo #E9EAE1 en Light / #171410 en Dark) */
.fin-box {
  background: var(--grey-surface);
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
  border: 1px solid var(--card-border);
}

.fin-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11.5px;
  line-height: 1.35;
}

.fin-row span {
  color: var(--text-muted);
  font-weight: 500;
}

.fin-row b {
  font-weight: 700;
  color: var(--text-main);
}

.fin-row.cuota-row {
  margin-top: 3px;
  padding-top: 3px;
  border-top: 1px solid var(--card-border);
}

.fin-row.cuota-row .label {
  font-weight: 600;
  color: var(--text-main);
}

.fin-row.cuota-row .monto {
  font-family: 'Exo 2', sans-serif;
  font-size: 18.5px;
  font-weight: 800;
  color: var(--accent);
}

.fin-note {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  text-align: right;
  margin-top: 1px;
}

/* Botón WhatsApp Compacto */
.btn-wa-card {
  width: 100%;
  padding: 8px 12px;
  background: var(--wa);
  color: var(--wa-text);
  border: none;
  border-radius: 6px;
  font-family: 'Manrope', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-shadow: 0 2px 8px rgba(37, 211, 102, 0.25);
  transition: all 0.2s ease-in-out;
}

.btn-wa-card:hover {
  background: var(--wa-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
}

.btn-wa-card svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.wa {
  width: 100%;
  padding: 12px 22px;
  border: none;
  border-radius: var(--radius-btn);
  background: var(--wa);
  color: var(--wa-text);
  font-size: 0.88rem;
  font-weight: 600;
  font-family: 'Manrope';
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(37, 211, 102, 0.3);
  transition: all 0.2s ease-in-out;
}

.wa:hover {
  background: var(--wa-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(37, 211, 102, 0.45);
}

.vacio {
  padding: 40px 26px;
  text-align: center;
}

.vacio h3 {
  font-family: 'Exo 2';
  font-size: 19px;
  font-weight: 800;
  margin: 0 0 8px;
  color: var(--text-main);
}

.vacio p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 18px;
  font-weight: 400;
}

.vacio p b {
  color: var(--text-body);
  font-weight: 600;
}

.brecha {
  background: var(--accent-soft);
  border: 1px solid rgba(242, 130, 13, 0.3);
  border-radius: var(--radius-card);
  padding: 15px;
  margin-bottom: 12px;
  text-align: left;
}

.brecha b {
  display: block;
  font-family: 'Exo 2';
  font-size: 24px;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: 4px;
}

.brecha span {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.45;
  display: block;
  font-weight: 400;
}

.btn-linea {
  padding: 13px 22px;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  margin-bottom: 9px;
}

/* Vendedor */
#vVend {
  padding: 22px;
}

.comerciales-head {
  padding: 14px 10px 4px;
  text-align: center;
}

.comerciales-head h2 {
  font-family: 'Exo 2', sans-serif;
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}

.comerciales-head p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.4;
  margin-bottom: 12px;
}

.comerciales-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.tel-visible {
  font-family: 'Exo 2', sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 14px;
  letter-spacing: 0.03em;
}

.ficha {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-card);
  padding: 20px 16px;
  text-align: center;
  background: var(--card-dark);
}

.avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid rgba(242, 130, 13, 0.3);
  display: grid;
  place-items: center;
  font-family: 'Exo 2';
  font-size: 23px;
  font-weight: 800;
  margin: 0 auto 13px;
}

.ficha h3 {
  font-family: 'Exo 2';
  font-size: 19px;
  font-weight: 800;
  margin-bottom: 4px;
  color: var(--text-main);
}

.ficha p {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 18px;
  font-weight: 400;
}

.resumen {
  background: var(--surface-2);
  border-radius: var(--radius-card);
  padding: 18px;
  margin-bottom: 16px;
}

.resumen h4 {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}

.dato {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-divider);
  font-size: 13px;
  gap: 12px;
}

.dato:last-child {
  border: none;
}

.dato span {
  color: var(--text-muted);
  white-space: nowrap;
  font-weight: 500;
}

.dato b {
  font-weight: 700;
  text-align: right;
  color: var(--text-body);
}

.ref {
  font-size: 11px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 10px;
  letter-spacing: 0.08em;
}

.horario {
  font-size: 12px;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.6;
  font-weight: 400;
}

.nav {
  display: flex;
  min-height: var(--nav-h);
  border-top: 1px solid var(--line-divider);
  background: var(--ink-pleno);
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom);
}

.nav button {
  flex: 1;
  padding: 11px 4px 13px;
  background: none;
  border: none;
  font-family: 'Manrope';
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  color: var(--text-dim);
  transition: 0.15s;
  position: relative;
}

.nav button span {
  font-size: 10.5px;
  font-weight: 600;
}

.nav button.on {
  color: var(--accent);
}

.nav button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.badge {
  position: absolute;
  top: 7px;
  right: calc(50% - 21px);
  background: var(--accent);
  color: var(--bubble-user-text);
  font-size: 9.5px;
  font-weight: 800;
  min-width: 16px;
  height: 16px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  padding: 0 4px;
}

.oculto {
  display: none !important;
}
