/* Copiloto IA: demostración interactiva (extraída de home.css) */
/* ---------- COPILOTO ---------- */
.copilot { overflow: hidden; overflow: clip; }
.copilot::before { content: ""; position: absolute; left: 50%; top: 38%; width: 90vw; height: 60vw; max-width: 1300px; max-height: 900px; transform: translate(-50%, 0); background: radial-gradient(closest-side, rgba(38, 170, 238, .16), transparent); pointer-events: none; }
.copilot__app {
  position: relative; display: grid; grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); gap: 0; border-radius: var(--radius-lg); overflow: hidden;
  background: radial-gradient(80% 60% at 70% 0%, rgba(38, 170, 238, .14), transparent 60%), linear-gradient(180deg, #0c1c33, #060f1e); border: 1px solid rgba(6, 20, 39, .2);
  box-shadow: 0 70px 140px -50px rgba(6, 20, 39, .55), 0 30px 60px -40px rgba(14, 95, 166, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.copilot__side { padding: 28px 22px; border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 18px; background: rgba(3, 7, 15, .35); }
.copilot__side-title { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.copilot__prompts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.prompt {
  width: 100%; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px; border-radius: 14px; text-align: left; font-size: .92rem; line-height: 1.35; color: var(--fg-2);
  background: rgba(255, 255, 255, .025); box-shadow: inset 0 0 0 1px var(--line); transition: background-color .3s, box-shadow .3s, color .3s, transform .4s var(--ease-out);
}
.prompt:hover { background: rgba(38, 170, 238, .08); box-shadow: inset 0 0 0 1px rgba(38, 170, 238, .45); color: #fff; transform: translateX(3px); }
.prompt.is-used { color: var(--muted); }
.prompt.is-used .prompt__i { color: var(--ok); }
.prompt[aria-disabled="true"] { opacity: .5; pointer-events: none; }
.prompt__i { flex: none; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: var(--brand-bright); background: rgba(38, 170, 238, .1); }
.prompt__i svg { width: 18px; height: 18px; }
.copilot__note { margin-top: auto; display: flex; gap: 10px; font-size: .78rem; line-height: 1.5; color: var(--muted); padding-top: 16px; border-top: 1px solid var(--line); }
.copilot__note svg { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--brand-bright); }
.copilot__note strong { color: var(--fg-2); font-weight: 500; }

.copilot__window { display: flex; flex-direction: column; min-width: 0; height: clamp(560px, 70vh, 680px); }
.copilot__bar { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); font-size: .85rem; }
.copilot__dots { display: flex; gap: 6px; }
.copilot__dots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(160, 200, 255, .18); }
.copilot__name { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.copilot__name img { width: 20px; height: auto; }
.copilot__status { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .66rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.copilot__status .pulse-dot { width: 6px; height: 6px; }
.copilot__log { flex: 1; overflow-y: auto; padding: 24px clamp(16px, 2.4vw, 28px); display: flex; flex-direction: column; gap: 18px; scroll-behavior: smooth; overscroll-behavior: contain; }
.copilot__log::-webkit-scrollbar { width: 8px; } .copilot__log::-webkit-scrollbar-thumb { background: rgba(160, 200, 255, .15); border-radius: 8px; }

.msg { display: flex; gap: 12px; max-width: 100%; animation: msgIn .6s var(--ease-out) both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(12px); } }
.msg--user { justify-content: flex-end; }
.msg--user .msg__body { max-width: 78%; padding: 12px 16px; border-radius: 16px 16px 4px 16px; background: var(--grad-brand); color: #fff; box-shadow: 0 12px 30px -14px rgba(38, 170, 238, .7); }
.msg__avatar { flex: none; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: rgba(38, 170, 238, .1); box-shadow: inset 0 0 0 1px rgba(38, 170, 238, .3); }
.msg__avatar img { width: 20px; height: auto; }
.msg--ai .msg__body { flex: 1; min-width: 0; display: grid; gap: 14px; padding-top: 4px; color: var(--fg-2); }
.msg--ai .msg__body p strong { color: #fff; font-weight: 550; }
.thinking { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-family: var(--font-mono); font-size: .74rem; color: var(--muted); }
.thinking li { display: flex; align-items: center; gap: 10px; opacity: 0; transform: translateY(6px); transition: opacity .4s, transform .5s var(--ease-out), color .3s; }
.thinking li.is-on { opacity: 1; transform: none; }
.thinking li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid rgba(160, 200, 255, .3); border-top-color: var(--brand-bright); animation: spin .8s linear infinite; }
.thinking li.is-done { color: var(--fg-2); }
.thinking li.is-done::before { animation: none; border: 0; background: var(--ok) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2303231a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><path d='m5 12.5 4.2 4.2L19 7'/></svg>") center / 8px no-repeat; }
.answer { min-height: 1.6em; }
.answer .cur { display: inline-block; width: 7px; height: 1em; vertical-align: -2px; margin-left: 2px; background: var(--brand-bright); animation: blink 1s steps(1) infinite; }
.viz { border-radius: 16px; padding: 18px; background: rgba(3, 7, 15, .5); box-shadow: inset 0 0 0 1px var(--line); animation: msgIn .7s var(--ease-out) both; }
.viz__title { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 14px; font-family: var(--font-mono); font-size: .66rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.viz svg { width: 100%; height: auto; overflow: visible; }
.meta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.src { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; font-family: var(--font-mono); font-size: .64rem; letter-spacing: .06em; color: var(--fg-2); background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px var(--line); }
.src--conf { color: #c4f6e1; box-shadow: inset 0 0 0 1px rgba(79, 227, 168, .3); background: rgba(79, 227, 168, .06); }
.ai-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.ai-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 999px; font-size: .85rem; font-weight: 500; color: #fff; background: rgba(38, 170, 238, .16); box-shadow: inset 0 0 0 1px rgba(38, 170, 238, .45); transition: background-color .3s, box-shadow .3s; }
.ai-btn:hover { background: rgba(38, 170, 238, .3); }
.ai-btn svg { width: 15px; height: 15px; }
.ai-btn--ghost { background: transparent; color: var(--fg-2); box-shadow: inset 0 0 0 1px var(--line-2); }
.ai-btn.is-done { background: rgba(79, 227, 168, .14); box-shadow: inset 0 0 0 1px rgba(79, 227, 168, .5); color: #c4f6e1; pointer-events: none; }

/* tablas y barras dentro de respuestas */
.mini-table { width: 100%; border-collapse: collapse; font-size: .8rem; }
.mini-table th { text-align: left; font-family: var(--font-mono); font-weight: 400; font-size: .62rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 8px 10px 0; }
.mini-table td { padding: 9px 8px 9px 0; border-top: 1px solid var(--line); color: var(--fg-2); vertical-align: middle; }
.mini-table td:first-child { color: #fff; }
.mini-table .num { font-family: var(--font-mono); font-size: .76rem; text-align: right; white-space: nowrap; }
.cov { position: relative; height: 6px; min-width: 70px; border-radius: 6px; background: rgba(160, 200, 255, .1); overflow: hidden; }
.cov i { position: absolute; inset: 0 auto 0 0; width: calc(var(--w) * 100%); border-radius: inherit; background: var(--risk); transform-origin: left; animation: grow 1s var(--ease-out) both; }
.cov i.w { background: var(--warn); } .cov i.g { background: var(--ok); }
@keyframes grow { from { transform: scaleX(0); } }
.pill { display: inline-flex; padding: 2px 8px; border-radius: 999px; font-size: .64rem; font-family: var(--font-mono); letter-spacing: .04em; white-space: nowrap; }
.pill--r { color: #ffc4bc; background: rgba(255, 122, 107, .14); } .pill--w { color: #ffe2b0; background: rgba(255, 181, 71, .14); } .pill--g { color: #c4f6e1; background: rgba(79, 227, 168, .12); }
.ring-wrap { display: grid; grid-template-columns: 132px 1fr; gap: 20px; align-items: center; }
.ring-wrap ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; font-size: .82rem; }
.ring-wrap li { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; }
.ring-wrap li span:last-child { font-family: var(--font-mono); font-size: .78rem; color: #fff; }
.ring-wrap li .cov { grid-column: 1 / -1; }
@media (max-width: 560px) { .ring-wrap { grid-template-columns: 1fr; justify-items: center; } .ring-wrap ul { width: 100%; } }

.copilot__input { display: flex; gap: 10px; padding: 14px; border-top: 1px solid var(--line); background: rgba(3, 7, 15, .35); }
.copilot__input input { flex: 1; min-width: 0; height: 50px; padding: 0 18px; border-radius: 14px; border: 1px solid var(--line-2); background: rgba(255, 255, 255, .03); color: var(--fg); font-size: .95rem; transition: border-color .25s, box-shadow .25s; }
.copilot__input input::placeholder { color: #5f7290; }
.copilot__input input:focus { outline: none; border-color: var(--brand-bright); box-shadow: 0 0 0 4px rgba(38, 170, 238, .16); }
.copilot__send { flex: none; width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: var(--grad-brand); box-shadow: 0 10px 24px -10px rgba(38, 170, 238, .8); transition: transform .4s var(--ease-out); }
.copilot__send:hover { transform: translateY(-2px); }
.copilot__send svg { width: 20px; height: 20px; }
.copilot__send[aria-disabled="true"] { opacity: .5; pointer-events: none; }

@media (max-width: 960px) {
  .copilot__app { grid-template-columns: minmax(0, 1fr); }
  .copilot__side { border-right: 0; border-bottom: 1px solid var(--line); padding: 20px 16px; }
  .copilot__prompts { grid-auto-flow: column; grid-auto-columns: minmax(240px, 78%); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; margin-inline: -16px; padding-inline: 16px; scrollbar-width: none; }
  .copilot__prompts::-webkit-scrollbar { display: none; }
  .copilot__prompts li { scroll-snap-align: start; }
  .prompt { height: 100%; }
  .copilot__note { margin-top: 0; }
  .copilot__window { height: 600px; }
  .copilot__status { display: none; }
}

/* ---------- Barras de margen (respuesta del copiloto) ---------- */
.bars { display: grid; gap: 12px; }
.bars__row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 14px; font-size: .84rem; color: var(--fg-2); }
.bars__row b { font-family: var(--font-mono); font-weight: 500; font-size: .8rem; color: #fff; white-space: nowrap; }
.bars__row b small { font-size: .7rem; color: var(--muted); font-weight: 400; }
.bars__track { position: relative; height: 10px; border-radius: 10px; background: rgba(160, 200, 255, .08); }
.bars__track i { position: absolute; inset: 0 auto 0 0; width: calc(var(--w) * 100%); border-radius: inherit; background: linear-gradient(90deg, #0e5fa6, #26aaee); transform-origin: left; animation: grow 1.1s var(--ease-out) both; }
.bars__track i.ghost { background: transparent; box-shadow: inset 0 0 0 1px rgba(255, 122, 107, .6); animation-delay: .1s; }
.bars__row.is-hl { color: #fff; }
.bars__row.is-hl .bars__track i:not(.ghost) { background: linear-gradient(90deg, #b8473b, #ff7a6b); }
@media (max-width: 560px) { .bars__row { grid-template-columns: 84px 1fr; } .bars__row b { grid-column: 2; } }

.copilot .section-head .lead { color: var(--fg-2); }
