/* ============================================================
   S.I.N.S.A — Design System
   Paleta extraída pixel a pixel del logo de la marca:
     verde salud  #00994A
     esferas      #E5172B → #EC614A → #F08A74
     blanco       #FFFFFF
   ============================================================ */

/* ---------- 1. TOKENS ---------- */

:root,
[data-theme="light"] {
  --bg-primary:     #FFFFFF;
  --bg-secondary:   #F2F7F4;
  --bg-tertiary:    #E4EFE9;
  --text-primary:   #12211A;
  --text-secondary: #4A5C52;
  --text-muted:     #64726A;   /* AA: 5.05:1 sobre blanco, 4.66:1 sobre bg-secondary */
  --border:         #D2E0D8;
  --border-fuerte:  #B4C9BE;

  /* verde de marca: --accent para superficies y gráfica,
     --accent-deep para texto/botones (contraste AA real) */
  --accent:         #00994A;
  --accent-deep:    #00773A;
  --accent-hover:   #005E2D;
  --accent-text:    #FFFFFF;
  --accent-suave:   #E1F2E8;

  /* degradé de las esferas del logo */
  --orb-1:          #E5172B;
  --orb-2:          #EC614A;
  --orb-3:          #F08A74;
  --coral:          #BF422D;   /* AA en sus dos roles: texto en chip y fondo de botón */
  --coral-suave:    #FDECE8;
  --coral-text:     #FFFFFF;

  --danger:         #C0392B;
  --danger-text:    #FFFFFF;
  --success:        #00773A;
  --warning:        #A85C08;
  --warning-text:   #FFFFFF;
  --info:           #1B5FA8;
  --info-text:      #FFFFFF;

  --surface:        #FFFFFF;
  --surface-alt:    #F2F7F4;
  --shadow-sm:      0 1px 2px rgba(18,33,26,.06), 0 2px 8px rgba(18,33,26,.05);
  --shadow-md:      0 4px 14px rgba(18,33,26,.09), 0 1px 3px rgba(18,33,26,.06);
  --shadow-lg:      0 18px 48px rgba(18,33,26,.16);
  --ripple-color:   rgba(255,255,255,.45);
  --overlay:        rgba(12,20,17,.55);
}

[data-theme="dark"] {
  --bg-primary:     #0C1411;
  --bg-secondary:   #131F1A;
  --bg-tertiary:    #1B2B24;
  --text-primary:   #EDF5F0;
  --text-secondary: #A3B5AB;
  --text-muted:     #768B80;   /* AA: 5.14:1 sobre bg-primary, 4.66:1 sobre surface */
  --border:         #26362E;
  --border-fuerte:  #354A40;

  --accent:         #16B863;
  --accent-deep:    #16B863;
  --accent-hover:   #34D07C;
  --accent-text:    #05170F;
  --accent-suave:   #10281D;

  --orb-1:          #FF4B5C;
  --orb-2:          #F4735C;
  --orb-3:          #F8A992;
  --coral:          #F4735C;
  --coral-suave:    #2A1815;
  --coral-text:     #2A1005;   /* sobre coral brillante el blanco no llega a AA */

  --danger:         #F06B5D;
  --danger-text:    #2A0A06;
  --success:        #34D07C;
  --warning:        #E8A33C;
  --warning-text:   #2A1B04;
  --info:           #6BA8E8;
  --info-text:      #05141F;

  --surface:        #131F1A;
  --surface-alt:    #1B2B24;
  --shadow-sm:      0 1px 2px rgba(0,0,0,.4);
  --shadow-md:      0 4px 16px rgba(0,0,0,.45);
  --shadow-lg:      0 18px 48px rgba(0,0,0,.6);
  --ripple-color:   rgba(255,255,255,.28);
  --overlay:        rgba(0,0,0,.68);
}

/* ---------- 2. RESET ---------- */

*, *::before, *::after {
  box-sizing: border-box;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  background: var(--bg-primary);
  color: var(--text-primary);
  overscroll-behavior-y: none;
  transition: background .22s ease, color .22s ease;
}

img { max-width: 100%; height: auto; display: block; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

h1, h2, h3, h4 { margin: 0 0 .5rem; font-weight: 700; line-height: 1.2; letter-spacing: -.015em; }
h1 { font-size: 28px; }
h2 { font-size: 22px; }
h3 { font-size: 18px; }
h4 { font-size: 15px; }
p  { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

/* ---------- 3. UTILIDADES ---------- */

.kicker {
  display: inline-flex; align-items: center; gap: .45rem;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .12em; color: var(--accent-deep); margin-bottom: .6rem;
}
.kicker::before {
  content: ''; width: 22px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, var(--orb-1), var(--orb-3));
}
.label {
  display: block; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted); margin-bottom: .35rem;
}
.muted     { color: var(--text-muted); }
.secondary { color: var(--text-secondary); }
.text-sm   { font-size: 13px; }
.text-lg   { font-size: 17px; }
.strong    { font-weight: 700; }
.center    { text-align: center; }
.mt-1{margin-top:.5rem}.mt-2{margin-top:1rem}.mt-3{margin-top:1.5rem}.mt-4{margin-top:2rem}
.mb-0{margin-bottom:0}.mb-1{margin-bottom:.5rem}.mb-2{margin-bottom:1rem}.mb-3{margin-bottom:1.5rem}
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

.contenedor {
  width: 100%; max-width: 1180px; margin: 0 auto; padding: 2.5rem 1.5rem;
}
.contenedor-angosto {
  width: 100%; max-width: 720px; margin: 0 auto; padding: 2.5rem 1.5rem;
}
.fila { display: flex; align-items: center; gap: .75rem; }
.fila-entre { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }

/* motivo gráfico de las esferas del logo */
.orbe {
  border-radius: 50%;
  background: linear-gradient(155deg, var(--orb-1) 0%, var(--orb-2) 52%, var(--orb-3) 100%);
}
.texto-degrade {
  background: linear-gradient(120deg, var(--orb-1), var(--orb-2) 60%, var(--orb-3));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: var(--orb-2);
}

/* ---------- 4. BOTONES + RIPPLE ---------- */

.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .7rem 1.4rem;
  border: 1px solid transparent; border-radius: 10px;
  font-size: 15px; font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, transform .08s ease, opacity .16s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.cargando { opacity: .6; pointer-events: none; }
.btn i, .btn svg { width: 18px; height: 18px; flex-shrink: 0; }

