/* CRM Prospector — tokens base derivados del Ferroplast Design System
 * Mantenemos los nombres del DS (--gpf-*, --mute-*, --ink-*) y añadimos
 * tokens semánticos específicos del CRM (--cta, --surface-hi, --surface-lo).
 */

:root {
  /* --- Paleta corporativa (DS) --- */
  --gpf-blue-900: #0a2d52;
  --gpf-blue-700: #124b8a;
  --gpf-blue-500: #1f72c7;
  --gpf-blue-100: #e6f0fa;

  --mute-red: #c8102e;
  --mute-red-dark: #8a0b20;

  /* --- Neutros --- */
  --ink-900: #101418;
  --ink-700: #2a3138;
  --ink-500: #5b6672;
  --ink-300: #a7b0ba;
  --ink-200: #d7dde3;
  --ink-100: #eef1f4;
  --paper: #ffffff;
  --paper-warm: #f7f5f1;

  /* --- Semántica CRM --- */
  --fg-1: var(--ink-900);
  --fg-2: var(--ink-700);
  --fg-3: var(--ink-500);
  --fg-muted: var(--ink-300);
  --bg-app: var(--paper-warm);
  --bg-card: var(--paper);
  --bg-inverse: var(--gpf-blue-900);
  --line: var(--ink-200);
  --line-strong: var(--ink-300);

  /* Aliases de conveniencia usados en pantallas planificador / mapa / importar */
  --bg-1: var(--paper);          /* = --bg-card */
  --bg-2: var(--ink-100);        /* panel secundario / toolbar */
  --border-1: var(--ink-200);    /* = --line */
  --border-2: var(--ink-300);    /* = --line-strong */
  --fg-4: var(--ink-300);        /* texto muy apagado = --fg-muted */

  /* Acción primaria: azul GPF (acción técnica habitual)
   * Acción crítica / de campo: rojo MUTE (sólo para "Cómo llegar",
   * borrar, alertas — el rojo es escaso en el DS, así lo mantenemos). */
  --cta: var(--gpf-blue-700);
  --cta-hover: var(--gpf-blue-900);
  --cta-strong: var(--mute-red);
  --cta-strong-hover: var(--mute-red-dark);

  /* Estados de cuadrante CRM (Q1-Q9) — escala neutra → cálida */
  --q-estrategico:    #0a2d52;
  --q-cliente-core:   #124b8a;
  --q-cliente-volumen:#1f72c7;
  --q-puerta:         #1f8a5b;
  --q-cartera:        #5b6672;
  --q-mantenimiento:  #8a96a3;
  --q-conector:       #b8541f;
  --q-seguimiento:    #a7b0ba;
  --q-congelar:       #d7dde3;

  /* Tipo */
  --font-display: "Barlow Condensed", "Arial Narrow", sans-serif;
  --font-sans: "Inter", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  /* Escala tipográfica móvil (cómoda en sol, ≥16px body) */
  --fs-eyebrow: 11px;
  --fs-cap:     12px;
  --fs-body-s:  14px;
  --fs-body:    16px;
  --fs-body-l:  18px;
  --fs-h4:      20px;
  --fs-h3:      24px;
  --fs-h2:      30px;
  --fs-h1:      40px;
  --fs-display: 64px;

  /* Espaciado base 4px */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 48px;

  /* Radios — industrial, escasos */
  --radius-s: 2px;
  --radius-m: 6px;
  --radius-l: 10px;
  --radius-pill: 999px;

  /* Sombras suaves, color marca */
  --shadow-1: 0 1px 2px rgba(10,45,82,.06), 0 1px 1px rgba(10,45,82,.04);
  --shadow-2: 0 8px 24px rgba(10,45,82,.10), 0 2px 6px rgba(10,45,82,.05);
  --shadow-modal: 0 24px 60px rgba(10,45,82,.22), 0 8px 18px rgba(10,45,82,.12);

  /* Safe-area iOS (las usamos en los frames móvil) */
  --safe-top: 44px;
  --safe-bot: 34px;
}

/* Reset suave dentro de artboards */
.crm-root, .crm-root * { box-sizing: border-box; }
.crm-root {
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  color: var(--fg-1);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.crm-root h1, .crm-root h2, .crm-root h3, .crm-root h4 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.05;
  color: var(--fg-1);
}
.crm-root .eyebrow {
  font-family: var(--font-sans);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
}
.crm-root .mono { font-family: var(--font-mono); }

