/* =========================================================================
   Prospecta — hoja de estilos

   Indigo y violeta sobre superficies frias. El color no es decoracion: marca
   lo que se puede pulsar y lo que hay que mirar primero. El resto se queda en
   gris para que eso destaque.

   Tema claro por defecto; el oscuro NO invierte la marca — un boton principal
   blanco sobre negro parecia apagado, y en oscuro es cuando mas falta hace
   que el color tire.
   ========================================================================= */

/* --- Tokens --------------------------------------------------------------- */
:root {
  color-scheme: light;

  /* Superficies. Blancos con una gota de azul: sobre ellos el indigo no
     chirria, cosa que si pasaba con los grises calidos de antes. */
  --paper: #f5f6fc;
  --surface: #ffffff;
  --surface-2: #f0f2fa;
  --surface-3: #e4e8f6;
  --line: #dfe3f2;
  --line-2: #c3c9e4;

  /* Texto. Mas contraste que antes: el gris medio se leia mal en portatiles
     con brillo bajo, que es donde va a mirarlo la mitad de la gente. */
  --ink: #14152e;
  --ink-2: #4b4e72;
  --ink-3: #7b7fa3;

  /* Marca */
  --brand: #5145e5;
  --brand-hover: #4036cc;
  --brand-on: #ffffff;
  --brand-tint: #ebeaff;
  --brand-tint-2: #dedcff;

  /* Acento: violeta. Acompana al indigo en degradados y detalles. */
  --accent: #8b5cf6;
  --accent-soft: #f3edff;

  /* Degradado de marca, para lo que tiene que llamar la atencion. */
  --gradient: linear-gradient(135deg, #5145e5 0%, #8b5cf6 100%);

  --focus: #5145e5;

  /* Tramos de oportunidad */
  --tier-noweb: #0a8f70;
  --tier-nobot: #1f8a44;
  --tier-basic: #a67208;
  --tier-modern: #c2560c;
  --tier-ai: #c92f28;
  --tier-none: #7b7fa3;

  /* Fondos de las mismas familias */
  --tint-noweb: rgba(10, 143, 112, 0.11);
  --tint-nobot: rgba(31, 138, 68, 0.11);
  --tint-basic: rgba(166, 114, 8, 0.12);
  --tint-modern: rgba(194, 86, 12, 0.11);
  --tint-ai: rgba(201, 47, 40, 0.1);

  /* Sombras con tinte azul: una sombra gris sobre fondo frio se ve sucia. */
  --shadow-sm: 0 1px 2px rgba(28, 30, 80, 0.06);
  --shadow-md: 0 6px 18px rgba(28, 30, 80, 0.09);
  --shadow-lg: 0 20px 50px rgba(28, 30, 80, 0.16);
  --shadow-brand: 0 6px 18px rgba(81, 69, 229, 0.28);

  --radius: 12px;
  --radius-sm: 9px;
  --radius-xs: 6px;

  --ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --topbar-h: 66px;
  --page: 1440px;
  --gutter: 28px;
}

:root[data-theme="dark"] {
  color-scheme: dark;

  --paper: #0a0a16;
  --surface: #13142a;
  --surface-2: #1a1b36;
  --surface-3: #242647;
  --line: #282a4d;
  --line-2: #3b3e69;

  --ink: #edecfd;
  --ink-2: #a7a9d4;
  --ink-3: #7679a6;

  /* La marca sigue siendo color, no blanco: en oscuro es cuando mas se
     agradece que el boton principal tire hacia el violeta. */
  --brand: #7a6cff;
  --brand-hover: #8d81ff;
  --brand-on: #ffffff;
  --brand-tint: #201f47;
  --brand-tint-2: #2a2860;

  --accent: #a78bfa;
  --accent-soft: #241f4a;

  --gradient: linear-gradient(135deg, #6a5cff 0%, #a78bfa 100%);

  --focus: #8d81ff;

  --tier-noweb: #2fd6ac;
  --tier-nobot: #5ed97f;
  --tier-basic: #e5bb44;
  --tier-modern: #f39355;
  --tier-ai: #fa7d76;
  --tier-none: #7679a6;

  --tint-noweb: rgba(47, 214, 172, 0.15);
  --tint-nobot: rgba(94, 217, 127, 0.15);
  --tint-basic: rgba(229, 187, 68, 0.15);
  --tint-modern: rgba(243, 147, 85, 0.15);
  --tint-ai: rgba(250, 125, 118, 0.15);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
  --shadow-md: 0 6px 18px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.6);
  --shadow-brand: 0 6px 20px rgba(122, 108, 255, 0.35);
}

/* Alias heredados: algunos fragmentos antiguos aun piden estos nombres. */
:root {
  --text: var(--ink);
  --text-dim: var(--ink-2);
  --text-faint: var(--ink-3);
  --border: var(--line);
  --success: var(--tier-nobot);
  --warning: var(--tier-basic);
  --orange: var(--tier-modern);
  --danger: var(--tier-ai);
}

/* --- Base ----------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* Varios bloques se ocultan con el atributo `hidden` pero declaran su propio
   `display` (grid o flex), que gana a la regla del navegador. Sin esto el
   panel de opciones y los paneles vacios se ven desde el primer pintado. */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  /* 15px, no 14: la herramienta se usa durante ratos largos y un punto mas
     de tamano se nota en la vista mucho antes que en el diseno. */
  font-size: 15px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.02em; color: var(--ink); }
p { margin: 0 0 0.55rem; }

a { color: var(--ink); }

/**
 * Foco visible en todo lo que se puede enfocar.
 *
 * El anillo del navegador se pierde sobre fondos claros y desaparecia del
 * todo en los botones oscuros. Quien navega con teclado necesita ver donde
 * esta, y quien no lo usa no lo ve nunca.
 */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

code {
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.87em;
  padding: 0.1em 0.36em;
  border-radius: var(--radius-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Etiqueta de seccion: mayusculas pequenas, el recurso que ordena la pagina. */
.eyebrow {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  font-weight: 600;
  color: var(--ink-3);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line-2);
  border-radius: 99px;
  border: 3px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--ink-3); background-clip: content-box; }


/* --- Contenedores --------------------------------------------------------- */
/* El ancho ya descuenta el margen lateral, asi los bloques con borde quedan
   alineados con la cabecera sin necesitar un envoltorio extra. */