.btn-primario   { background: var(--accent-deep); color: var(--accent-text); }
.btn-primario:hover { background: var(--accent-hover); }

.btn-coral      { background: var(--coral); color: var(--coral-text); }
.btn-coral:hover{ filter: brightness(.93); }

.btn-secundario { background: var(--bg-secondary); color: var(--text-primary); border-color: var(--border); }
.btn-secundario:hover { background: var(--bg-tertiary); border-color: var(--border-fuerte); }

.btn-fantasma   { background: transparent; color: var(--text-primary); border-color: var(--border); }
.btn-fantasma:hover { background: var(--bg-secondary); }

.btn-peligro    { background: var(--danger); color: var(--danger-text); }
.btn-peligro:hover { filter: brightness(.93); }

.btn-texto {
  background: none; border: none; color: var(--accent-deep);
  min-height: 40px; padding: .4rem .6rem; font-weight: 600; font-size: 14px;
  border-radius: 8px;
}
.btn-texto:hover { background: var(--bg-secondary); }

.btn-bloque { width: 100%; }
.btn-grande { min-height: 54px; padding: .9rem 1.9rem; font-size: 16px; }
.btn-chico  { min-height: 38px; padding: .4rem .85rem; font-size: 13px; border-radius: 8px; }

.btn-secundario .ripple-wave,
.btn-fantasma  .ripple-wave,
.btn-texto     .ripple-wave { background: rgba(0,153,74,.22); }

.ripple { position: relative; overflow: hidden; }
.ripple-wave {
  position: absolute; border-radius: 50%;
  background: var(--ripple-color);
  transform: scale(0); animation: ripple-anim .6s linear;
  pointer-events: none;
}
@keyframes ripple-anim { to { transform: scale(4); opacity: 0; } }

/* botón icónico redondo */
.btn-icono {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--border);
  background: var(--bg-primary); color: var(--text-secondary);
  position: relative; overflow: hidden;
}
.btn-icono:hover { background: var(--bg-secondary); color: var(--text-primary); }
.btn-icono i, .btn-icono svg { width: 19px; height: 19px; }

/* ---------- 5. HEADER ---------- */

.topbar {
  position: sticky; top: 0; z-index: 900;
  background: color-mix(in srgb, var(--bg-primary) 88%, transparent);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
@supports not (backdrop-filter: blur(1px)) { .topbar { background: var(--bg-primary); } }

.topbar-inner {
  max-width: 1180px; margin: 0 auto;
  padding: .7rem 1.5rem;
  display: flex; align-items: center; gap: 1rem;
}
.marca { display: flex; align-items: center; gap: .65rem; flex-shrink: 0; }
.marca img { height: 38px; width: auto; }
.marca-txt { display: flex; flex-direction: column; line-height: 1.1; }
.marca-nombre { font-size: 15px; font-weight: 800; letter-spacing: .06em; color: var(--text-primary); }
.marca-lema   { font-size: 10px; font-weight: 600; letter-spacing: .04em; color: var(--accent-deep); }

.nav-desktop { display: flex; align-items: center; gap: .15rem; margin-left: auto; }
.nav-link {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .55rem .85rem; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
  background: none; border: none;
}
.nav-link:hover { background: var(--bg-secondary); color: var(--text-primary); text-decoration: none; }
.nav-link.activo { background: var(--accent-suave); color: var(--accent-deep); }
.nav-link i, .nav-link svg { width: 17px; height: 17px; }
.topbar-acciones { display: flex; align-items: center; gap: .5rem; margin-left: .5rem; }

/* ---------- 6. HERO ASIMÉTRICO ---------- */

.hero {
  position: relative; overflow: hidden;
  background:
    radial-gradient(90% 120% at 88% 0%, var(--accent-suave) 0%, transparent 58%),
    var(--bg-primary);
  border-bottom: 1px solid var(--border);
}
.hero-inner {
  max-width: 1180px; margin: 0 auto; padding: 4rem 1.5rem 4.5rem;
  display: grid; grid-template-columns: 1.15fr .85fr; gap: 3rem; align-items: center;
}
.hero h1 {
  font-size: clamp(30px, 5.2vw, 52px); line-height: 1.04;
  letter-spacing: -.03em; margin-bottom: 1rem;
}
.hero-bajada {
  font-size: clamp(15px, 2vw, 18px); color: var(--text-secondary);
  max-width: 46ch; margin-bottom: 1.75rem;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: .75rem; }

/* composición de esferas del logo, escalonada (rompe la grilla) */
.hero-arte { position: relative; min-height: 300px; }
.hero-arte .orbe { position: absolute; box-shadow: var(--shadow-lg); }
.hero-arte .o1 { width: 156px; height: 156px; top: 4%;  right: 16%; }
.hero-arte .o2 { width: 104px; height: 104px; top: 44%; right: 46%; opacity: .92; }
.hero-arte .o3 { width: 72px;  height: 72px;  top: 70%; right: 12%; opacity: .85; }
.hero-arte .hoja {
  position: absolute; inset: auto auto 6% 4%;
  width: 92px; height: 92px; border-radius: 50% 6% 50% 50%;
  background: linear-gradient(150deg, var(--accent), var(--accent-deep));
  transform: rotate(-18deg); box-shadow: var(--shadow-md);
}
.hero-logo-grande { position: absolute; top: 8%; left: 2%; width: 132px; opacity: .96; }

/* franja de datos bajo el hero */
.franja-datos {
  border-bottom: 1px solid var(--border); background: var(--bg-secondary);
}
.franja-datos-inner {
  max-width: 1180px; margin: 0 auto; padding: 1.5rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem;
}
.dato { text-align: left; padding-left: 1rem; border-left: 3px solid var(--accent); }
.dato-num { font-size: 26px; font-weight: 800; letter-spacing: -.02em; color: var(--text-primary); line-height: 1.1; }
.dato-txt { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted); }

/* ---------- 7. TARJETAS (asimétricas, con riel de acento) ---------- */

.tarjeta {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px 18px 18px 18px;
  padding: 1.4rem;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tarjeta-riel::before {
  content: ''; position: absolute; left: 0; top: 18px; bottom: 18px; width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent), var(--orb-2));
}
.tarjeta-riel { padding-left: 1.7rem; }
.tarjeta-click { cursor: pointer; }
.tarjeta-click:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-fuerte); }