/* iPhone frame chrome */
.iphone {
  width: 390px;
  height: 844px;
  background: var(--bg-app);
  position: relative;
  overflow: hidden;
  font-family: var(--font-sans);
  color: var(--fg-1);
  display: flex;
  flex-direction: column;
}
.iphone .statusbar {
  height: var(--safe-top);
  padding: 16px 28px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-900);
  letter-spacing: -0.01em;
  flex: 0 0 auto;
  background: transparent;
  z-index: 5;
}
.iphone .statusbar .right { display: flex; gap: 5px; align-items: center; }
.iphone .home-indicator {
  position: absolute;
  bottom: 8px; left: 50%;
  transform: translateX(-50%);
  width: 134px; height: 5px;
  background: var(--ink-900);
  border-radius: 3px;
  opacity: 0.35;
  z-index: 20;
}

/* Botones genéricos */
.btn {
  appearance: none;
  border: 0;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: var(--fs-body);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 0 var(--sp-5);
  height: 48px;
  border-radius: var(--radius-m);
  cursor: pointer;
  letter-spacing: -0.005em;
  transition: background .12s, color .12s, transform .04s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--cta); color: #fff; }
.btn-primary:hover { background: var(--cta-hover); }
.btn-strong { background: var(--cta-strong); color: #fff; }
.btn-strong:hover { background: var(--cta-strong-hover); }
.btn-ghost { background: transparent; color: var(--fg-1); border: 1px solid var(--line-strong); }
.btn-ghost:hover { background: var(--ink-100); }
.btn-block { width: 100%; }
.btn-lg { height: 56px; font-size: var(--fs-body-l); }

/* Tarjetas */
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-l);
}
.card-flat { background: var(--bg-card); border: 1px solid var(--line); }

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 26px;
  padding: 0 10px;
  border-radius: var(--radius-pill);
  font-size: var(--fs-cap);
  font-weight: 600;
  background: var(--ink-100);
  color: var(--fg-2);
  letter-spacing: -0.005em;
  border: 1px solid var(--line);
}
.chip-accent { background: var(--gpf-blue-100); color: var(--gpf-blue-700); border-color: transparent; }
.chip-red    { background: #fbe4e7; color: var(--mute-red-dark); border-color: transparent; }
.chip-green  { background: #e3f3ec; color: #14704a; border-color: transparent; }

/* Tipografía utilitaria */
.t-display { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.005em; }
.t-eyebrow { font-size: var(--fs-eyebrow); letter-spacing: 0.16em; text-transform: uppercase; color: var(--fg-3); font-weight: 600; }
.t-num     { font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.muted { color: var(--fg-3); }

/* Inputs */
.field {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: 14px 16px;
  font-size: var(--fs-body);
  width: 100%;
  font-family: inherit;
  color: var(--fg-1);
  min-height: 52px;
}
.field:focus { outline: 2px solid var(--gpf-blue-500); outline-offset: -1px; border-color: var(--gpf-blue-500); }
.field-label {
  display: block;
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-3);
  font-weight: 600;
  margin-bottom: 6px;
}

/* Iconos lucide-style (1.75 stroke) */
.icon { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.75; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* --- Accesibilidad --- */
/* Focus visible — anillo azul GPF de 2px con offset, sólo cuando se navega por teclado */
.crm-root button:focus-visible,
.crm-root [role="button"]:focus-visible,
.crm-root .field:focus-visible,
.crm-root input:focus-visible,
.crm-root textarea:focus-visible,
.crm-root select:focus-visible,
.crm-root a:focus-visible {
  outline: 2px solid var(--gpf-blue-500);
  outline-offset: 2px;
  border-radius: var(--radius-m);
}

/* Sobre fondos oscuros (sidebar, hero próxima visita) — anillo claro */
.crm-root .on-dark button:focus-visible,
.crm-root .on-dark [role="button"]:focus-visible {
  outline-color: #7fb1e6;
  outline-offset: 3px;
}

/* Reducción de movimiento */
@media (prefers-reduced-motion: reduce) {
  .crm-root *, .crm-root *::before, .crm-root *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* Skeleton shimmer */
.skeleton {
  background: linear-gradient(90deg, var(--ink-100) 0%, var(--paper-warm) 50%, var(--ink-100) 100%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-m);
}
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
