/* ============================================================
   identidad.css — Identidad visual del Agente de WhatsApp
   Único lugar de verdad: colores, tipografía, radios y componentes base.

   Uso en cada pantalla:
     <link rel="stylesheet" href="assets/identidad.css">

   Las fuentes se cargan aquí con @import (autocontenido). Si prefieres
   mejor rendimiento, quita el @import y pon esto en el <head> de cada página:
     <link rel="preconnect" href="https://fonts.googleapis.com">
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
     <link href="https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,700&family=Hanken+Grotesk:wght@400;500;600&display=swap" rel="stylesheet">
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,700&family=Hanken+Grotesk:wght@400;500;600&display=swap');

:root {
  /* --- Marca / colores (paleta teal / azul petróleo) --- */
  --marca:         #0A2B3A;   /* azul petróleo profundo: color de marca */
  --accion:        #138496;   /* teal: CTA */
  --accion-texto:  #FFFFFF;   /* texto sobre el CTA */
  --accion-hover:  #0F6E7D;   /* teal más oscuro: hover del CTA */
  --tinta:         #0E1B22;   /* texto principal */
  --texto-2:       #57707A;   /* texto secundario */
  --fondo:         #F4F8F9;   /* fondo base */
  --superficie:    #FFFFFF;   /* tarjetas / superficies */
  --borde:         #DDE7EA;   /* bordes */
  --badge-bg:      #E2F0F3;   /* acento claro (badge) */
  --badge-texto:   #0A2B3A;

  /* --- Estados (sobrios, alineados a la paleta) --- */
  --error-bg: #FCEBEB;  --error-texto: #8B1F1F;  --error-borde: #F0C4C4;
  --aviso-bg: #FBF1DD;  --aviso-texto: #7A4E0B;  --aviso-borde: #EBD3A0;
  --ok-bg:    #E2F0F3;  --ok-texto:    #0A2B3A;  --ok-borde:    #BBDCE2;

  /* --- Tipografía --- */
  --fuente-titulo: "Bricolage Grotesque", "Hanken Grotesk", system-ui, sans-serif;
  --fuente-cuerpo: "Hanken Grotesk", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  /* --- Radios --- */
  --radio-sm: 6px;
  --radio:    9px;
  --radio-lg: 14px;

  /* --- Sombra sutil (sin adornos) --- */
  --sombra:    0 1px 2px rgba(14, 27, 34, .05), 0 6px 20px rgba(14, 27, 34, .05);
  --sombra-sm: 0 1px 2px rgba(14, 27, 34, .06);
}

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

body {
  margin: 0;
  font-family: var(--fuente-cuerpo);
  color: var(--tinta);
  background: var(--fondo);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.5;
}

h1, h2, h3 {
  font-family: var(--fuente-titulo);
  font-weight: 700;
  color: var(--tinta);
  letter-spacing: -0.01em;
  margin: 0;
}

a { color: var(--marca); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Marca (lockup: ícono + nombre)
   ============================================================ */
.marca { display: inline-flex; align-items: center; gap: 10px; }
.marca__icono {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--marca); color: #fff; font-size: 17px;
}
.marca__nombre {
  font-family: var(--fuente-titulo); font-weight: 700; font-size: 18px;
  color: var(--tinta); letter-spacing: -0.01em; line-height: 1;
}

/* ============================================================
   Badge
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--badge-bg); color: var(--badge-texto);
  font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px;
}

/* ============================================================
   Formularios
   ============================================================ */
.etiqueta {
  display: block; font-size: 13px; font-weight: 500;
  color: var(--texto-2); margin: 14px 0 6px;
}