/* tarjeta de plan — destacada */
.plan-card {
  display: flex; flex-direction: column;
  border-radius: 4px 20px 20px 20px;
  padding: 1.6rem; height: 100%;
}
.plan-card.destacado {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent), var(--shadow-md);
}
/* Coral sólido, no el degradé: sobre el extremo claro de las esferas
   el texto no alcanzaba AA. El degradé queda para la gráfica sin texto. */
.plan-cinta {
  position: absolute; top: -1px; right: 1.2rem;
  padding: .28rem .7rem; border-radius: 0 0 8px 8px;
  background: var(--coral); color: var(--coral-text);
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .07em;
}
.plan-precio {
  font-size: 32px; font-weight: 800; letter-spacing: -.03em;
  color: var(--text-primary); line-height: 1.1;
}
.plan-precio small { font-size: 13px; font-weight: 600; color: var(--text-muted); letter-spacing: 0; }
.plan-desc { color: var(--text-secondary); font-size: 14px; flex: 1; }

/* métricas del dashboard */
.grid-metricas {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem;
}
.metrica { display: flex; flex-direction: column; gap: .15rem; }
.metrica-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.metrica-icono {
  width: 38px; height: 38px; border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-suave); color: var(--accent-deep); flex-shrink: 0;
}
.metrica-icono.coral { background: var(--coral-suave); color: var(--coral); }
.metrica-icono i, .metrica-icono svg { width: 19px; height: 19px; }
.metrica-valor { font-size: 30px; font-weight: 800; letter-spacing: -.025em; line-height: 1.15; }
.metrica-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }

/* ---------- 8. SECCIONES ---------- */

.seccion { padding: 3.5rem 0; }
.seccion-alt { background: var(--bg-secondary); border-block: 1px solid var(--border); }
.seccion-head { max-width: 620px; margin-bottom: 2rem; }
.seccion-head h2 { font-size: clamp(22px, 3.4vw, 32px); }
.seccion-head p { color: var(--text-secondary); margin-bottom: 0; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.25rem; }

/* pasos numerados del método */
.paso { position: relative; padding-left: 3.4rem; }
.paso-num {
  position: absolute; left: 0; top: 0;
  width: 42px; height: 42px; border-radius: 13px 4px 13px 13px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-deep); color: var(--accent-text);
  font-weight: 800; font-size: 16px;
}
.paso h3 { margin-bottom: .25rem; }
.paso p { color: var(--text-secondary); font-size: 14px; margin-bottom: 0; }

/* cita / filosofía */
.cita {
  position: relative;
  border-left: 3px solid var(--accent);
  padding: .35rem 0 .35rem 1.25rem;
  font-size: clamp(17px, 2.6vw, 22px); font-weight: 600; line-height: 1.4;
  letter-spacing: -.015em;
}

/* antes / después */
.transformacion { overflow: hidden; padding: 0; }
.transformacion-fotos { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; background: var(--border); }
.transformacion-fotos figure { margin: 0; position: relative; background: var(--bg-tertiary); }
.transformacion-fotos img { width: 100%; aspect-ratio: 3/4; object-fit: cover; }
.transformacion-fotos figcaption {
  position: absolute; left: .5rem; top: .5rem;
  padding: .2rem .55rem; border-radius: 6px;
  background: rgba(12,20,17,.72); color: #FFFFFF;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
}
.transformacion-cuerpo { padding: 1.1rem 1.3rem 1.3rem; }

/* ---------- 8b. CONTENIDO ENRIQUECIDO DE PLAN ---------- */

.prose { color: var(--text-primary); font-size: 15px; line-height: 1.75; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin-top: 1.4em; margin-bottom: .5em; }
.prose h1:first-child, .prose h2:first-child, .prose h3:first-child { margin-top: 0; }
.prose p { margin: 0 0 1em; }
.prose ul, .prose ol { margin: 0 0 1em; padding-left: 1.3em; }
.prose li { margin-bottom: .35em; }
.prose a { color: var(--accent-deep); font-weight: 600; }
.prose blockquote {
  margin: 1em 0; padding: .3rem 0 .3rem 1rem;
  border-left: 3px solid var(--accent); color: var(--text-secondary); font-style: italic;
}
.prose img { border-radius: 12px; margin: .5em 0; }
.prose hr { border: none; border-top: 1px solid var(--border); margin: 1.5em 0; }

.material-lista { display: flex; flex-direction: column; gap: .5rem; }
.material-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .7rem .9rem; border: 1px solid var(--border); border-radius: 4px 12px 12px 12px;
  background: var(--surface); font-size: 14px; font-weight: 600;
}
.material-item i, .material-item svg { width: 18px; height: 18px; color: var(--accent-deep); flex-shrink: 0; }
.material-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- 9. FORMULARIOS ---------- */

.campo { margin-bottom: 1.05rem; }
.campo label { display: block; font-size: 13px; font-weight: 600; margin-bottom: .35rem; color: var(--text-primary); }
.campo .req { color: var(--danger); }

.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="date"], input[type="tel"], textarea, select {
  width: 100%; min-height: 46px; padding: .65rem .85rem;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--bg-primary); color: var(--text-primary);
  font-family: inherit; font-size: 15px; line-height: 1.4;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea { min-height: 110px; resize: vertical; }
.input:focus, input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }

.campo-password { position: relative; }
.campo-password input { padding-right: 48px; }
.toggle-password {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 38px; height: 38px; display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 9px; color: var(--text-muted);
  position: absolute; overflow: hidden;
}
.toggle-password:hover { color: var(--text-primary); background: var(--bg-secondary); }
.toggle-password i, .toggle-password svg { width: 19px; height: 19px; }

/* El file input nativo es feo e inconsistente entre navegadores: se le da
   la misma caja que al resto y el botón interno toma los colores de la marca. */
input[type="file"] {
  width: 100%; padding: .55rem .65rem;
  border: 1px dashed var(--border-fuerte); border-radius: 10px;
  background: var(--bg-secondary); color: var(--text-secondary);
  font-family: inherit; font-size: 14px;
}
/* --accent-deep, no --accent: el verde claro con texto blanco no llega a AA */
input[type="file"]::file-selector-button {
  margin-right: .75rem; padding: .5rem .9rem;
  border: none; border-radius: 8px; cursor: pointer;
  background: var(--accent-deep); color: var(--accent-text);
  font-family: inherit; font-size: 14px; font-weight: 600;
}
input[type="file"]:focus { outline: none; border-color: var(--accent); }

.ayuda { font-size: 12px; color: var(--text-muted); margin-top: .3rem; }
.error-campo { font-size: 12px; color: var(--danger); margin-top: .3rem; font-weight: 600; }