.progress-panel,
.stats,
.filters,
.toolbar,
.workspace {
  width: calc(100% - var(--gutter) * 2);
  max-width: calc(var(--page) - var(--gutter) * 2);
  margin: 16px auto 0;
}

/* --- Cabecera ------------------------------------------------------------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.topbar__inner {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
  min-height: var(--topbar-h);
}

/* --- Marca ---------------------------------------------------------------- */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  padding: 4px;
  margin-left: -4px;
  border-radius: var(--radius-sm);
}
.logo:hover .logo__mark { transform: scale(1.06); }
.logo__mark {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  flex: none;
  border-radius: 10px;
  /* Degradado, no color plano: es lo primero que se ve de la marca. */
  background: var(--gradient);
  box-shadow: var(--shadow-brand);
  transition: transform 0.18s var(--ease);
  color: var(--brand-on);
}
.logo__text strong {
  display: block;
  font-size: 17px;
  font-weight: 680;
  letter-spacing: -0.025em;
  line-height: 1.2;
}
.logo__text small {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
}

.topbar__spacer { min-width: 0; }
.topbar__actions { display: flex; gap: 6px; align-items: center; }

/* --- Busquedas restantes (cabecera) ---------------------------------------- */
/* Una pastilla con la lupa y el numero. Misma altura que los botones de al
   lado, para que la fila quede alineada. */
.quota {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  text-decoration: none;
  transition: border-color 0.15s var(--ease), color 0.15s var(--ease);
}
.quota:hover { border-color: var(--line-2); color: var(--ink); }

.quota__text {
  font-size: 13px;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* Quedan pocas: ambar. Ninguna: rojo, y el enlace a precios cobra sentido. */
.quota.is-low {
  color: var(--tier-basic);
  border-color: rgba(148, 104, 10, 0.35);
  background: var(--tint-basic);
}
.quota.is-empty {
  color: var(--tier-ai);
  border-color: rgba(173, 44, 38, 0.35);
  background: var(--tint-ai);
}

/* --- Consumo del plan (dentro del menu de cuenta) -------------------------- */
.account__quota {
  margin: 0;
  padding: 0 14px 10px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-3);
}
/* Quedan pocas: ambar. Agotadas: rojo, que ahi ya urge. */
.account__quota.is-low { color: var(--tier-basic); }
.account__quota.is-empty { color: var(--tier-ai); font-weight: 550; }

/* --- Menu de cuenta -------------------------------------------------------- */
.account { position: relative; }
.account__button {
  display: grid;
  place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: 50%;
  background: var(--surface);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
}
.account__button:hover { border-color: var(--ink-3); }
.account__avatar {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--brand);
  color: var(--brand-on);
  font-size: 12.5px;
  font-weight: 650;
}

.account__menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 50;
  min-width: 224px;
  padding: 6px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.account__head { padding: 10px 11px 11px; border-bottom: 1px solid var(--line); }
.account__head strong { display: block; font-size: 13.5px; font-weight: 600; }
.account__head small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 1px; }
.account__plan {
  margin: 8px 11px;
  padding: 4px 9px;
  border-radius: 99px;
  background: var(--brand-tint);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  display: inline-block;
}
.account__item {
  display: block;
  width: 100%;
  padding: 8px 11px;
  border: 0;
  border-radius: var(--radius-xs);
  background: none;
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.account__item:hover { background: var(--surface-2); color: var(--ink); }
.account__item--danger:hover { background: var(--tint-ai); color: var(--tier-ai); }

.pubnav__user { font-size: 13.5px; color: var(--ink-2); margin-right: 6px; }

/* Selector de idioma: mismo peso visual que los botones de icono. */
.langpick {
  height: 34px;
  padding: 0 26px 0 10px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13px;
  font-weight: 550;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 11px center, right 7px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  transition: border-color 0.15s, color 0.15s;
}
.langpick:hover { border-color: var(--ink-3); color: var(--ink); }
/* Que quepa el nombre entero: "Português" es el mas largo de los seis. */
.langpick { min-width: 104px; }
@media (max-width: 900px) { .langpick { min-width: 60px; padding-right: 22px; } }
.langpick option { background: var(--surface); color: var(--ink); }

/* --- Aviso de correo sin confirmar ----------------------------------------- */
/* Mismo ancho que el buscador que va debajo, para que no baile. */
.verifybar {
  display: flex;
  align-items: center;
  gap: 13px;
  width: calc(100% - var(--gutter) * 2);
  max-width: calc(var(--page) - var(--gutter) * 2);
  margin: 18px auto 0;
  padding: 12px 16px;
  background: var(--tint-basic);
  border: 1px solid rgba(148, 104, 10, 0.3);
  border-radius: var(--radius);
}

.verifybar__icon {
  font-size: 17px;
  line-height: 1;
  color: var(--tier-basic);
}

.verifybar__text {
  margin: 0;
  flex: 1;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--ink-2);
}

.verifybar__text strong { color: var(--tier-basic); }

#verify-email {
  font-weight: 600;
  color: var(--ink);
  word-break: break-all;
}

@media (max-width: 620px) {
  .verifybar { flex-wrap: wrap; }
  .verifybar__text { flex-basis: 100%; order: 2; }
}

/* Compartir informe: destaca sobre las demas acciones de la ficha porque es
   la que convierte un analisis en una conversacion de venta. */
.btn--share {
  background: var(--tint-noweb);
  border: 1px solid rgba(13, 122, 99, 0.35);
  color: var(--tier-noweb);
  font-weight: 600;
}
.btn--share:hover { background: rgba(13, 122, 99, 0.16); }