.campo {
  width: 100%;
  padding: 11px 13px;
  font-family: var(--fuente-cuerpo); font-size: 14px;
  color: var(--tinta); background: var(--superficie);
  border: 1.5px solid var(--borde); border-radius: var(--radio);
  transition: border-color .15s ease, box-shadow .15s ease;
}
.campo::placeholder { color: #9DB0B7; }
.campo:focus {
  outline: none;
  border-color: var(--marca);
  box-shadow: 0 0 0 3px rgba(19, 132, 150, .18);
}
/* El autorelleno del navegador no debe pintar el input de azul/amarillo */
.campo:-webkit-autofill,
.campo:-webkit-autofill:hover,
.campo:-webkit-autofill:focus {
  -webkit-box-shadow: 0 0 0 1000px var(--superficie) inset;
  -webkit-text-fill-color: var(--tinta);
  caret-color: var(--tinta);
}

/* ============================================================
   Botones
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--fuente-cuerpo); font-size: 15px; font-weight: 600;
  padding: 12px 18px; border-radius: var(--radio);
  border: 1.5px solid transparent; cursor: pointer;
  transition: background-color .15s ease, border-color .15s ease, opacity .15s ease;
}
.btn--bloque { width: 100%; }

.btn--primario { background: var(--accion); color: var(--accion-texto); }
.btn--primario:hover { background: var(--accion-hover); }

.btn--secundario {
  background: var(--superficie); color: var(--marca);
  border-color: var(--marca);
}
.btn--secundario:hover { background: var(--badge-bg); }

/* ============================================================
   Alertas / avisos
   ============================================================ */
.alerta {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 13px; padding: 10px 13px; border-radius: var(--radio);
  border: 1px solid transparent; margin-bottom: 14px;
}
.alerta i { margin-top: 1px; }
.alerta--error { background: var(--error-bg); color: var(--error-texto); border-color: var(--error-borde); }
.alerta--aviso { background: var(--aviso-bg); color: var(--aviso-texto); border-color: var(--aviso-borde); }
.alerta--ok    { background: var(--ok-bg);    color: var(--ok-texto);    border-color: var(--ok-borde); }

/* ============================================================
   Layout de app: barra lateral (sidebar) + contenido
   ============================================================ */
body.app { display: flex; min-height: 100vh; }

.sidebar { width: 244px; flex-shrink: 0; background: var(--marca); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.sidebar__marca { display: flex; align-items: center; gap: 10px; padding: 18px 16px 14px; }
.sidebar__marca .marca__icono { background: rgba(255,255,255,.12); }
.sidebar__marca .marca__nombre { color: #fff; font-size: 15px; }
.sidebar__ctx { margin: 2px 14px 10px; padding: 9px 12px; background: rgba(255,255,255,.06); border-radius: 8px; }
.sidebar__ctx small { display: block; color: #8FAEB7; font-size: 11px; }
.sidebar__ctx strong { color: #fff; font-size: 14px; }
.sidebar__nav { display: flex; flex-direction: column; padding: 6px 0; }
.nav-item { display: flex; align-items: center; gap: 11px; padding: 10px 14px; margin: 2px 10px; border-radius: 8px; color: #B6CDD4; text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.nav-item.activo { background: rgba(20,184,102,.20); color: #fff; }
.nav-item i { width: 18px; text-align: center; font-size: 15px; }
.nav-item--volver { color: #8FAEB7; font-size: 13px; font-weight: 400; }
.nav-badge { margin-left: auto; background: #E24B4A; color: #fff; font-size: 11px; font-weight: 700; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; }
.sidebar__pie { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.10); }
.sidebar__user { font-size: 12px; color: #8FAEB7; margin-bottom: 6px; word-break: break-all; }
.sidebar__pie a { color: #fff; font-size: 13px; text-decoration: none; }
.sidebar__pie a:hover { text-decoration: underline; }

.contenido { flex: 1; min-width: 0; padding: 30px 34px; max-width: 1000px; }
.contenido--plano { padding: 0; display: flex; flex-direction: column; height: 100vh; max-width: none; }
.contenido__h1 { font-size: 26px; margin: 0 0 22px; }

@media (max-width: 860px) {
  body.app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .sidebar__nav { flex-direction: row; flex-wrap: wrap; padding: 4px 8px 8px; }
  .nav-item { margin: 2px 4px; }
  .sidebar__pie { display: flex; align-items: center; justify-content: space-between; margin-top: 0; }
  .sidebar__user { margin: 0; }
  .contenido { padding: 22px 18px; }
  .contenido--plano { height: auto; }
}

/* ---- Teléfono: ajustes finos para que todo se vea bien en pantallas angostas ---- */
@media (max-width: 640px) {
  /* Campos de formulario a ancho completo (anula anchos fijos en px) y apilados */
  input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"]),
  select, textarea {
    width: 100% !important; max-width: 100% !important; box-sizing: border-box; margin-right: 0;
  }
  .alta .fila { flex-direction: column; align-items: stretch; gap: 12px; }
  .alta .campo-mini { width: 100%; }
  .campo-fila { grid-template-columns: 1fr !important; }
  .ficha-grid { grid-template-columns: 1fr !important; }

  /* Tablas anchas: se envuelven en .tabla-scroll (ver abajo). Aquí evitamos que
     el texto se parta en muchas líneas dentro del scroll. */
  .tabla-scroll > table { white-space: nowrap; }
  /* Otros elementos con ancho fijo que podrían desbordar en el teléfono */
  .conv .prev { max-width: 100% !important; }

  /* Guard: la página NUNCA debe deslizarse de lado (las tablas scrollean solas) */
  .contenido { overflow-x: hidden; }

  /* Espaciado y títulos más compactos */
  .contenido { padding: 16px 13px; }
  .contenido__h1 { font-size: 21px; margin-bottom: 16px; }
  h2.seccion-t { font-size: 16px; margin: 20px 0 12px; }
  .panel, .tarjeta { padding: 14px 15px; }

  /* Sidebar más compacto y nav como tira deslizable de una sola fila */
  .sidebar__marca { padding: 12px 14px 8px; }
  .sidebar__ctx { margin: 2px 12px 8px; }
  .sidebar__nav { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; padding: 4px 8px 10px; }
  .sidebar__nav::-webkit-scrollbar { display: none; }
  .nav-item { flex: 0 0 auto; padding: 9px 13px; font-size: 13.5px; }

  /* Botones más cómodos al tacto */
  .btn { padding: 11px 16px; }
}

/* ============================================================
   Componentes de dashboard (reutilizables en todas las pantallas)
   ============================================================ */
h2.seccion-t { font-family: var(--fuente-titulo); font-size: 17px; font-weight: 700; margin: 28px 0 14px; }
.tarjeta { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 16px 18px; margin-bottom: 12px; }
.panel { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 18px 20px; }
.panel h3 { font-family: var(--fuente-titulo); font-size: 15px; font-weight: 700; margin: 0 0 12px; }
.panel input, .panel select { padding: 10px 12px; border: 1.5px solid var(--borde); border-radius: var(--radio); font-size: 14px; font-family: var(--fuente-cuerpo); color: var(--tinta); background: var(--superficie); margin: 0 6px 8px 0; }
.vacio { background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); padding: 22px; text-align: center; color: var(--texto-2); margin-bottom: 12px; }
.input-mini { padding: 7px 10px; border: 1.5px solid var(--borde); border-radius: var(--radio-sm); font-size: 13px; font-family: var(--fuente-cuerpo); color: var(--tinta); background: var(--superficie); }
.btn-mini { padding: 7px 12px; border: 1.5px solid var(--borde); background: var(--superficie); color: var(--tinta); border-radius: var(--radio-sm); font-size: 13px; cursor: pointer; }
.btn-mini:hover { background: #F4F8F9; }
/* Envoltorio para tablas: en pantallas angostas la tabla scrollea de lado dentro
   de este contenedor en vez de romper la página. Inocuo en escritorio. */
.tabla-scroll { max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tabla { width: 100%; border-collapse: collapse; background: var(--superficie); border: 1px solid var(--borde); border-radius: var(--radio); overflow: hidden; }
.tabla th, .tabla td { text-align: left; padding: 11px 14px; font-size: 13px; border-bottom: 1px solid var(--borde); }
.tabla th { background: #F4F8F9; color: var(--texto-2); font-weight: 600; font-size: 12px; }
.tabla tr:last-child td { border-bottom: 0; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--badge-bg); color: var(--badge-texto); }
.pill--violeta { background: #ECE9FB; color: #534AB7; }