/* ---------- 10. ESTADOS (nunca 404, nunca pantalla vacía) ---------- */

.estado-vacio, .estado-error {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: .55rem; padding: 3rem 1.5rem;
  border: 1px dashed var(--border-fuerte); border-radius: 4px 18px 18px 18px;
  background: var(--bg-secondary);
}
.estado-icono {
  width: 56px; height: 56px; border-radius: 18px 5px 18px 18px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-primary); border: 1px solid var(--border); color: var(--accent-deep);
  margin-bottom: .35rem;
}
.estado-error .estado-icono { color: var(--danger); }
.estado-icono i, .estado-icono svg { width: 26px; height: 26px; }
.estado-vacio h3, .estado-error h3 { margin: 0; font-size: 17px; }
.estado-vacio p, .estado-error p { margin: 0; color: var(--text-secondary); font-size: 14px; max-width: 42ch; }
.estado-vacio .btn, .estado-error .btn { margin-top: .75rem; }

/* skeleton de carga */
.sk { border-radius: 10px; background: var(--bg-tertiary); position: relative; overflow: hidden; }
.sk::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bg-primary) 55%, transparent), transparent);
  animation: sk-brillo 1.25s infinite;
}
@keyframes sk-brillo { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sk-linea { height: 13px; margin-bottom: .5rem; }
.sk-caja   { height: 116px; }

/* ---------- 11. TOASTS ---------- */

#toasts {
  position: fixed; left: 50%; bottom: 92px; transform: translateX(-50%);
  z-index: 9999; display: flex; flex-direction: column; gap: .5rem;
  align-items: center; pointer-events: none; padding: 0 1rem; width: 100%; max-width: 460px;
}
.toast {
  display: flex; align-items: center; gap: .55rem;
  padding: .7rem 1.1rem; border-radius: 11px;
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-lg); animation: toast-in .22s ease;
  max-width: 100%;
}
.toast i, .toast svg { width: 17px; height: 17px; flex-shrink: 0; }
.toast-error   { background: var(--danger);      color: var(--danger-text); }
.toast-success { background: var(--accent-deep); color: var(--accent-text); }
.toast-warning { background: var(--warning);     color: var(--warning-text); }
.toast-info    { background: var(--info);        color: var(--info-text); }
.toast.saliendo { animation: toast-out .25s ease forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(14px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(10px); } }

/* ---------- 12. MODALES ---------- */

.modal-wrapper {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--overlay);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fade-in .16s ease;
}
@keyframes fade-in { from { opacity: 0; } }
.modal {
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 560px; max-height: 90vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modal-in .2s ease;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.99); } }
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-cerrar {
  background: none; border: none; color: var(--text-muted);
  width: 36px; height: 36px; border-radius: 9px; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
}
.modal-cerrar:hover { background: var(--bg-secondary); color: var(--text-primary); }
.modal-body   { flex: 1; overflow-y: auto; padding: 1.4rem; -webkit-overflow-scrolling: touch; }
.modal-footer {
  padding: 1rem 1.4rem; border-top: 1px solid var(--border);
  display: flex; gap: .7rem; justify-content: flex-end;
  background: var(--bg-primary); border-radius: 0 0 16px 16px; flex-shrink: 0;
}
.modal-footer .btn { min-width: 110px; }

/* ---------- 13. SPLASH ---------- */

#splash {
  position: fixed; inset: 0; z-index: 10000;
  display: none; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.1rem; padding: 2rem;
  background: var(--bg-primary);
  transition: opacity .5s ease;
}
#splash .splash-fondo {
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 55% at 50% 32%, var(--accent-suave) 0%, transparent 70%),
    radial-gradient(40% 40% at 78% 78%, var(--coral-suave) 0%, transparent 70%);
  opacity: .9;
}
#splash .splash-cuerpo { position: relative; text-align: center; display: flex; flex-direction: column; align-items: center; gap: .6rem; }
#splash img { width: 168px; max-width: 54vw; animation: splash-pop .8s cubic-bezier(.2,.9,.3,1.2); }
@keyframes splash-pop { from { opacity: 0; transform: scale(.86); } }
#splash .splash-nombre { font-size: 21px; font-weight: 800; letter-spacing: .12em; }
#splash .splash-lema { font-size: 14px; font-weight: 600; color: var(--accent-deep); }
.splash-barra { width: 190px; height: 4px; border-radius: 3px; background: var(--bg-tertiary); overflow: hidden; margin-top: .6rem; }
.splash-barra span {
  display: block; height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--orb-2));
  transition: width .1s linear;
}
.splash-saltar {
  position: relative; z-index: 1; margin-top: .4rem;
  background: none; border: none; color: var(--text-muted);
  font-size: 13px; font-weight: 600; padding: .5rem .9rem; border-radius: 8px;
}
.splash-saltar:hover { color: var(--text-primary); background: var(--bg-secondary); }

/* ---------- 14. LAYOUT ADMIN ---------- */

.admin-layout { display: flex; min-height: calc(100vh - 64px); }
.admin-sidebar {
  width: 236px; flex-shrink: 0; padding: 1.5rem 1rem;
  border-right: 1px solid var(--border); background: var(--bg-secondary);
}
.admin-sidebar .label { padding-left: .6rem; margin-bottom: .5rem; }
.admin-nav { display: flex; flex-direction: column; gap: .15rem; }
.admin-nav a {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: .65rem;
  padding: .6rem .7rem; border-radius: 9px;
  font-size: 14px; font-weight: 600; color: var(--text-secondary);
}
.admin-nav a:hover { background: var(--bg-tertiary); color: var(--text-primary); text-decoration: none; }
.admin-nav a.activo { background: var(--accent-suave); color: var(--accent-deep); }
.admin-nav i, .admin-nav svg { width: 18px; height: 18px; }
.admin-contenido { flex: 1; min-width: 0; padding: 2rem 1.75rem; }

/* ---------- 15. CHIPS / BADGES ---------- */