/* --- Ventana de invitaciones ----------------------------------------------- */
.modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal__fondo {
  position: absolute;
  inset: 0;
  background: rgba(19, 20, 23, 0.55);
  backdrop-filter: blur(2px);
}
.modal__caja {
  position: relative;
  width: 100%;
  max-width: 470px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  padding: 28px 30px 24px;
  /* Si el contenido no cabe en una pantalla baja, que scrollee la caja y no
     la pagina de debajo. */
  max-height: calc(100vh - 40px);
  overflow-y: auto;
}
.modal__caja h2 {
  font-size: 21px;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.modal__sub {
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--ink-2);
  margin: 0 0 22px;
}
.modal__pie {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-3);
  margin: 18px 0 0;
}
.modal__cerrar {
  position: absolute;
  top: 12px; right: 14px;
  width: 30px; height: 30px;
  border: 0;
  background: transparent;
  color: var(--ink-3);
  font-size: 24px;
  line-height: 1;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.modal__cerrar:hover { background: var(--surface-2); color: var(--ink); }

/* La vigilancia lleva listas: necesita mas ancho que las invitaciones. */
.modal__caja--ancha { max-width: 620px; }

.vig-h3 {
  font-size: 12px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
  margin: 20px 0 10px;
}
.vig-vacio { font-size: 14px; line-height: 1.6; color: var(--ink-2); margin: 0; }

.vig-cambios, .vig-lista { list-style: none; margin: 0; padding: 0; }
.vig-cambios li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.vig-cambios strong { font-size: 13.5px; font-weight: 600; }
.vig-cambios span { grid-column: 1; font-size: 12.5px; color: var(--ink-2); }
.vig-cambios small { grid-row: 1; grid-column: 2; font-size: 11.5px; color: var(--ink-3); }

.vig-lista li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}
.vig-lista strong { display: block; font-size: 13.5px; font-weight: 550; }
.vig-lista small { font-size: 11.5px; color: var(--ink-3); }

.copybox { display: flex; gap: 8px; }
.copybox .input { flex: 1; font-size: 13px; }

.invitar__cifras {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
  text-align: center;
}
.invitar__cifras div {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px 8px;
}
.invitar__cifras strong {
  display: block;
  font-size: 22px;
  font-weight: 660;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.invitar__cifras span { font-size: 11.5px; color: var(--ink-3); }

/* --- Buscador principal --------------------------------------------------- */
.hunt {
  width: calc(100% - var(--gutter) * 2);
  max-width: calc(var(--page) - var(--gutter) * 2);
  margin: 22px auto 0;
  padding: 24px 26px 22px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
}

.hunt__head { margin-bottom: 20px; max-width: 720px; }
.hunt__title {
  font-size: 25px;
  font-weight: 650;
  letter-spacing: -0.028em;
  line-height: 1.2;
  margin-bottom: 7px;
}
.hunt__sub { color: var(--ink-2); font-size: 14px; margin: 0; }
/* Con resultados en pantalla el titulo ya ha cumplido su funcion. */
.hunt.is-compact .hunt__head { display: none; }

.hunt__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.hunt__foot {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.field--free { flex: 1; min-width: 0; }

/* Campo grande: los cuatro selectores son la accion principal de la pagina. */
.input--lg { padding: 10px 12px; font-size: 14.5px; }
select.input--lg { padding-right: 30px; background-position: right 14px center, right 9px center; }

/* --- Selector de pais con bandera ----------------------------------------- */
.picker { position: relative; }

.picker__button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font: inherit;
  font-size: 14.5px;
  color: var(--ink);
}
.picker__button:hover { border-color: var(--ink-3); }
.picker__label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker__caret {
  flex: none;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--ink-3);
}

/* Las banderas son PNG externos: si no cargan, el hueco no debe descuadrar. */
.picker__flag,
.picker__item img {
  flex: none;
  width: 20px; height: 15px;
  object-fit: cover;
  border-radius: 2px;
  background: var(--surface-3);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.09);
}

.picker__pop {
  position: absolute;
  top: calc(100% + 5px);
  left: 0; right: 0;
  z-index: 50;
  padding: 8px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.picker__search { margin-bottom: 7px; }

.picker__list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 264px;
  overflow-y: auto;
}
.picker__item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: var(--radius-xs);
  font-size: 13.5px;
  cursor: pointer;
}
.picker__item:hover, .picker__item.is-active { background: var(--surface-2); }
.picker__item.is-selected { font-weight: 600; }
.picker__item.is-selected::after { content: "✓"; margin-left: auto; color: var(--ink-3); }

.picker__empty { margin: 0; padding: 12px 9px; color: var(--ink-3); font-size: 13px; }

.field__opt {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  color: var(--ink-3);
  opacity: 0.85;
}

/* --- Botones -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s,
              box-shadow 0.15s, transform 0.15s, opacity 0.15s;
}
.btn:hover {
  background: var(--surface-2);
  border-color: var(--ink-3);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn:active { transform: translateY(0); box-shadow: var(--shadow-sm); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

/**
 * Boton principal: degradado de marca.
 *
 * El degradado va en `background-image` y el color plano debajo, para que si
 * el navegador no lo pinta siga habiendo un boton legible y no un rectangulo
 * transparente con texto blanco.
 */
.btn--primary {
  background-color: var(--brand);
  background-image: var(--gradient);
  border-color: transparent;
  color: var(--brand-on);
  font-weight: 650;
  box-shadow: var(--shadow-brand);
}
.btn--primary:hover {
  background-color: var(--brand-hover);
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(81, 69, 229, 0.36);
}
.btn--primary:active { transform: translateY(0); }
:root[data-theme="dark"] .btn--primary:hover { box-shadow: 0 10px 26px rgba(122, 108, 255, 0.45); }

/* Llamada a la accion: la unica pieza de la pagina con este peso. */
.btn--cta { padding: 14px 28px; font-size: 16px; border-radius: 11px; }
.btn__arrow { transition: transform 0.18s var(--ease); flex: none; }
.btn--cta:hover .btn__arrow { transform: translateX(3px); }

/* El secundario tira al color de marca al pasar por encima: deja claro que
   tambien se puede pulsar, sin competir con el principal. */
.btn--ghost { background: var(--surface); border-color: var(--line-2); color: var(--ink-2); }
.btn--ghost:hover {
  background: var(--brand-tint);
  border-color: var(--brand);
  color: var(--brand);
}

.btn--danger { background: var(--surface); border-color: var(--line-2); color: var(--tier-ai); }
.btn--danger:hover { background: var(--tint-ai); border-color: var(--tier-ai); }

.btn--sm { padding: 6px 12px; font-size: 12.5px; }
.btn--icon { padding: 8px; border-color: var(--line-2); background: var(--surface); color: var(--ink-2); }
.btn--icon:hover { color: var(--ink); }

.linkish {
  background: none; border: 0; padding: 0; font: inherit; cursor: pointer;
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: var(--line-2);
}
.linkish:hover { color: var(--ink); text-decoration-color: currentColor; }

