/* Asesor comercial y de soporte · StudioWeb67 */
@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:400 700;font-display:swap;src:url(fonts/plex-sans-latin-ext.woff2) format('woff2');unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C4,U+2113,U+2C60-2C7F,U+A720-A7FF}
@font-face{font-family:'IBM Plex Sans';font-style:normal;font-weight:400 700;font-display:swap;src:url(fonts/plex-sans-latin.woff2) format('woff2');unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}

:root, [data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8f9fb;
  --side: #ffffff;
  --text: #17202e;
  --muted: #566070;
  --line: #dce1e8;
  --line-strong: #c5ccd6;
  --accent: #1d3a5f;
  --accent-hover: #142c4a;
  --accent-text: #ffffff;
  --accent-soft: #e8eef6;
  --link: #1d4f8a;
  --user: #1d3a5f;
  --user-text: #ffffff;
  --ok: #1f7a4d;
  --warn: #9a5b00;
  --bad: #a3262f;
  --code: #eef1f5;
  --focus: #2f6db5;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
}
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e131a;
  --surface: #151b24;
  --surface-2: #1a212c;
  --side: #121821;
  --text: #e7eaef;
  --muted: #a3acb9;
  --line: #273140;
  --line-strong: #364253;
  --accent: #8fb3e0;
  --accent-hover: #a9c5e9;
  --accent-text: #0e131a;
  --accent-soft: #1c2735;
  --link: #9cc0ec;
  --user: #2a4467;
  --user-text: #f2f5f9;
  --ok: #5cc28f;
  --warn: #e0a84a;
  --bad: #f08a91;
  --code: #1e2632;
  --focus: #8fb3e0;
  --shadow: none;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); overflow: hidden; }
