/* ═══════════════════════════════════════════════════════════
   Ahá Herramientas Digitales · Fondos con IA (/fondo-con-ia)
   ═══════════════════════════════════════════════════════════ */
.fcia-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.fcia .dropzone { padding: 28px 18px; }
.fcia .dropzone.compact { padding: 12px; }
.fcia-con-prod .dropzone { display: none; }
.fcia-con-prod .fcia-prod { margin-top: 4px; }
.fcia kbd { font: inherit; font-size: .78em; font-weight: 700; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; background: #fff; color: var(--ink-2); }
.fcia .tc-tit { display: flex; align-items: center; gap: 8px; }
.fcia-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--navy); color: #fff; font-size: .8rem; font-weight: 800; flex-shrink: 0; }
.fcia-paso + .fcia-paso { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.fcia-sub { font-size: .85rem; font-weight: 700; color: var(--ink-2); margin: 14px 0 8px; }
.fcia-err, .fcia-gen-err { margin: 12px 0 0; white-space: pre-line; }
.fcia-err[hidden], .fcia-gen-err[hidden] { display: none; }
.fcia-tip { color: var(--ink-2); background: var(--blue-50); border-radius: 12px; padding: 9px 12px; margin: 12px 0 0; line-height: 1.45; }
.fcia-tip .ico { color: var(--blue); }

/* Descarga del recorte automático */
.fcia-motor { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; margin-top: 12px; padding: 10px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff; font-size: .86rem; font-weight: 600; color: var(--ink-2); }
.fcia-motor[hidden] { display: none; }
.fcia-motor-txt { flex: 1 1 220px; min-width: 0; }
.fcia-motor progress { flex: 1 1 140px; height: 9px; border: 0; border-radius: 999px; overflow: hidden; background: var(--line); accent-color: var(--orange); -webkit-appearance: none; appearance: none; }
.fcia-motor progress[hidden] { display: none; }
.fcia-motor progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
.fcia-motor progress::-webkit-progress-value { background: var(--orange); border-radius: 999px; transition: width .2s; }
.fcia-motor progress::-moz-progress-bar { background: var(--orange); border-radius: 999px; }
.fcia-motor.error { border-color: var(--err); background: var(--err-50); color: var(--err-700); }

/* Producto recortado */
.fcia-prod { display: flex; align-items: center; gap: 14px; margin-top: 12px; }
.fcia-prod[hidden] { display: none; }
.fcia-prod-mini { flex: 0 0 auto; width: 84px; height: 84px; border-radius: 12px; border: 1.5px solid var(--line); overflow: hidden;
  background: #fff conic-gradient(#eef1f6 25%, #fff 0 50%, #eef1f6 0 75%, #fff 0) 0 0 / 12px 12px; }
.fcia-prod-mini canvas { width: 100%; height: 100%; display: block; }
.fcia-prod-info { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-width: 0; }
.fcia-prod-info b { color: var(--navy); font-size: .95rem; overflow-wrap: anywhere; }
.fcia-prod-info .btn { margin-top: 4px; }
/* Quitar textos y restos sueltos + Corregir recorte (pincel) */
.fcia-limpiar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; margin-top: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.fcia-limpiar[hidden], .fcia-limpiar [hidden] { display: none; }
.fcia-check { display: flex; align-items: flex-start; gap: 10px; flex: 1 1 240px; min-width: 0; margin: 0; font-size: .88rem; line-height: 1.4; cursor: pointer; }
.fcia-check input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--orange); flex-shrink: 0; }
.fcia-check b { color: var(--navy); }
.fcia-check small { display: block; color: var(--muted); font-size: .78rem; }
.fcia-corregir { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 7px; }
.fcia-pincel-ico { width: 16px; height: 16px; flex-shrink: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18.4 2.6a2.1 2.1 0 0 1 3 3L11 16l-4 1 1-4Z'/%3E%3Cpath d='M7 17c-2 0-4 1.5-4 4 2 0 5-.5 5-3'/%3E%3C/svg%3E") center / contain no-repeat; }
.fcia-aviso-rec { flex-basis: 100%; margin: 0; padding: 8px 11px; border-radius: 10px; background: #fff6db; color: #6b4c00; line-height: 1.45; }
.fcia-aviso-rec.ok { background: var(--ok-50); color: var(--ok-700); }
/* «Mejorar el recorte con HD» (cuando la foto tiene el recorte rápido y el equipo puede usar el HD) */
.fcia-hd { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 10px; padding: 10px 12px; border: 1.5px solid var(--violeta); border-radius: 12px; background: var(--violeta-50); font-size: .84rem; line-height: 1.45; color: var(--ink-2); }
.fcia-hd[hidden] { display: none; }
.fcia-hd p { flex: 1 1 220px; min-width: 0; margin: 0; }
.fcia-hd .btn:disabled { opacity: .55; cursor: not-allowed; }
.fcia-afinar { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; background: #fff; }
.fcia-afinar[hidden] { display: none; }
.fcia-afinar summary { cursor: pointer; font-weight: 700; font-size: .88rem; color: var(--navy); }
.fcia-slider { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .86rem; margin-top: 10px; }
.fcia-slider b { color: var(--navy); }
.fcia-slider small { color: var(--muted); font-weight: 500; }
.fcia-slider input, .fcia-desliz input { width: 100%; accent-color: var(--orange); }

/* Escenas */
.fcia-grupo { font-size: .74rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 8px; }
.fcia-paso .tc-tit + .fcia-grupo { margin-top: 4px; }
.fcia-estilos { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; }
.fcia-estilo { display: flex; flex-direction: column; align-items: stretch; gap: 2px; padding: 5px 5px 8px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  font: inherit; text-align: left; color: var(--ink); cursor: pointer; transition: border-color var(--t-1), box-shadow var(--t-1), transform var(--t-1); }
.fcia-mini { display: block; width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 10px; margin-bottom: 4px; }
.fcia-estilo-n { font-size: .8rem; font-weight: 800; color: var(--navy); line-height: 1.25; padding: 0 3px; }
.fcia-estilo-c { font-size: .7rem; color: var(--muted); line-height: 1.3; padding: 0 3px; }
@media (hover: hover) { .fcia-estilo:hover:not([aria-pressed=true]):not(:disabled) { border-color: var(--line-2); transform: translateY(-1px); box-shadow: var(--shadow-sm); } }
.fcia-estilo[aria-pressed=true] { border-color: var(--orange); background: var(--orange-50); box-shadow: 0 0 0 3px rgba(254, 130, 2, .18); }
.fcia-estilo[aria-pressed=true] .fcia-estilo-n { color: var(--orange-700); }
.fcia-estilo:focus-visible, .fcia-formato:focus-visible { outline: 3px solid rgba(0, 113, 188, .4); outline-offset: 2px; }
.fcia-color { display: inline-flex; align-items: center; gap: 10px; font-weight: 600; font-size: .9rem; margin-top: 14px; }
.fcia-color[hidden] { display: none; }
.fcia-color input { width: 48px; height: 34px; padding: 2px; border: 1.5px solid var(--line); border-radius: 8px; background: #fff; cursor: pointer; }
.fcia-texto { margin-top: 14px; display: flex; flex-direction: column; gap: 6px; }
.fcia-texto[hidden] { display: none; }
.fcia-texto label { font-weight: 700; font-size: .9rem; color: var(--ink); }
.fcia-texto textarea { width: 100%; resize: vertical; min-height: 76px; }
.fcia-ml-nota { margin: 12px 0 0; padding: 9px 12px; border-radius: 10px; background: #fff6db; color: #6b4c00; line-height: 1.45; }
.fcia-ml-nota[hidden] { display: none; }

/* Formatos */
.fcia-formatos { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.fcia-formato { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border: 1.5px solid var(--line); border-radius: 12px; background: #fff; font: inherit; text-align: left; color: var(--ink); cursor: pointer; min-width: 0; }
.fcia-formato b { display: block; font-size: .84rem; color: var(--navy); }
.fcia-formato small { display: block; font-size: .72rem; color: var(--muted); line-height: 1.3; }
.fcia-formato-ico { flex: 0 0 30px; height: 30px; display: grid; place-items: center; }
.fcia-formato-ico::before { content: ''; width: var(--fw, 26px); height: var(--fh, 26px); border: 2px solid currentColor; border-radius: 4px; color: var(--ink-2); }
@media (hover: hover) { .fcia-formato:hover:not([aria-pressed=true]) { border-color: var(--line-2); } }
.fcia-formato[aria-pressed=true] { border-color: var(--orange); background: var(--orange-50); box-shadow: 0 0 0 3px rgba(254, 130, 2, .16); }
.fcia-formato[aria-pressed=true] .fcia-formato-ico::before { color: var(--orange-700); }
.fcia-formato[aria-pressed=true] b { color: var(--orange-700); }

/* Generar */
.fcia-generar { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.fcia-cupo { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 12px; }
.fcia-cupo .ico { width: 1.05em; height: 1.05em; }
.fcia-cupo-link[hidden] { display: none; }
.fcia-generar .btn-block .ico { width: 1.2em; height: 1.2em; vertical-align: -.22em; }
.fcia-costo { display: block; margin-top: 8px; text-align: center; }

/* Vista previa antes / después */
.fcia-prev { min-height: 280px; background: #fff conic-gradient(#f3f5f9 25%, #fff 0 50%, #f3f5f9 0 75%, #fff 0) 0 0 / 16px 16px; }
.fcia-comp { position: relative; display: inline-block; max-width: 100%; line-height: 0; touch-action: pan-y; cursor: ew-resize; user-select: none; -webkit-user-select: none; }
.fcia-comp.sin-comp { cursor: default; }
.fcia-comp[hidden] { display: none; }
.fcia-prev .fcia-despues { display: block; width: auto; height: auto; max-width: 100%; max-height: min(520px, 64vh); border-radius: 6px; box-shadow: 0 2px 12px rgba(20, 35, 70, .2); }
.fcia-prev .fcia-antes { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; border-radius: 6px; }
.fcia-antes[hidden], .fcia-linea[hidden], .fcia-tag[hidden], .fcia-proc[hidden] { display: none; }
.fcia-linea { position: absolute; top: 0; bottom: 0; left: 50%; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(20, 35, 70, .35); pointer-events: none; }
.fcia-linea span { position: absolute; top: 50%; left: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(20, 35, 70, .35);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M9 7l-5 5 5 5M15 7l5 5-5 5' stroke='%23141A3C' stroke-width='2.2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 22px; background-position: center; background-repeat: no-repeat; }
.fcia-tag { position: absolute; top: 8px; padding: 3px 8px; border-radius: 999px; background: rgba(20, 35, 70, .72); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.4; pointer-events: none; }
.fcia-tag-a { left: 8px; }
.fcia-tag-d { right: 8px; }
.fcia-proc { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: max-content; max-width: 86%; display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
  background: rgba(255, 255, 255, .95); box-shadow: var(--shadow); font-size: .9rem; font-weight: 700; color: var(--navy); line-height: 1.35; }
.fcia-proc .spinner { flex-shrink: 0; }
.fcia-desliz { display: flex; align-items: center; gap: 10px; margin-top: 10px; font-size: .8rem; font-weight: 700; color: var(--muted); }
.fcia-desliz[hidden] { display: none; }
.fcia-desliz input { flex: 1; min-width: 0; }
.fcia-desliz input:focus-visible { outline: 3px solid rgba(0, 113, 188, .35); outline-offset: 2px; }
#fciaCap { min-height: 1.2em; overflow-wrap: anywhere; }

/* Resultado */
.fcia-res { margin-top: 12px; }
.fcia-res[hidden] { display: none; }
.fcia-orig { display: flex; align-items: flex-start; gap: 10px; font-size: .88rem; line-height: 1.4; cursor: pointer; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.fcia-orig input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--orange); flex-shrink: 0; }
.fcia-orig b { color: var(--navy); }
.fcia-orig small { color: var(--muted); }
.fcia-marca { margin: 10px 0 0; padding: 9px 12px; border-radius: 10px; background: var(--orange-50); color: var(--ink-2); line-height: 1.45; }
.fcia-marca[hidden] { display: none; }
.fcia-desc { margin-top: 12px; justify-content: flex-start; }
.fcia-desc .ico { width: 1.1em; height: 1.1em; vertical-align: -.18em; }
.fcia-mas { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fcia-mas [hidden] { display: none; }
.fcia-mas .ico { width: 1.05em; height: 1.05em; vertical-align: -.16em; }
.fcia-estado { margin: 10px 0 0; min-height: 1.3em; overflow-wrap: anywhere; }
.fcia-hist[hidden] { display: none; }
.fcia-hist-l { list-style: none; margin: 0; padding: 4px 2px 6px; display: flex; gap: 10px; overflow-x: auto; }
.fcia-hist-b { position: relative; display: grid; place-items: center; width: 70px; height: 70px; padding: 2px; border: 2px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer; }
.fcia-hist-b canvas { max-width: 100%; max-height: 100%; display: block; border-radius: 6px; }
.fcia-hist-b[aria-current=true] { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(254, 130, 2, .2); }
.fcia-hist-ok { position: absolute; left: 3px; bottom: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--ok-700); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; line-height: 1; }

/* Mientras trabaja */
.fcia :disabled { cursor: not-allowed; }
.fcia-estilo:disabled, .fcia-formato:disabled { opacity: .55; }

/* Secciones de abajo */
.fcia-paso-n { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--orange-50); color: var(--orange-700); font-size: .8rem; font-weight: 800; margin-right: 4px; vertical-align: 1px; }
.fcia-video { margin-top: 22px; }
.fcia-video:empty { display: none; }
.fcia-ej-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.fcia-ej { margin: 0; background: #fff; border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.fcia-ej-svg { display: block; width: 100%; height: auto; }
.fcia-ej figcaption { padding: 10px 14px; font-size: .88rem; color: var(--ink-2); }
.fcia-ej figcaption b { color: var(--navy); }
.fcia-ej-nota { margin-top: 10px; }

@media (max-width: 860px) {
  .fcia-col-prev { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); scroll-margin-top: 76px; }
  .fcia-ej-grid { grid-template-columns: 1fr; max-width: 460px; }
}
@media (max-width: 640px) {
  .fcia .dropzone { padding: 22px 14px; }
  .fcia-estilos { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .fcia-estilo { padding: 4px 4px 7px; border-radius: 12px; }
  .fcia-estilo-c { display: none; }
  .fcia-formatos { grid-template-columns: 1fr; }
  .fcia-prev { min-height: 220px; padding: 10px; }
  .fcia-prev .fcia-despues { max-height: 60vh; }
  .fcia-desc .btn { flex: 1 1 auto; }
  .fcia-mas .btn { flex: 1 1 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .fcia-estilo, .fcia-estilo:hover { transition: none; transform: none !important; }
}