.chip {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .24rem .65rem; border-radius: 999px;
  font-size: 12px; font-weight: 700; letter-spacing: .02em;
  background: var(--bg-tertiary); color: var(--text-secondary);
}
.chip i, .chip svg { width: 13px; height: 13px; }
.chip-ok        { background: var(--accent-suave); color: var(--accent-deep); }
.chip-pendiente { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.chip-error     { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.chip-coral     { background: var(--coral-suave); color: var(--coral); }

/* ---------- 16. LISTAS DE DATOS ---------- */

.lista { display: flex; flex-direction: column; gap: .6rem; }
.lista-item {
  display: flex; align-items: center; gap: .9rem;
  padding: .85rem 1rem;
  border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  background: var(--surface);
}
.lista-item-cuerpo { flex: 1; min-width: 0; }
.lista-item-titulo { font-weight: 700; font-size: 14px; }
.lista-item-sub { font-size: 13px; color: var(--text-muted); }
.avatar {
  width: 40px; height: 40px; border-radius: 13px 4px 13px 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-suave); color: var(--accent-deep);
  font-weight: 800; font-size: 15px;
}

/* ---------- 16b. PAGOS Y COMPRAS ---------- */

.metodos-pago { display: flex; flex-direction: column; gap: .8rem; }

.metodo-pago {
  display: flex; align-items: center; gap: 1rem; width: 100%;
  padding: 1.1rem 1.2rem; text-align: left;
  background: var(--surface); color: var(--text-primary);
  border: 1px solid var(--border);
}
.metodo-pago:hover { border-color: var(--accent); }
.metodo-pago-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .15rem; }
.metodo-pago-flecha { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted); }

/* Filtros de estado del listado de compras */
.filtros { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-filtro {
  cursor: pointer; border: 1px solid var(--border);
  padding: .42rem .85rem; position: relative; overflow: hidden;
}
.chip-filtro:hover { border-color: var(--accent); }
.chip-filtro.activo {
  background: var(--accent-deep); color: var(--accent-text); border-color: var(--accent-deep);
}
.chip-num {
  display: inline-block; margin-left: .2rem;
  padding: 0 .35rem; border-radius: 999px;
  background: color-mix(in srgb, currentColor 18%, transparent);
}

.compras-lista { display: flex; flex-direction: column; gap: .9rem; }
.compra-item { padding: 1.1rem 1.2rem; }

/* Pantalla de vuelta desde MercadoPago */
.resultado-pago { padding: 2.5rem 1.5rem; }
.resultado-pago .estado-icono i, .resultado-pago .estado-icono svg { width: 30px; height: 30px; }
.resultado-ok        .estado-icono { background: var(--accent-suave); color: var(--accent-deep); }
.resultado-pendiente .estado-icono { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }
.resultado-error     .estado-icono { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }

/* ---------- 17. FOOTER MOBILE + MENÚ "VER MÁS" ---------- */

.footer-nav { display: none; }

.menu-completo-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem;
}
.menu-completo-item {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: .45rem; padding: 1rem .5rem; text-align: center;
  border: 1px solid var(--border); border-radius: 4px 14px 14px 14px;
  background: var(--surface); color: var(--text-primary);
  font-size: 12px; font-weight: 600; line-height: 1.25;
  position: relative; overflow: hidden;
}
.menu-completo-item:hover { background: var(--bg-secondary); text-decoration: none; }
.menu-completo-item.activo { border-color: var(--accent); background: var(--accent-suave); color: var(--accent-deep); }
.menu-completo-item i, .menu-completo-item svg { width: 22px; height: 22px; color: var(--accent-deep); }
.menu-completo-item.peligro i { color: var(--danger); }
.menu-completo-item.peligro { color: var(--danger); }

/* pie del sitio */
.pie {
  border-top: 1px solid var(--border); background: var(--bg-secondary);
  padding: 2rem 1.5rem; text-align: center;
}
.pie img { height: 40px; margin: 0 auto .6rem; }
.pie p { font-size: 13px; color: var(--text-muted); margin-bottom: .3rem; }

/* ---------- 18. WHATSAPP FLOTANTE ---------- */

.wa-float {
  position: fixed; right: 16px; bottom: 88px; z-index: 890;
  width: 54px; height: 54px; border-radius: 50%;
  display: none; align-items: center; justify-content: center;
  background: #25D366; box-shadow: var(--shadow-md);
}
.wa-float:hover { filter: brightness(.95); text-decoration: none; }
.wa-float svg { width: 28px; height: 28px; fill: #FFFFFF; }

/* ---------- 19. RESPONSIVE ---------- */

@media (max-width: 1024px) {
  .hero-inner { gap: 2rem; }
  .admin-sidebar { width: 200px; }
}

@media (max-width: 860px) {
  .hero-inner { grid-template-columns: 1fr; padding: 2.5rem 1.5rem 3rem; }
  .hero-arte { display: none; }
  .franja-datos-inner { grid-template-columns: 1fr; gap: .9rem; }
}

@media (max-width: 768px) {
  body { padding-bottom: 76px; }

  .contenedor, .contenedor-angosto { padding: 1.5rem 1rem; }
  .seccion { padding: 2.5rem 0; }
  .topbar-inner { padding: .6rem 1rem; }
  .marca img { height: 34px; }
  .nav-desktop { display: none; }
  .topbar-acciones { margin-left: auto; }

  h1 { font-size: 25px; }
  h2 { font-size: 20px; }

  .admin-layout { flex-direction: column; min-height: 0; }
  .admin-sidebar { display: none; }
  .admin-contenido { padding: 1.5rem 1rem; }

  .modal-wrapper { padding: 0; align-items: flex-end; }
  .modal { max-width: 100%; max-height: 92vh; border-radius: 18px 18px 0 0; border-bottom: none; }
  .modal-footer { border-radius: 0; padding-bottom: calc(1rem + env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1; }

  #toasts { bottom: 96px; }
  .wa-float { bottom: 92px; width: 50px; height: 50px; }

  /* footer nativo */
  .footer-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 899;
    display: flex; height: 64px;
    background: var(--bg-primary); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .footer-nav button {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    background: none; border: none; color: var(--text-muted);
    font-size: 10px; font-weight: 700; letter-spacing: .02em;
    position: relative; overflow: hidden;
  }
  .footer-nav button i, .footer-nav button svg { width: 21px; height: 21px; }
  .footer-nav button.activo { color: var(--accent-deep); }
  .footer-nav button.activo::before {
    content: ''; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 26px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent);
  }
  .footer-nav button span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

@media (min-width: 769px) {
  body { padding-bottom: 0; }
}

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

/* ---------- 20. FASE 5 · FORMULARIOS LARGOS, PROGRESO Y PWA ---------- */

/* Variante de campo con label implícito: <label class="campo"><span>…</span><input></label>.
   Asocia el texto al control sin depender de que el id y el for coincidan. */
.campo > span {
  display: block; font-size: 13px; font-weight: 600;
  margin-bottom: .35rem; color: var(--text-primary);
}
.campo > span .chip { vertical-align: middle; }

.form-grid { display: flex; flex-direction: column; gap: .2rem; }
.form-grid > .grid-2 { gap: 0 1rem; }

.dato-fijo {
  padding: .65rem .85rem; border: 1px dashed var(--border);
  border-radius: 10px; background: var(--bg-secondary); color: var(--text-secondary);
  font-size: 15px;
}

.separador { border: none; border-top: 1px solid var(--border); margin: 1.1rem 0; }

/* Casillas y switches */
.check-linea {
  display: flex; align-items: flex-start; gap: .7rem;
  padding: .7rem .2rem; cursor: pointer; font-size: 14px; line-height: 1.45;
}
.check-linea input[type="checkbox"] {
  width: 20px; height: 20px; min-height: 0; flex-shrink: 0; margin-top: .1rem;
  accent-color: var(--accent-deep); cursor: pointer;
}

.switch-linea { display: flex; align-items: flex-start; gap: .9rem; }
.switch-texto { flex: 1; min-width: 0; }
.switch { position: relative; flex-shrink: 0; width: 46px; height: 27px; display: inline-block; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 2; min-height: 0; }
.switch-pista {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--bg-tertiary); border: 1px solid var(--border);
  transition: background .18s ease, border-color .18s ease;
}
.switch-pista::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: var(--surface); box-shadow: 0 1px 3px var(--shadow);
  transition: transform .18s ease;
}
.switch input:checked + .switch-pista { background: var(--accent-deep); border-color: var(--accent-deep); }
.switch input:checked + .switch-pista::after { transform: translateX(19px); }
.switch input:focus-visible + .switch-pista {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);
}

