/* ===== Chat "Preguntale a Tu CLO" ===== */
.chat { padding: 0; overflow: hidden; }
.chat-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.chat-ic { width: 38px; height: 38px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent); }
.chat-head h2 { font-size: 17px; font-weight: 900; letter-spacing: -.02em; }
.chat-head .sub { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.chat-head .acts { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.chat-head select, .icon-btn { background: var(--surface-2); border: 1px solid var(--border); color: var(--text); border-radius: 10px; font: 600 12.5px var(--font); padding: 7px 10px; cursor: pointer; }
.icon-btn { width: 34px; height: 34px; padding: 0; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }

.chat-body { max-height: 460px; min-height: 180px; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 14px; scroll-behavior: smooth; }
.msg { max-width: 88%; animation: rise .35s both; }
.msg.yo { align-self: flex-end; background: var(--ink-card); color: #f4f2ee; padding: 10px 14px; border-radius: 16px 16px 4px 16px; font-weight: 500; white-space: pre-wrap; }
.msg.clo { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--border); padding: 14px 16px; border-radius: 16px 16px 16px 4px; line-height: 1.55; }
.msg.clo h4 { font-size: 14px; font-weight: 800; margin: 10px 0 4px; }
.msg.clo h4:first-child { margin-top: 0; }
.msg.clo p { margin: 0 0 8px; }
.msg.clo p:last-child { margin-bottom: 0; }
.msg.clo ul, .msg.clo ol { margin: 4px 0 8px 20px; }
.msg.clo li { margin-bottom: 4px; }
.msg.clo code { background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 1px 6px; font-size: 12.5px; }
.msg.clo table { margin: 8px 0; font-size: 12.5px; background: var(--surface); border-radius: 10px; overflow: hidden; }
.msg.clo .conf { font-size: 10.5px; font-weight: 800; letter-spacing: .04em; padding: 1px 7px; border-radius: 99px; vertical-align: 1px; }
.conf.seguro { background: var(--ok-soft); color: var(--ok); }
.conf.probable { background: var(--warn-soft); color: var(--warn); }
.conf.sindato { background: var(--surface); color: var(--muted); border: 1px solid var(--border); }
.msg.err { align-self: stretch; max-width: none; background: var(--bad-soft); color: var(--bad); border: 1px solid color-mix(in srgb, var(--bad) 30%, transparent); padding: 12px 14px; border-radius: 14px; font-size: 13px; }
.msg.err code { background: var(--surface); padding: 1px 6px; border-radius: 6px; color: var(--text); }

.pensando { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pensando i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: bounce 1s infinite ease-in-out; }
.pensando i:nth-child(2) { animation-delay: .15s; } .pensando i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 80%, 100% { transform: scale(.5); opacity: .4; } 40% { transform: scale(1); opacity: 1; } }

.chat-sug { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px 14px; }
.chat-sug button { background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 7px 13px; font: 600 12.5px var(--font); color: var(--text-2); cursor: pointer; }
.chat-sug button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

.chat-foot { display: flex; gap: 10px; padding: 14px 18px 18px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-foot textarea { flex: 1; resize: none; min-height: 46px; max-height: 160px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; font: 500 14px var(--font); color: var(--text); outline: none; }
.chat-foot textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn-mic, .btn-send { width: 46px; height: 46px; border-radius: 14px; border: 0; display: grid; place-items: center; cursor: pointer; flex: none; }
.btn-mic { background: var(--accent-soft); color: var(--accent); }
.btn-mic.on { background: var(--bad); color: #fff; animation: pulse 1.4s infinite; }
.btn-send { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; box-shadow: 0 8px 22px -8px var(--accent); }
.btn-send:disabled { opacity: .5; cursor: default; box-shadow: none; }
.chat-glow { position: relative; }
.chat-glow::after { content: ""; position: absolute; left: 10%; right: 10%; bottom: -18px; height: 30px; background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 35%, transparent), transparent); filter: blur(10px); z-index: -1; }

.fab-clo { position: fixed; right: 22px; bottom: 22px; display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; font-weight: 800; box-shadow: 0 12px 28px -10px var(--accent); z-index: 50; }

/* Historial de preguntas (últimos 3 días) */
.chat-hist { display: flex; flex-direction: column; gap: 6px; max-height: 420px; overflow: auto; }
.hist-item { text-align: left; background: var(--surface-2); border: 1px solid var(--border); border-radius: 12px; padding: 9px 11px; cursor: pointer; font: inherit; color: var(--text); transition: border-color .15s, transform .15s; }
.hist-item:hover { border-color: var(--accent); transform: translateX(2px); }
.hist-item span { display: block; font-size: 13px; font-weight: 700; line-height: 1.35; }
.hist-item small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; }
.msg.nota { font-size: 12px; color: var(--muted); background: transparent; border: 0; padding: 2px 4px; align-self: center; text-align: center; }

/* Adjuntos del chat */
.btn-clip { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); display: grid; place-items: center; cursor: pointer; flex: none; }
.btn-clip:hover { color: var(--accent); border-color: var(--accent); }
.adj-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px; }
.adj-chips:empty { display: none; }
.adj { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 99px; padding: 4px 6px 4px 10px; font-size: 12px; font-weight: 700; }
.adj.ok { border-color: var(--ok); } .adj.err { border-color: var(--bad); color: var(--bad); }
.adj button { border: 0; background: transparent; cursor: pointer; font-size: 14px; color: var(--muted); }
.adj-msg { margin-top: 6px; font-size: 12px; opacity: .85; }
.chat.sobre { outline: 2px dashed var(--accent); outline-offset: 4px; }