.spinner {
  width: 13px; height: 13px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-top-color: transparent;
  opacity: 0.8;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.is-loading .btn__label { opacity: 0.6; }

/* --- Panel de opciones ---------------------------------------------------- */
.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 22px;
  max-width: var(--page);
  margin: 0 auto;
  padding: 20px var(--gutter) 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
}
/* El panel vive dentro de .topbar, que ya tiene fondo propio. */
.topbar .options { background: var(--surface-2); }

.switch { display: flex; align-items: flex-start; gap: 11px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  flex: none;
  width: 34px; height: 20px;
  margin-top: 1px;
  border-radius: 99px;
  background: var(--surface-3);
  border: 1px solid var(--line-2);
  transition: background 0.18s, border-color 0.18s;
  display: flex; align-items: center; padding: 2px;
}
.switch__thumb {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand); border-color: var(--brand); }
.switch input:checked + .switch__track .switch__thumb { transform: translateX(14px); background: var(--brand-on); }
.switch input:focus-visible + .switch__track { outline: 2px solid var(--focus); outline-offset: 2px; }
.switch__text strong { display: block; font-size: 13.5px; font-weight: 550; }
.switch__text small { display: block; font-size: 12px; color: var(--ink-2); line-height: 1.45; margin-top: 1px; }

/* --- Campos --------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field__label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 600;
}
.field--inline { min-width: 132px; }
.field--narrow { max-width: 108px; }
/* El buscador dentro de resultados se queda con el espacio sobrante: es el
   unico campo cuyo texto no cabe en el ancho minimo. */
.filters__row--controls .field--inline:first-child { flex: 1 1 220px; }

.input {
  width: 100%;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  outline: none;
  transition: border-color 0.16s, box-shadow 0.16s;
}
.input::placeholder { color: var(--ink-3); }
/* Anillo de 4px en vez de 3: con el foco del navegador desactivado, este es
   el unico aviso de donde se esta escribiendo. */
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-tint); }

select.input {
  cursor: pointer;
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: right 12px center, right 8px center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
  padding-right: 26px;
}
select.input option { background: var(--surface); color: var(--ink); }

/* --- Portada -------------------------------------------------------------- */
/* Solo visible hasta la primera busqueda: explica que hace la herramienta y
   evita que la pagina arranque medio vacia. */
.intro {
  width: calc(100% - var(--gutter) * 2);
  max-width: calc(var(--page) - var(--gutter) * 2);
  margin: 26px auto 0;
}

.intro__steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

.step {
  padding: 22px 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}
.step__num {
  display: grid;
  place-items: center;
  width: 26px; height: 26px;
  margin-bottom: 13px;
  border-radius: 7px;
  background: var(--brand);
  color: var(--brand-on);
  font-size: 13px; font-weight: 650;
}
.step h2 { font-size: 15.5px; font-weight: 600; margin-bottom: 6px; }
.step p { color: var(--ink-2); font-size: 13.5px; line-height: 1.55; margin: 0; }

.intro__facts {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  overflow: hidden;
}
.fact { padding: 16px 14px; text-align: center; border-left: 1px solid var(--line); }
.fact:first-child { border-left: 0; }
.fact strong {
  display: block;
  font-size: 27px; font-weight: 700;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  /* La cifra en color de marca: son los datos que sostienen la promesa de la
     portada, y en gris pasaban desapercibidos. */
  color: var(--brand);
}
.fact span { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 3px; }

.intro__examples { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 20px; }
.intro__examples-label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 600; margin-right: 2px;
}

/* --- Progreso ------------------------------------------------------------- */
.progress-panel {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  animation: fadeUp 0.3s var(--ease);
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.progress-panel__head { display: flex; justify-content: space-between; align-items: center; gap: 14px; flex-wrap: wrap; }
.progress-panel__title { display: flex; align-items: center; gap: 9px; font-weight: 550; font-size: 13.5px; }
.progress-panel__meta { display: flex; align-items: center; gap: 12px; }
.progress-panel__meta span { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 13px; }

.pulse-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--tier-nobot);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }

.progressbar {
  margin: 12px 0 9px;
  height: 3px;
  border-radius: 99px;
  background: var(--surface-3);
  overflow: hidden;
}
.progressbar__fill {
  height: 100%;
  width: 0;
  border-radius: 99px;
  background: var(--brand);
  transition: width 0.4s var(--ease);
}

.progress-panel__message { color: var(--ink-2); font-size: 13px; margin: 0; }
.progress-panel__log { margin-top: 12px; font-size: 12px; }
.progress-panel__log summary {
  cursor: pointer; color: var(--ink-3); font-size: 12px;
  list-style: none;
}
.progress-panel__log summary::-webkit-details-marker { display: none; }
.progress-panel__log summary::before { content: "▸ "; }
.progress-panel__log[open] summary::before { content: "▾ "; }
.progress-panel__log ul {
  margin: 9px 0 0; padding: 10px 12px;
  max-height: 168px; overflow-y: auto;
  list-style: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--ink-2);
}
.progress-panel__log li { padding: 1.5px 0; }
.progress-panel__log li span { color: var(--ink-3); margin-right: 8px; }

/* --- Metricas ------------------------------------------------------------- */
/* Sin tarjetas: una sola fila dividida por lineas finas, como una tabla. */
.stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.stat {
  padding: 16px 16px 16px;
  border-left: 1px solid var(--line);
  position: relative;
  transition: background 0.16s;
}
.stat:first-child { border-left: 0; }

/* Barra de color permanente: dice de un vistazo que la tarjeta filtra. */
.stat[data-filter]:not([data-filter="none"])::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--accent-line, var(--ink-3));
  opacity: 0.32;
  transition: opacity 0.16s;
}
.stat[role="button"] { cursor: pointer; }
.stat[role="button"]:hover { background: var(--surface-2); }
.stat[role="button"]:hover::before { opacity: 0.75; }
.stat[role="button"]:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

.stat.is-active { background: var(--brand-tint); }
.stat.is-active::before { opacity: 1; height: 3px; }

.stat--gold { --accent-line: var(--tier-noweb); }
.stat--green { --accent-line: var(--tier-nobot); }
.stat--orange { --accent-line: var(--tier-modern); }
.stat--hot { --accent-line: var(--tier-noweb); }