/* Pestañas internas de configuración */
.tabs {
  display: flex; gap: .35rem; overflow-x: auto; margin-bottom: 1.4rem;
  border-bottom: 1px solid var(--border); padding-bottom: .1rem;
}
.tab {
  display: inline-flex; align-items: center; gap: .4rem; white-space: nowrap;
  padding: .6rem .9rem; border: none; background: none; cursor: pointer;
  color: var(--text-secondary); font-size: 14px; font-weight: 600;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  position: relative; overflow: hidden;
}
.tab i, .tab svg { width: 16px; height: 16px; }
.tab:hover { color: var(--text-primary); }
.tab.activo { color: var(--accent-deep); border-bottom-color: var(--accent-deep); }

/* Avisos dentro de formularios */
.aviso {
  display: flex; align-items: flex-start; gap: .6rem;
  padding: .8rem 1rem; border-radius: 10px; margin: .4rem 0 .9rem;
  background: var(--bg-secondary); color: var(--text-secondary);
  font-size: 13.5px; line-height: 1.5; border-left: 3px solid var(--border-fuerte);
}
.aviso i, .aviso svg { width: 17px; height: 17px; flex-shrink: 0; margin-top: .1rem; }
.aviso-ok { background: var(--accent-suave); color: var(--accent-deep); border-left-color: var(--accent-deep); }