body { font-family: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif; font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[v-cloak] { display: none; }

#app { height: 100vh; height: 100dvh; display: flex; }

/* ---------- Barra lateral ---------- */
.side {
  width: 280px; flex: none; display: flex; flex-direction: column;
  background: var(--side); border-right: 1px solid var(--line);
}
.side-brand { display: flex; align-items: center; gap: 12px; padding: 18px 18px 16px; border-bottom: 1px solid var(--line); }
.mark {
  width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--accent); color: var(--accent-text);
  display: grid; place-items: center; font-weight: 600; font-size: 13px; letter-spacing: .02em;
}
.side-brand .mark { display: grid; font-size: 13px; color: var(--accent-text); }
.side-brand strong { display: block; font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
.side-brand span { display: block; font-size: 12.5px; color: var(--muted); }
.side-new { margin: 14px 14px 6px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px;
  padding: 9px 12px; font-weight: 500; font-size: 14px; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.side h2 { margin: 14px 18px 6px; font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.side ul { list-style: none; margin: 0; padding: 0 8px; overflow: auto; flex: 1; }
.side li { display: flex; align-items: center; border-radius: 8px; }
.side li:hover, .side li.active { background: var(--accent-soft); }
.side li button.item { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 8px 10px; cursor: pointer; border-radius: 8px; }
.side li button.item strong { display: block; font-weight: 500; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side li button.item span { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; }
.side li button.drop { border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 30px; height: 30px; border-radius: 6px; flex: none; }
.side li button.drop:hover { color: var(--bad); }
.side .empty { margin: 4px 18px; color: var(--muted); font-size: 13px; }
.side-foot { border-top: 1px solid var(--line); padding: 12px 18px 16px; display: grid; gap: 6px; font-size: 13px; }
.side-foot a { color: var(--link); text-decoration: none; }
.side-foot a:hover { text-decoration: underline; }
.side-foot small { color: var(--muted); font-size: 12px; }

/* ---------- Principal ---------- */
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top {
  min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
}
.ident { display: flex; align-items: center; gap: 12px; min-width: 0; }
.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%; background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center; border: 1px solid var(--line);
}
[data-theme="dark"] .avatar { color: var(--accent); }
.ident h1 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ident h1 span { color: var(--muted); font-weight: 400; }
.status { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--bad); }
.dot.busy { background: var(--warn); }
.tools { display: flex; align-items: center; gap: 4px; flex: none; }
.ghost {
  border: 1px solid transparent; background: transparent; color: var(--muted); border-radius: 8px;
  padding: 7px 10px; font-size: 13.5px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.ghost:hover { color: var(--text); background: var(--surface-2); border-color: var(--line); }
.ghost svg { flex: none; }
.only-mobile { display: none; }

.stage { flex: 1; overflow: auto; display: flex; justify-content: center; scroll-behavior: smooth; }
.column { width: min(820px, calc(100% - 48px)); display: flex; flex-direction: column; }

/* Bienvenida */
.welcome { margin: auto 0; padding: 40px 0 32px; }
.welcome .eyebrow { margin: 0 0 8px; font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
[data-theme="dark"] .welcome .eyebrow { color: var(--accent); }
.welcome h2 { margin: 0 0 8px; font-size: 30px; font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.welcome p.lead { margin: 0 0 28px; color: var(--muted); font-size: 16px; max-width: 620px; }
.actions-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.action {
  display: flex; gap: 14px; align-items: flex-start; text-align: left; cursor: pointer;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: var(--shadow);
  transition: border-color .15s ease, background-color .15s ease;
}
.action:hover { border-color: var(--accent); }
.action .ic { width: 36px; height: 36px; flex: none; border-radius: 8px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.action strong { display: block; font-weight: 600; font-size: 15px; margin-bottom: 2px; }
.action span.desc { display: block; color: var(--muted); font-size: 13.5px; line-height: 1.45; }
.topics { margin-top: 22px; }
.topics h3 { margin: 0 0 10px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); border-radius: 999px;
  padding: 6px 13px; font-size: 13px; cursor: pointer; line-height: 1.3;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }
[data-theme="dark"] .chip:hover { color: var(--accent); }
.chip:disabled { opacity: .5; cursor: default; }

/* Conversacion */
.thread { padding: 24px 0 28px; display: flex; flex-direction: column; gap: 18px; }
.msg { display: flex; gap: 10px; max-width: 100%; }
.msg.user { justify-content: flex-end; }
.msg .avatar { width: 30px; height: 30px; margin-top: 22px; }
.msg-body { min-width: 0; max-width: min(640px, 86%); }
.msg.user .msg-body { display: flex; flex-direction: column; align-items: flex-end; }
.meta { display: block; margin: 0 2px 4px; font-size: 12px; color: var(--muted); }
.bubble { border-radius: 12px; padding: 11px 15px; overflow-wrap: anywhere; }
.msg.assistant .bubble { background: var(--surface); border: 1px solid var(--line); border-top-left-radius: 4px; box-shadow: var(--shadow); line-height: 1.6; }
.msg.user .bubble { background: var(--user); color: var(--user-text); border-top-right-radius: 4px; white-space: pre-wrap; }
.note { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13.5px; }
.typing { display: inline-flex; gap: 4px; align-items: center; height: 18px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: pulse 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes pulse { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.md p { margin: 0 0 10px; }
.md p:last-child { margin-bottom: 0; }
.md h2, .md h3, .md h4 { margin: 14px 0 6px; letter-spacing: -.01em; }
.md h2 { font-size: 1.15rem; } .md h3 { font-size: 1.05rem; } .md h4 { font-size: 1rem; }
.md ul, .md ol { margin: 0 0 10px; padding-left: 1.25em; }
.md li { margin: 3px 0; }
.md a { color: var(--link); text-underline-offset: 2px; }
.md strong { font-weight: 600; }
.md code { font-family: 'IBM Plex Mono', Consolas, monospace; font-size: .9em; background: var(--code); border-radius: 4px; padding: 1px 5px; }
.md pre { margin: 0 0 10px; background: var(--code); border-radius: 8px; padding: 12px 14px; overflow: auto; }
.md pre code { padding: 0; background: transparent; }
.md table { width: 100%; border-collapse: collapse; margin: 0 0 12px; font-size: 13.5px; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; vertical-align: top; }
.md th { background: var(--surface-2); font-weight: 600; }
.msgtools { display: flex; gap: 12px; margin: 6px 2px 0; }
.msgtools button { border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; padding: 2px 0; }
.msgtools button:hover { color: var(--text); }
.err { color: var(--bad); }

/* Compositor */
.dock { padding: 12px 24px 18px; display: flex; flex-direction: column; align-items: center; background: linear-gradient(to bottom, transparent, var(--bg) 18px); }
.dock .chips { width: min(820px, 100%); margin-bottom: 10px; }
form.composer {
  width: min(820px, 100%); display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 6px 6px 6px 16px; box-shadow: var(--shadow);
}
form.composer:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 18%, transparent); }
textarea {
  flex: 1; resize: none; border: 0; outline: none; background: transparent; color: var(--text);
  font: inherit; font-size: 15.5px; line-height: 1.45; max-height: 160px; padding: 9px 0;
}
textarea:focus-visible { outline: none; }
textarea::placeholder { color: var(--muted); }
.send {
  height: 40px; min-width: 40px; border: 0; border-radius: 8px; background: var(--accent); color: var(--accent-text);
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 14px; font-weight: 500; font-size: 14px; flex: none;
}
.send:hover { background: var(--accent-hover); }
.send:disabled { background: var(--line); color: var(--muted); cursor: default; }
.hint { width: min(820px, 100%); margin: 8px 0 0; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hint a { color: var(--link); }
.backdrop { display: none; }

@media (max-width: 900px) {
  .side { position: fixed; z-index: 4; inset: 0 auto 0 0; width: min(86vw, 320px); transform: translateX(-105%); transition: transform .2s ease; padding-top: env(safe-area-inset-top); }
  .side.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  .backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 15, 25, .45); z-index: 3; }
  .only-mobile { display: inline-flex; }
}
@media (max-width: 640px) {
  body { font-size: 15px; }
  .top { padding: calc(8px + env(safe-area-inset-top)) 12px 8px; min-height: 56px; }
  .ident h1 { font-size: 14.5px; }
  .ident h1 span { display: none; }
  .ident .avatar { display: none; }
  .ghost .label { display: none; }
  .ghost { padding: 8px; }
  .column { width: 100%; padding: 0 14px; }
  .welcome { padding: 20px 0 12px; }
  .welcome h2 { font-size: 24px; }
  .welcome p.lead { font-size: 14.5px; margin-bottom: 18px; }
  .actions-grid { grid-template-columns: 1fr; gap: 8px; }
  .action { padding: 12px 14px; }
  .action .ic { width: 32px; height: 32px; }
  .msg .avatar { display: none; }
  .msg-body { max-width: 92%; }
  .dock { padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); }
  .dock .chips { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .dock .chips .chip { flex: none; }
  .send { height: 44px; min-width: 44px; padding: 0 12px; }
  .send .label { display: none; }
  textarea { font-size: 16px; }
  .hint .extra { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Fichas de producto (modo comercial). Nunca dentro de la burbuja. */
.promo-cards { display: grid; gap: 10px; margin-top: 10px; max-width: 560px; }
.promo-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow); }
.promo-kicker { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
.promo-title { display: block; font-size: 15px; color: var(--text); line-height: 1.3; }
.promo-summary { margin: 4px 0 10px; font-size: 13.5px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.promo-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.promo-btn { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 6px; border: 1px solid var(--line-strong); background: transparent; color: var(--text); text-decoration: none; cursor: pointer; }
.promo-btn:hover { border-color: var(--accent); }
.promo-btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.promo-btn.primary:hover { background: var(--accent-hover); }
.promo-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.promo-btn:disabled { opacity: .55; cursor: default; }
@media (max-width: 640px) { .promo-cards { max-width: 100%; } .promo-btn { flex: 1 1 auto; text-align: center; } }

/* ---- Modo incrustado (/ai/?embed=1, widget del landing NGM). Sin ?embed nada cambia. ---- */
html.embed .side { display: none !important; }
html.embed .top { display: none; }