.stat__label {
  display: block;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 600;
}
.stat__value {
  display: block;
  font-size: 38px; font-weight: 700; line-height: 1.1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  margin: 5px 0 3px;
}
.stat__hint { font-size: 12.5px; color: var(--ink-3); }
/* Sin color propio, el numero toma el de la marca: es la cifra que primero
   se busca al terminar una busqueda. */
.stat__value { color: var(--brand); }

.stat--gold .stat__value { color: var(--tier-noweb); }
.stat--green .stat__value { color: var(--tier-nobot); }
.stat--orange .stat__value { color: var(--tier-modern); }
.stat--hot .stat__value { color: var(--tier-noweb); }

/* --- Filtros -------------------------------------------------------------- */
.filters {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}

/* --- Cabecera plegable ----------------------------------------------------- */
.filters__head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.filters__head:hover { background: var(--surface-2); }

.filters__chevron {
  color: var(--ink-3);
  flex: none;
  transition: transform 0.18s var(--ease);
}
.filters__head.is-open .filters__chevron { transform: rotate(90deg); }

.filters__title { font-size: 14px; font-weight: 600; }

/* Cuantos filtros hay puestos. Con el panel cerrado es lo unico que avisa. */
.filters__badge {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 99px;
  background: var(--brand);
  color: var(--brand-on);
  font-size: 11.5px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}

.filters__hint {
  font-size: 12.5px;
  color: var(--ink-3);
  margin-left: auto;
  text-align: right;
}

.filters__body {
  padding: 4px 18px 16px;
  border-top: 1px solid var(--line);
}

@media (max-width: 620px) {
  .filters__hint { display: none; }
}
.filters__row { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
/* La separacion la pone .filters__group, que va justo debajo. */
.filters__row--chips { margin-bottom: 14px; align-items: center; gap: 6px; }
.filters__group .filters__row--chips { margin-bottom: 0; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 15px;
  border-radius: 99px;
  border: 1px solid var(--line-2);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px; font-weight: 580;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s, border-color 0.15s, color 0.15s,
              transform 0.15s, box-shadow 0.15s;
  white-space: nowrap;
}
.chip:hover {
  color: var(--ink); border-color: var(--ink-3); background: var(--surface-2);
  transform: translateY(-1px); box-shadow: var(--shadow-md);
}
.chip.is-active {
  background-color: var(--brand);
  background-image: var(--gradient);
  border-color: transparent;
  color: var(--brand-on);
  box-shadow: var(--shadow-brand);
}
.chip__count {
  font-size: 11px; font-variant-numeric: tabular-nums; font-weight: 550;
  padding: 0 5px; border-radius: 99px;
  background: var(--surface-3); color: var(--ink-3);
}
.chip.is-active .chip__count { background: rgba(255, 255, 255, 0.2); color: inherit; }
:root[data-theme="dark"] .chip.is-active .chip__count { background: rgba(0, 0, 0, 0.16); }

/* --- Barra de herramientas ------------------------------------------------ */
.toolbar {
  display: flex; justify-content: space-between; align-items: center;
  gap: 14px; flex-wrap: wrap;
}
.toolbar__left, .toolbar__right { display: flex; align-items: center; gap: 9px; }
.toolbar__count { color: var(--ink-2); font-size: 13px; font-variant-numeric: tabular-nums; }
.toolbar__label {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); font-weight: 600;
}

.segmented {
  display: inline-flex;
  padding: 2px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.segmented__item {
  padding: 5px 13px;
  border: 0; border-radius: var(--radius-xs);
  background: transparent;
  color: var(--ink-2);
  font: inherit; font-size: 12.5px; font-weight: 500;
  cursor: pointer;
  transition: background 0.16s, color 0.16s;
}
.segmented__item:hover { color: var(--ink); }
.segmented__item.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* --- Espacio de trabajo --------------------------------------------------- */
.workspace {
  display: grid;
  gap: 16px;
  margin-bottom: 24px;
  align-items: start;
}
.workspace[data-view="split"] { grid-template-columns: minmax(320px, 4fr) minmax(430px, 6fr); }
.workspace[data-view="table"] { grid-template-columns: 1fr; }
.workspace[data-view="table"] .panel--map { display: none; }
.workspace[data-view="map"] { grid-template-columns: 1fr; }
.workspace[data-view="map"] .panel--table { display: none; }
.workspace[data-view="map"] .map { height: min(74vh, 820px); }

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.panel__head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}
.panel__head h2 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-3); font-weight: 600;
}

.legend { display: flex; flex-wrap: wrap; gap: 11px; font-size: 11.5px; color: var(--ink-2); }
.legend__item { display: inline-flex; align-items: center; gap: 5px; }
.legend__dot { width: 7px; height: 7px; border-radius: 50%; }

/* Tipo de vista: callejero, satelite, hibrido o relieve.
   Control propio en vez del de Google, que no sigue ni la paleta ni el idioma. */
.maptypes {
  display: inline-flex;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius-sm);
  background: var(--surface);
}
.maptype {
  padding: 4px 9px;
  border: 0;
  border-radius: calc(var(--radius-sm) - 2px);
  background: transparent;
  color: var(--ink-3);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.maptype:hover { color: var(--ink); }
/* El elegido lleva el color de marca: sobre satelite el mapa es oscuro y con
   un simple gris no se distinguia cual estaba activo. */
.maptype.is-on {
  background-color: var(--brand);
  background-image: var(--gradient);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* --- Mapa ----------------------------------------------------------------- */
.map { width: 100%; height: min(62vh, 700px); background: var(--surface-2); }
.map__placeholder {
  display: none;
  padding: 48px 24px;
  text-align: center;
  color: var(--ink-2);
  font-size: 13px;
}
.panel--map.is-disabled .map { display: none; }
.panel--map.is-disabled .map__placeholder { display: block; }

/* Ventana emergente de Google Maps, adaptada al tema */
.gm-style .gm-style-iw-c {
  background: var(--surface) !important;
  border-radius: var(--radius) !important;
  box-shadow: var(--shadow-lg) !important;
  border: 1px solid var(--line) !important;
  padding: 13px !important;
}
.gm-style .gm-style-iw-d { overflow: auto !important; }
.gm-style .gm-style-iw-tc::after { background: var(--surface) !important; }
.gm-style-iw button[aria-label="Close"] span,
.gm-style-iw button.gm-ui-hover-effect span { background: var(--ink-2) !important; }

.iw { color: var(--ink); font-size: 12.5px; max-width: 258px; }
.iw__title { font-weight: 600; font-size: 14px; margin-bottom: 3px; letter-spacing: -0.01em; }
.iw__meta { color: var(--ink-2); font-size: 11.5px; margin-bottom: 8px; }
.iw__badges { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 9px; }
.iw__actions { display: flex; gap: 6px; }
.iw__actions a, .iw__actions button {
  font: inherit; font-size: 11.5px; padding: 4px 9px; border-radius: var(--radius-xs);
  border: 1px solid var(--line-2); background: var(--surface);
  color: var(--ink); text-decoration: none; cursor: pointer;
}
.iw__actions a:hover, .iw__actions button:hover { background: var(--surface-2); }

/* --- Tabla ---------------------------------------------------------------- */
.table-wrap { overflow: auto; max-height: min(72vh, 900px); }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }

.table thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 12px;
  text-align: left;
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
  font-weight: 600; color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table thead th.th-sort { cursor: pointer; user-select: none; }
.table thead th.th-sort:hover { color: var(--ink); }
.table thead th.is-sorted { color: var(--ink); }
.table thead th.is-sorted::after { content: " ↓"; }
.table thead th.is-sorted.is-asc::after { content: " ↑"; }
.th-actions { text-align: right; }

.table tbody tr { transition: background 0.12s; cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--brand-tint); }
.table tbody tr.is-selected td:first-child { box-shadow: inset 2px 0 0 var(--brand); }
.table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody td.td-actions { text-align: right; white-space: nowrap; }