/* Imágenes: subida y vista previa */
.campo-imagen { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.preview-foto {
  width: 88px; height: 88px; object-fit: cover; flex-shrink: 0;
  border-radius: 12px; border: 1px solid var(--border); background: var(--bg-secondary);
  display: block; margin-top: .4rem;
}
.preview-vacia { display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.preview-vacia i, .preview-vacia svg { width: 26px; height: 26px; }

.miniaturas { display: flex; gap: .3rem; flex-shrink: 0; }
.miniaturas img {
  width: 42px; height: 52px; object-fit: cover;
  border-radius: 8px; border: 1px solid var(--border); background: var(--bg-secondary);
}
.miniatura-btn {
  padding: 0; border: none; background: none; cursor: pointer; flex-shrink: 0;
  position: relative; overflow: hidden; border-radius: 10px;
}
.miniatura-btn img {
  width: 46px; height: 46px; object-fit: cover; display: block;
  border-radius: 10px; border: 1px solid var(--border);
}
.foto-grande { width: 100%; border-radius: 12px; display: block; }

.aviso-consentimiento { color: var(--warning); font-weight: 600; }

/* Filas editables del contenido del inicio */
.fila-editable {
  display: flex; gap: .5rem; align-items: flex-start; margin-bottom: .6rem;
}
.fila-editable input, .fila-editable textarea { margin: 0; }
.fila-editable > *:first-child { flex: 0 0 32%; }
.fila-editable > *:nth-child(2) { flex: 1; min-width: 0; }
.fila-editable textarea { min-height: 46px; }

/* Vista previa de cómo se comparte el link */
.preview-share {
  display: flex; gap: .9rem; align-items: stretch; margin-top: .6rem;
  border: 1px solid var(--border); border-radius: 12px; overflow: hidden;
  background: var(--surface);
}
.preview-share img, .preview-share-sin {
  width: 108px; flex-shrink: 0; object-fit: cover; background: var(--bg-secondary);
  display: flex; align-items: center; justify-content: center; color: var(--text-muted);
}
.preview-share-txt { padding: .7rem .9rem .7rem 0; min-width: 0; display: flex; flex-direction: column; gap: .2rem; justify-content: center; }
.preview-share-titulo { font-weight: 600; font-size: 14px; color: var(--text-primary); }
.preview-share-desc { font-size: 12.5px; color: var(--text-secondary); line-height: 1.4; }
.preview-share-url { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* Buscador y paginación de usuarios */
.buscador { position: relative; flex: 1; min-width: 220px; }
.buscador input { padding-left: 40px; }
.buscador i, .buscador svg {
  position: absolute; left: 13px; top: 50%; transform: translateY(-50%);
  width: 17px; height: 17px; color: var(--text-muted); pointer-events: none;
}
.chips-filtro { display: flex; flex-wrap: wrap; gap: .5rem; }
.filtros { align-items: center; margin-bottom: 1.2rem; }

.paginador {
  display: flex; align-items: center; justify-content: space-between;
  gap: .8rem; margin-top: 1.2rem; flex-wrap: wrap;
}

.etiqueta-yo {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: .1rem .4rem; border-radius: 5px;
  background: var(--accent-suave); color: var(--accent-deep);
}
.chip-mini { font-size: 10.5px; padding: .05rem .4rem; font-weight: 700; }

/* Progreso del cliente */
.resumen-progreso { border-left: 3px solid var(--border-fuerte); }
.resumen-baja { border-left-color: var(--accent-deep); }
.resumen-baja .metrica-icono { background: var(--accent-suave); color: var(--accent-deep); }
.resumen-sube { border-left-color: var(--warning); }
.resumen-sube .metrica-icono { background: color-mix(in srgb, var(--warning) 16%, transparent); color: var(--warning); }

.grafico-peso { margin-top: 1rem; }
.grafico-peso svg { width: 100%; height: 130px; display: block; overflow: visible; }
.gp-area   { fill: var(--accent-suave); }
.gp-linea  { fill: none; stroke: var(--accent-deep); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.gp-puntos circle { fill: var(--accent-deep); }

.nota-progreso { font-style: italic; }

/* Banner de "sin conexión" */
.banner-offline {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  display: none; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem 1rem; font-size: 13px; font-weight: 600;
  background: var(--warning); color: var(--warning-text);
  padding-top: calc(.55rem + env(safe-area-inset-top));
}
.banner-offline.visible { display: flex; }
.banner-offline i, .banner-offline svg { width: 16px; height: 16px; }
body.hay-banner .topbar { top: 38px; }

/* Asistente IA flotante — abajo a la derecha, debajo del de WhatsApp.
   Los dos comparten la misma columna: el de WhatsApp arriba (es el canal
   principal) y el asistente abajo, más chico, para que se vea sin pelearle
   la pantalla al contenido. */
.ai-boton {
  position: fixed; right: 16px; bottom: 20px; z-index: 997;
  width: 50px; height: 50px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--accent-deep); color: var(--accent-text);
  box-shadow: 0 4px 14px var(--shadow);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  opacity: .92; transition: opacity .15s ease, transform .15s ease;
}
.ai-boton:hover { opacity: 1; transform: translateY(-2px); }
.ai-boton img { width: 100%; height: 100%; object-fit: cover; }
.ai-boton i, .ai-boton svg { width: 22px; height: 22px; }

/* Mientras el chat está abierto, el globo de WhatsApp se va: dos burbujas
   apiladas al lado del panel es justo lo que se pedía evitar. */
body.ai-abierto .wa-float { display: none !important; }

.ai-panel {
  position: fixed; right: 16px; bottom: 82px; z-index: 997;
  width: min(340px, calc(100vw - 32px)); max-height: min(440px, calc(100vh - 190px));
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 12px 40px var(--shadow);
  display: none; flex-direction: column; overflow: hidden;
}
.ai-panel.abierto { display: flex; }
.ai-panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: .7rem .5rem .7rem 1rem; border-bottom: 1px solid var(--border);
  font-weight: 600; font-size: 14px;
}
.ai-mensajes {
  flex: 1; overflow-y: auto; padding: .9rem;
  display: flex; flex-direction: column; gap: .5rem; min-height: 140px;
}
.ai-msg {
  padding: .55rem .8rem; border-radius: 12px; font-size: 13.5px;
  line-height: 1.5; max-width: 88%; white-space: pre-wrap; word-break: break-word;
}
.ai-msg-yo  { background: var(--accent-deep); color: var(--accent-text); align-self: flex-end; border-bottom-right-radius: 4px; }
.ai-msg-bot { background: var(--bg-secondary); color: var(--text-primary); align-self: flex-start; border-bottom-left-radius: 4px; }
.ai-escribiendo { opacity: .6; }
.ai-pie { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--border); }
.ai-pie input { min-height: 40px; font-size: 14px; }
.ai-pie button { flex-shrink: 0; }

@media (max-width: 768px) {
  .ai-boton { bottom: 150px; width: 50px; height: 50px; }
  .ai-panel { bottom: 210px; max-height: calc(100vh - 290px); }
  .fila-editable { flex-wrap: wrap; }
  .fila-editable > *:first-child { flex: 1 1 100%; }
  .fila-editable > *:nth-child(2) { flex: 1 1 calc(100% - 56px); }
  .preview-share img, .preview-share-sin { width: 84px; }
}

/* ---------- 21. AJUSTES DE MOBILE (listas, filtros y pestañas) ---------- */

/* Un chip nunca se comprime: si se achica, el texto se desborda y termina
   pisando el email de al lado. Prefiere empujar y que la fila se acomode. */
.chip { flex-shrink: 0; }

/* El sub suele ser un email largo: se corta con puntitos en vez de romper
   el ancho de la tarjeta. */
.lista-item-sub { overflow-wrap: anywhere; }

@media (max-width: 640px) {
  /* En el celular no entran avatar + nombre + dos chips + dos botones en una
     sola línea. Se parte en dos: arriba quién es, abajo su estado y las
     acciones. El ::after es un salto de línea forzado dentro del flex. */
  .lista-item {
    flex-wrap: wrap;
    row-gap: .6rem;
    gap: .7rem;
    padding: .9rem .95rem;
  }
  .lista-item > .avatar,
  .lista-item > .metrica-icono,
  .lista-item > .miniaturas,
  .lista-item > .miniatura-btn { order: 1; }
  .lista-item-cuerpo { order: 2; flex: 1 1 0; }
  .lista-item::after { content: ''; order: 3; flex-basis: 100%; height: 0; }
  .lista-item > .chip { order: 4; }
  /* Las flechas de reordenar bajan con el resto de las acciones: arriba solo
     queda de qué se trata la fila, que es lo que hay que poder leer. */
  .lista-item > .fila,
  .lista-item > .btn-icono { order: 5; }
  /* El último chip empuja los botones contra el margen derecho */
  .lista-item > span.chip:last-of-type { margin-right: auto; }

  /* Los botones NO se achican: 44px es el mínimo para tocar sin errar, y en una
     app que se usa del celular eso vale más que ahorrar una línea. Si no entran
     todos, la fila de acciones se parte en dos y listo. */
  .lista-item > .fila { gap: .35rem; }
  .lista-item { column-gap: .5rem; }

  .miniaturas img { width: 38px; height: 46px; }

  .lista-item-titulo { font-size: 14.5px; line-height: 1.3; }
  .lista-item-sub {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* Las notas y avisos sí pueden ocupar varias líneas */
  .lista-item-sub.nota-progreso,
  .lista-item-sub.aviso-consentimiento { white-space: normal; }

  /* Buscador a lo ancho y los filtros abajo, en su propia fila */
  .filtros { gap: .6rem; }
  .buscador { flex: 1 1 100%; min-width: 0; }
  .chips-filtro { flex: 1 1 100%; }
  .chip-filtro { flex: 1 1 auto; text-align: center; justify-content: center; }

  .paginador { justify-content: center; }
  .paginador .secondary { order: -1; flex: 1 1 100%; text-align: center; }
}

@media (max-width: 768px) {
  /* Las pestañas de configuración no entraban y el scroll horizontal no se
     descubre (ni se ve que haya algo más). En vez de esconderlas detrás de un
     gesto, se acomodan en dos filas: todo a la vista de una. */
  .tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(94px, 1fr));
    gap: .4rem;
    overflow: visible;
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 1.2rem;
  }
  .tab {
    justify-content: center;
    padding: .5rem .35rem;
    min-height: 44px;              /* objetivo táctil */
    border: 1px solid var(--border);
    border-radius: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 0;
    font-size: 12.5px;
    line-height: 1.15;
    gap: .3rem;
  }
  .tab i, .tab svg { width: 14px; height: 14px; }
  .tab.activo {
    background: var(--accent-suave);
    color: var(--accent-deep);
    border-color: var(--accent-deep);
  }

  /* Los dos globos flotantes, apilados a la derecha y por encima del footer:
     WhatsApp arriba, el asistente abajo (más chico, para no tapar contenido). */
  .wa-float {
    bottom: calc(134px + env(safe-area-inset-bottom));
    right: 14px; width: 48px; height: 48px;
  }
  .ai-boton {
    right: 14px; bottom: calc(76px + env(safe-area-inset-bottom));
    width: 46px; height: 46px;
  }
  .ai-boton i, .ai-boton svg { width: 20px; height: 20px; }
  .ai-panel {
    right: 14px; left: 14px; width: auto;
    bottom: calc(130px + env(safe-area-inset-bottom));
    max-height: calc(100vh - 250px);
  }
}

