:root { color: #1c2430; font: 15px/1.45 "Segoe UI", sans-serif; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: #f4f6f8; color: #1c2430; }
button, input, select, textarea { font: inherit; color: inherit; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 18px; background: #14352c; color: #fff; }
.header-actions { display: flex; gap: 8px; }
.brand { margin: 0; font-weight: 700; letter-spacing: .02em; }
.brand span { color: #9ddeb8; }
.brand small { display: block; font-weight: 500; color: #d5ebe1; letter-spacing: 0; }
header button, .primary { background: #1f8a5b; color: #fff; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button { background: #e7ece9; border: 0; border-radius: 8px; padding: 8px 12px; cursor: pointer; }
button:disabled { opacity: .55; cursor: default; }
body:has(.report-layout) { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
.report-layout { display: grid; flex: 1; min-height: 0; overflow: hidden; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); }
.report-layout .chat-side { border-left: 0; border-right: 1px solid #e1e6ea; }
.history-item { display: flex; gap: 4px; align-items: center; }
.history-item.active .history-open { background: #e7f6ee; }
.history-open { flex: 1; width: 100%; text-align: left; background: transparent; border-radius: 8px; padding: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-delete { padding: 4px 8px; }
.canvas-wrap, .chat-side { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.canvas-wrap { padding: 12px; gap: 8px; }
.canvas-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.canvas-note { flex: 1; min-width: 180px; margin: 0; font-size: 13px; color: #40515c; }
.anchos button { padding: 4px 10px; font-size: 12px; }
.anchos button[aria-pressed="true"] { background: #14352c; color: #fff; }
#conversaciones { width: min(420px, calc(100vw - 24px)); }
#new-chat { width: 100%; }
#history { max-height: min(60vh, 480px); overflow: auto; margin-top: 12px; }
#history:empty::before { content: 'Todavía no hay conversaciones.'; color: #5d6b76; font-size: 13px; }
.stage { flex: 1; min-height: 0; overflow: auto; background: #e6ebef; border-radius: 12px; display: flex; justify-content: center; padding: 16px; }
.stage.sin-correo { align-items: center; }
.vacio { display: none; max-width: 360px; margin: 0; text-align: center; color: #40515c; }
.sin-correo .vacio { display: block; }
.marco { --z: 1; width: 100%; max-width: 100%; height: 100%; flex: none; overflow: hidden; background: #f4f6f8; box-shadow: 0 10px 28px rgba(20, 32, 40, .12); }
#lienzo { display: block; width: calc(100% / var(--z)); height: calc(100% / var(--z)); border: 0; background: #f4f6f8; transform: scale(var(--z)); transform-origin: 0 0; }
.marco.movil { width: calc(375px * var(--z)); }
.marco.movil:not(.responsive) #lienzo { width: 600px; height: calc(160% / var(--z)); transform: scale(calc(.625 * var(--z))); }
.sin-correo .marco { display: none; }
.stage { justify-content: safe center; }
.marco.con-zoom { max-width: none; }
.zoom { display: inline-flex; align-items: center; gap: 2px; }
.zoom button { padding: 4px 8px; font-size: 12px; min-width: 28px; }
#zoom-valor { min-width: 52px; font-variant-numeric: tabular-nums; }
.chat-side { border-left: 1px solid #e1e6ea; background: #fff; padding: 12px; font-size: 12px; }
.messages { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.message { max-width: 95%; }
.message.user { align-self: flex-end; }
.bubble { background: #eceff1; border-radius: 12px; padding: 8px 10px; }
.message.user .bubble { background: #b7e4fa; }
.message.error .bubble { background: #fdecec; }
.bubble table { border-collapse: collapse; width: 100%; }
.bubble th, .bubble td { border: 1px solid #d5dee4; padding: 4px 6px; text-align: left; }
.bubble figure { margin: 0 0 6px; }
.bubble img, .adjunto img { display: block; max-width: 100%; border-radius: 8px; background: #fff; }
.bubble figcaption, .adjunto span, .hint, .chip { color: #5d6b76; font-size: 11px; }
.activity { display: flex; gap: 8px; align-items: center; color: #40515c; margin: 8px 0 0; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: #1f8a5b; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .35; } }
#message-form { display: flex; flex-direction: column; gap: 8px; padding-top: 8px; }
textarea { width: 100%; border: 1px solid #c9d2d8; border-radius: 10px; padding: 8px; resize: vertical; }
.hint { margin: 0; }
.composer-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
#imagen-btn, body.oficial #chat-nuevo { margin-right: auto; }
body.oficial #imagen-btn { margin-right: 0; }
#imagen-btn.icono { width: 32px; height: 32px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.adjuntos, .archivos { display: flex; flex-wrap: wrap; gap: 8px; }
.adjuntos:empty, .archivos:empty { display: none; }
.adjunto { position: relative; }
.adjunto img { width: 96px; height: 72px; object-fit: cover; }
.adjunto button { position: absolute; top: 2px; right: 2px; padding: 0 6px; line-height: 18px; }
.chip { background: #e7f6ee; border-radius: 999px; padding: 2px 8px; }
.notice { color: #8a3b3b; margin: 8px 0 0; }
.notice:empty { display: none; }
dialog { border: 0; border-radius: 16px; padding: 18px; width: min(720px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(16, 24, 32, .35); }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
dialog label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; }
dialog input, dialog select, #codigo-html { width: 100%; border: 1px solid #c9d2d8; border-radius: 8px; padding: 8px; background: #fff; }
#codigo-html { font: 12px/1.4 Consolas, monospace; }
@media (max-width: 800px) {
  .report-layout { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 42vh) minmax(0, 1fr); }
  .report-layout .chat-side { border-right: 0; border-bottom: 1px solid #e1e6ea; }
}
body.oficial { height: 100vh; overflow: hidden; background: #f4f6f8; }
.oficial-layout { height: 100vh; display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); }
.oficial-layout .chat-side { border-left: 0; border-right: 1px solid #e1e6ea; }
.oficial-layout .canvas-wrap { padding: 12px; }
@media (max-width: 800px) {
  .oficial-layout { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 42vh) minmax(0, 1fr); }
  .oficial-layout .chat-side { border-right: 0; border-bottom: 1px solid #e1e6ea; }
}