/* --- Foto del negocio ----------------------------------------------------- */
.th-thumb { width: 56px; }
.cell-thumb { width: 56px; padding-right: 0; }

.thumb {
  display: block;
  width: 44px; height: 34px;
  border-radius: var(--radius-xs);
  overflow: hidden;
  background: var(--surface-3);
  position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Sin Street View queda la inicial del negocio, no un hueco vacio. */
.thumb.is-empty::after {
  content: attr(data-initial);
  position: absolute; inset: 0;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 600;
  color: var(--ink-3);
}

.drawer__photo {
  position: relative;
  margin: -22px -24px 20px;
  height: 150px;
  overflow: hidden;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
/* En absoluto a proposito. El boton de cerrar es `float: right`, y una <img>
   computa `overflow: clip`, asi que en flujo normal esquiva el float: bajaba
   40px, desbordaba su contenedor y se comia el titulo. Posicionada en
   absoluto ignora los floats y no puede salirse de la caja. */
.drawer__photo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Columna de empresa ----------------------------------------------------
   Foto, nombre, direccion y dominio en una sola celda. Antes iban en tres
   columnas separadas y la vista se rompia: leias el nombre aqui y su web
   quince centimetros a la derecha. */
.cell-name { min-width: 280px; }
.cell-name__wrap { display: flex; align-items: center; gap: 11px; }
.cell-name__text { min-width: 0; }
.cell-name strong {
  display: block;
  font-weight: 570;
  font-size: 13.5px;
  letter-spacing: -0.01em;
  line-height: 1.3;
}
.cell-name small {
  display: block;
  color: var(--ink-3);
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cell-name__web { display: block; margin-top: 2px; }
.cell-name__web a { font-size: 12px; }

/* Guion de "no hay dato": presente pero sin robar atencion. */
.cell-none { color: var(--line-2); }

/* --- Senales y contacto ----------------------------------------------------- */
.signals { display: inline-flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.cell-signals { max-width: 230px; }

.cell-contact { white-space: nowrap; }
.icon-link {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  margin-right: 3px;
  border-radius: var(--radius-xs);
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  text-decoration: none;
  transition: color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.icon-link:hover { color: var(--ink); border-color: var(--line-2); }
.icon-link--wa { color: var(--tier-nobot); border-color: var(--tint-nobot); background: var(--tint-nobot); }

/* --- Google: valoracion y resenas ------------------------------------------- */
.gmaps { display: flex; flex-direction: column; line-height: 1.2; }
.gmaps strong { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.gmaps small { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.th-num, .cell-google { width: 74px; }
/* Una sola linea con elipsis: con word-break las URLs largas se partian
   letra a letra en vertical y disparaban la altura de la fila. */
.cell-web { max-width: 200px; }
.cell-web a {
  display: block;
  color: var(--ink-2);
  text-decoration: none;
  font-size: 12.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid transparent;
}
.cell-web a:hover { color: var(--ink); border-bottom-color: var(--line-2); }
.cell-num { font-variant-numeric: tabular-nums; text-align: right; }
.cell-email { max-width: 190px; font-size: 12.5px; word-break: break-all; color: var(--ink-2); }
.cell-phone { white-space: nowrap; font-variant-numeric: tabular-nums; }
.cell-phone a { color: var(--ink-2); text-decoration: none; }
.cell-phone a:hover { color: var(--ink); }

/* --- Puntuacion ----------------------------------------------------------- */
.score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; padding: 3px 7px;
  border-radius: var(--radius-xs);
  font-weight: 600; font-size: 12.5px;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.score--no_website    { background: var(--tint-noweb);  color: var(--tier-noweb);  border-color: var(--tint-noweb); }
.score--no_chatbot    { background: var(--tint-nobot);  color: var(--tier-nobot);  border-color: var(--tint-nobot); }
.score--basic_chatbot { background: var(--tint-basic);  color: var(--tier-basic);  border-color: var(--tint-basic); }
.score--modern_chatbot{ background: var(--tint-modern); color: var(--tier-modern); border-color: var(--tint-modern); }
.score--ai_chatbot    { background: var(--tint-ai);     color: var(--tier-ai);     border-color: var(--tint-ai); }
.score--unknown, .score--pending { background: var(--surface-3); color: var(--ink-3); }

/* --- Madurez digital -------------------------------------------------------
   El numero grande con la palabra debajo. La barrita anterior obligaba a
   traducir un color a una idea; "18 · Sin presencia" ya es la idea. */
.cell-maturity, .th-maturity { width: 120px; }

.madurez { display: flex; flex-direction: column; line-height: 1.15; }
.madurez strong {
  font-size: 17px;
  font-weight: 640;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.madurez small {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Cuanto MAS baja la madurez, mas roja: es la mejor oportunidad de venta. */
.madurez--ausente strong     { color: var(--tier-ai); }
.madurez--inicial strong     { color: var(--tier-modern); }
.madurez--basico strong      { color: var(--tier-basic); }
.madurez--consolidado strong { color: var(--tier-nobot); }
.madurez--avanzado strong    { color: var(--tier-noweb); }

/* Nota grande de la ficha */
.mscore {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink-3);
}
.mscore--ausente { border-left-color: var(--tier-ai); }
.mscore--inicial { border-left-color: var(--tier-modern); }
.mscore--basico { border-left-color: var(--tier-basic); }
.mscore--consolidado { border-left-color: var(--tier-nobot); }
.mscore--avanzado { border-left-color: var(--tier-noweb); }

.mscore__value {
  font-size: 30px; font-weight: 650; letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums; line-height: 1;
}
.mscore__text strong { display: block; font-size: 14px; font-weight: 600; }
.mscore__text small { color: var(--ink-3); font-size: 12px; }

.mblocks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 7px; }
.mblock { display: grid; grid-template-columns: 128px 1fr 34px; align-items: center; gap: 9px; font-size: 12px; }
.mblock__label { color: var(--ink-2); }
.mblock__bar { height: 5px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.mblock__fill { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.mblock__pct { text-align: right; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.msub {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--ink-3); font-weight: 600; margin: 14px 0 7px;
}

.mlist { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; font-size: 13px; }
.mlist li { padding-left: 17px; position: relative; color: var(--ink-2); }
.mlist li::before { position: absolute; left: 0; font-weight: 700; }
.mlist--good li::before { content: "+"; color: var(--tier-nobot); }
.mlist--bad li::before { content: "−"; color: var(--tier-modern); }

/* --- Oportunidades comerciales -------------------------------------------- */
.opps { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.opp {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--tier-noweb);
  border-radius: var(--radius-xs);
  background: var(--surface-2);
}
.opp strong { display: block; font-size: 13px; font-weight: 600; }
.opp small { display: block; color: var(--ink-2); font-size: 12px; margin-top: 2px; }

/* --- Grupos de filtros ---------------------------------------------------- */
/* Son mas de cuarenta filtros: sueltos en una fila eran un muro ilegible.
   Cada grupo se pliega por su cuenta con <details>, sin JavaScript propio. */
.filters__groups { margin-top: 14px; border-top: 1px solid var(--line); }

.fgroup { border-bottom: 1px solid var(--line); }
.fgroup:last-child { border-bottom: 0; }

.fgroup__head {
  display: flex;
  align-items: baseline;
  gap: 9px;
  padding: 11px 2px 11px 20px;
  cursor: pointer;
  list-style: none;
  position: relative;
  user-select: none;
}
.fgroup__head::-webkit-details-marker { display: none; }
/* Flecha propia: la del navegador no se puede colocar ni colorear. */
.fgroup__head::after {
  content: "";
  position: absolute;
  left: 4px; top: 50%;
  width: 0; height: 0;
  margin-top: -4px;
  border-left: 5px solid var(--ink-3);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform 0.18s var(--ease);
}
.fgroup[open] > .fgroup__head::after { transform: rotate(90deg); }
.fgroup__head:hover .fgroup__title { color: var(--ink); }
.fgroup__head:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; border-radius: 4px; }

.fgroup__title { font-size: 13px; font-weight: 600; color: var(--ink-2); white-space: nowrap; }
.fgroup__hint { font-size: 12px; color: var(--ink-3); flex: 1; }
.fgroup__badge {
  flex: none;
  min-width: 18px; padding: 1px 6px;
  border-radius: 99px;
  background: var(--brand); color: var(--brand-on);
  font-size: 11px; font-weight: 650; text-align: center;
  align-self: center;
}

.fgroup__chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 2px 14px 20px; }

/* Los chips de senal son mas discretos: son muchos y secundarios. */
.chip--signal { font-weight: 500; font-size: 12px; padding: 5px 11px; }

/* --- Etiquetas ------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11.5px; font-weight: 500;
  border: 1px solid var(--line-2);
  background: transparent;
  color: var(--ink-2);
  white-space: nowrap;
}
.badge--good { background: var(--tint-nobot); color: var(--tier-nobot); border-color: transparent; font-weight: 600; }
.badge--warn { background: var(--tint-basic); color: var(--tier-basic); border-color: transparent; }
.badge--bad  { background: var(--tint-ai); color: var(--tier-ai); border-color: transparent; }
.badge--hot  { background: var(--tint-noweb); color: var(--tier-noweb); border-color: transparent; font-weight: 600; }
.badge--info { background: var(--surface-3); color: var(--ink-2); border-color: transparent; }
.badge--muted { color: var(--ink-3); border-color: var(--line); }

.dot-yes, .dot-no { display: inline-block; width: 7px; height: 7px; border-radius: 50%; }
.dot-yes { background: var(--tier-nobot); }
.dot-no  { background: var(--line-2); }

.skeleton {
  display: block; height: 11px; border-radius: var(--radius-xs);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

/* --- Estado vacio --------------------------------------------------------- */
.empty { padding: 72px 26px; text-align: center; color: var(--ink-2); }
.empty__art { color: var(--line-2); margin-bottom: 18px; display: flex; justify-content: center; }
.empty h3 { font-size: 17px; margin-bottom: 7px; }
.empty p { font-size: 13.5px; }
.empty__hint { font-size: 12.5px; color: var(--ink-3); max-width: 460px; margin: 16px auto 0; }

/* --- Ficha lateral -------------------------------------------------------- */
.drawer { position: fixed; inset: 0; z-index: 60; }
.drawer__backdrop {
  position: absolute; inset: 0;
  background: rgba(19, 20, 23, 0.32);
  animation: fadeIn 0.2s var(--ease);
}
:root[data-theme="dark"] .drawer__backdrop { background: rgba(0, 0, 0, 0.55); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer__panel {
  position: absolute; top: 0; right: 0; bottom: 0;
  width: min(540px, 100%);
  background: var(--surface);
  border-left: 1px solid var(--line);
  overflow-y: auto;
  animation: slideIn 0.26s var(--ease);
  box-shadow: var(--shadow-lg);
}
@keyframes slideIn { from { transform: translateX(24px); opacity: 0; } to { transform: none; opacity: 1; } }

.drawer__close {
  position: sticky; top: 12px; float: right;
  margin: 12px 14px 0 0;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--radius-xs);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 18px; line-height: 1; cursor: pointer;
  z-index: 2;
}
.drawer__close:hover { background: var(--surface-2); color: var(--ink); }
.drawer__content { padding: 22px 24px 44px; }
.drawer__content h2 { font-size: 19px; margin-bottom: 3px; padding-right: 44px; letter-spacing: -0.02em; }

.drawer__subtitle { color: var(--ink-2); font-size: 12.5px; margin-bottom: 18px; }
.drawer__score {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 15px; margin-bottom: 22px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.drawer__score .score { font-size: 19px; min-width: 52px; padding: 7px 10px; }
.drawer__score-text strong { display: block; font-size: 13.5px; font-weight: 550; }
.drawer__score-text small { color: var(--ink-3); font-size: 12px; }

.drawer__section {
  margin-bottom: 22px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}
.drawer__section:last-of-type { border-bottom: 0; padding-bottom: 0; }
.drawer__section h3 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.09em;
  color: var(--ink-3); margin-bottom: 10px; font-weight: 600;
}
.drawer__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.drawer__list li { display: flex; gap: 12px; font-size: 13px; }
.drawer__list li span:first-child { color: var(--ink-3); min-width: 112px; flex: none; }
/* El horario no lleva etiqueta: sin esto sus lineas quedan sangradas 112px. */
.drawer__list li span:first-child:empty { min-width: 0; }
.drawer__list a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; text-decoration-color: var(--line-2); word-break: break-all; }
.drawer__list a:hover { text-decoration-color: currentColor; }

.drawer__badges { display: flex; flex-wrap: wrap; gap: 6px; }
.drawer__reasons { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.drawer__reasons li {
  padding: 8px 0 8px 16px;
  position: relative;
  font-size: 13px; color: var(--ink-2);
  border-bottom: 1px solid var(--line);
}
.drawer__reasons li:last-child { border-bottom: 0; }
.drawer__reasons li::before {
  content: "";
  position: absolute; left: 0; top: 15px;
  width: 5px; height: 1px;
  background: var(--ink-3);
}

.evidence {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px; color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 13px;
  max-height: 190px; overflow: auto;
  white-space: pre-wrap; word-break: break-all;
}

.drawer__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

/* --- Avisos --------------------------------------------------------------- */
.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 90;
  display: grid; gap: 8px; max-width: 360px;
}
.toast {
  padding: 11px 15px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  color: var(--ink);
  animation: toastIn 0.24s var(--ease);
}
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast--error { border-left: 2px solid var(--tier-ai); }
.toast--success { border-left: 2px solid var(--tier-nobot); }
.toast.is-leaving { opacity: 0; transform: translateY(8px); transition: all 0.22s var(--ease); }

/* --- Pie ------------------------------------------------------------------ */
.footer {
  max-width: var(--page); margin: 0 auto; padding: 22px var(--gutter) 32px;
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: 12px;
}
.footer p { margin: 0; }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1240px) {
  .workspace[data-view="split"] { grid-template-columns: 1fr; }
  .map { height: 46vh; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stat:nth-child(4) { border-left: 0; }
  .stat:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .hunt__grid { grid-template-columns: repeat(2, 1fr); }
  .intro__facts { grid-template-columns: repeat(3, 1fr); }
  .fact:nth-child(4) { border-left: 0; }
  .fact:nth-child(n + 4) { border-top: 1px solid var(--line); }
}

@media (max-width: 900px) {
  :root { --gutter: 16px; }
  /* Dos columnas: la marca a la izquierda y los botones pegados al borde
     derecho. Antes quedaban repartidos a media distancia y la cabecera se
     veia descuadrada. */
  .topbar__inner {
    grid-template-columns: auto 1fr;
    gap: 12px;
    padding: 8px var(--gutter);
    min-height: 54px;
  }
  .topbar__spacer { display: none; }
  .topbar__actions { justify-self: end; gap: 4px; }
  /* El selector de idioma es lo primero que sobra cuando falta sitio: el
     idioma tambien se cambia desde el sistema y no se toca a diario. */
  .hunt { padding: 20px 18px; }
  .hunt__title { font-size: 21px; }
  .hunt__grid { grid-template-columns: 1fr; }
  .hunt__foot { flex-direction: column; align-items: stretch; }
  .btn--cta { width: 100%; }
  .intro__steps { grid-template-columns: 1fr; }
  .intro__facts { grid-template-columns: repeat(2, 1fr); }
  .fact { border-left: 0; border-top: 1px solid var(--line); }
  .fact:nth-child(odd) { border-right: 1px solid var(--line); }
  .fact:nth-child(-n + 2) { border-top: 0; }
  /* En movil la pista de cada grupo no cabe y parte el titulo. */
  .fgroup__hint { display: none; }
  .logo__text small { display: none; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat { border-left: 0; border-top: 1px solid var(--line); }
  .stat:nth-child(odd) { border-right: 1px solid var(--line); }
  .stat:nth-child(-n + 2) { border-top: 0; }
  .stat__value { font-size: 23px; }
  .toolbar { flex-direction: column; align-items: stretch; }
  .toolbar__left, .toolbar__right { justify-content: space-between; }
  .drawer__panel { width: 100%; border-left: 0; }
  .table-wrap { max-height: none; }
  .table { font-size: 12.5px; }
  /* Columnas: 1 punt · 2 empresa · 3 madurez · 4 senales · 5 Google
     6 contacto. En pantalla estrecha sobra Google: la valoracion no decide a
     quien llamar, y sigue estando en la ficha. */
  .table td:nth-child(5), .table th:nth-child(5) { display: none; }
  .cell-name { min-width: 200px; }
}

@media (max-width: 560px) {
  /* Ademas las senales: en un movil no caben y la ficha las tiene todas. */
  .table td:nth-child(4), .table th:nth-child(4) { display: none; }

  /* En pantallas estrechas la cabecera no daba de si y el ultimo boton se
     salia. Se deja solo el icono de la marca: es lo unico prescindible ahi
     arriba, porque el nombre ya esta en la pestana del navegador. */
  .logo__text { display: none; }
  .toasts { left: 16px; right: 16px; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .topbar, .hunt, .toolbar, .filters, .progress-panel, .panel--map, .footer, .toasts { display: none !important; }
  body { background: #fff; color: #000; }
  .panel, .stats { border: 1px solid #ccc; }
  .table-wrap { max-height: none; overflow: visible; }
}