/* ---------- 22. IMÁGENES DEL INICIO ---------- */

/* Portada con foto: reemplaza la composición de logo y esferas */
.hero-arte-foto { position: relative; display: flex; align-items: center; justify-content: center; }
.hero-foto {
  width: 100%; max-width: 560px; aspect-ratio: 4 / 3;
  object-fit: cover; display: block;
  /* Esquina viva arriba a la izquierda: el mismo gesto que las tarjetas */
  border-radius: 6px 26px 26px 26px;
  box-shadow: 0 18px 44px var(--shadow);
}
.hero-arte-foto .orbe { z-index: -1; }

/* Banda de foto a lo ancho dentro de una sección */
.banda-foto {
  margin: 0 0 2rem; border-radius: 6px 22px 22px 22px; overflow: hidden;
  box-shadow: 0 10px 30px var(--shadow);
}
.banda-foto img {
  width: 100%; height: clamp(180px, 26vw, 320px);
  object-fit: cover; display: block;
}

/* Foto al costado de un bloque de texto */
.columna-con-foto { display: flex; flex-direction: column; gap: 1.1rem; }
.foto-seccion {
  width: 100%; object-fit: cover; display: block;
  border-radius: 6px 22px 22px 22px; box-shadow: 0 10px 30px var(--shadow);
}
.foto-seccion-vertical { aspect-ratio: 4 / 3; }

.seccion-bajada { max-width: 62ch; margin-bottom: 1.6rem; }

/* Sección con la foto de fondo. El velo NO es decorativo: mantiene el texto
   sobre un fondo del tema, así el contraste sigue siendo el mismo que en
   cualquier otra sección y no depende de qué tan clara salió la imagen. */
.seccion-con-foto {
  position: relative;
  background-size: cover; background-position: center;
}
.seccion-con-foto::before {
  content: ''; position: absolute; inset: 0;
  background: var(--bg-secondary); opacity: .94;
}
.seccion-con-foto > * { position: relative; z-index: 1; }

/* Galería: grilla asimétrica, la primera manda */
.galeria {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: .9rem;
}
.galeria-item {
  margin: 0; position: relative; overflow: hidden;
  border-radius: 4px 18px 18px 18px;
  background: var(--bg-secondary);
  box-shadow: 0 6px 20px var(--shadow);
}
.galeria-item img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  aspect-ratio: 1 / 1;
  transition: transform .35s ease;
}
.galeria-item:hover img { transform: scale(1.04); }
.galeria-destacada { grid-column: span 2; grid-row: span 2; }
.galeria-destacada img { aspect-ratio: 1 / 1; }

.galeria-item figcaption {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 1.6rem .85rem .7rem;
  font-size: 13px; font-weight: 700; color: #FFFFFF;
  /* Degradé oscuro de abajo hacia arriba: el texto blanco queda sobre negro
     casi opaco, no sobre la foto directamente. */
  background: linear-gradient(to top, rgba(0,0,0,.78), rgba(0,0,0,.45) 55%, transparent);
  text-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.galeria-destacada figcaption { font-size: 15px; padding-top: 2.2rem; }

@media (max-width: 900px) {
  .galeria { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 640px) {
  .galeria { grid-template-columns: repeat(2, 1fr); gap: .6rem; }
  .galeria-destacada { grid-column: span 2; grid-row: auto; }
  .galeria-destacada img { aspect-ratio: 16 / 10; }
  .galeria-item figcaption { font-size: 12px; padding: 1.3rem .7rem .55rem; }
  .banda-foto { margin-bottom: 1.4rem; }
  .banda-foto img { height: 170px; }
  .hero-foto { max-width: 100%; aspect-ratio: 16 / 10; }
}

/* ---------- 23. GALERÍA EN EL PANEL ---------- */

.gal-admin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 1rem;
}
.gal-admin-item {
  margin: 0; overflow: hidden; background: var(--surface);
  border: 1px solid var(--border); border-radius: 4px 16px 16px 16px;
}
.gal-admin-item img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; display: block; }
/* Una foto oculta se ve apagada: se entiende de un vistazo cuál no está en la web */
.gal-admin-item.oculta img { filter: grayscale(1); opacity: .55; }
.gal-admin-item figcaption { padding: .7rem .8rem .8rem; }
.gal-admin-txt { min-width: 0; margin-bottom: .55rem; }
.gal-admin-acciones { display: flex; flex-wrap: wrap; gap: .3rem; }

.preview-ancho {
  width: 100%; max-height: 260px; object-fit: cover;
  border-radius: 12px; display: block; margin-bottom: 1rem;
}

.campo-imagen-acciones { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ia-generando { padding: .5rem 0; }

@media (max-width: 640px) {
  .gal-admin-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .7rem; }
  .gal-admin-acciones .btn-icono { width: 44px; height: 44px; }
}
