:root{font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;color:#202722;background:#fff;font-synthesis:none;text-rendering:optimizeLegibility;--green:#07834f;--green-dark:#075b3b;--green-pale:#eaf5ee;--line:#e7ece8;--muted:#748078}*{box-sizing:border-box}body{margin:0;min-width:320px;height:100vh;height:100dvh;background:#fff}.app-shell{display:flex;height:100%}.sidebar{width:274px;flex:0 0 274px;background:#f7f9f7;color:#25342b;border-right:1px solid #e8ede9;display:flex;flex-direction:column;padding:17px 12px 12px}.brand{padding:4px 8px 19px;border-bottom:1px solid #e7ece8}.sidebar-logo{display:block;width:100%;max-width:235px;height:auto;object-fit:contain}.brand-caption{display:flex;align-items:center;gap:8px;margin:13px 2px 0}.brand-caption strong{font-size:12px;letter-spacing:.13em;color:var(--green-dark)}.brand-caption span{font-size:11px;color:#79847d}.new-chat{height:42px;width:100%;margin-top:15px;background:var(--green-dark);border:1px solid var(--green-dark);border-radius:8px;color:#fff;text-align:left;padding:0 12px;display:flex;align-items:center;gap:9px;font-size:13px;font-weight:550;cursor:pointer;transition:background .15s}.new-chat:hover{background:#064c32}.plus{font-size:19px;line-height:1}.history-label{font-size:11px;font-weight:650;color:#77827a;padding:23px 10px 9px}.conversation-list{overflow-y:auto;flex:1}.conversation-item{display:flex;align-items:center;gap:4px;padding:3px;border-radius:7px}.conversation-item:hover,.conversation-item.active{background:#e9f1eb}.conversation-open{min-width:0;flex:1;background:none;border:0;color:#3c4940;text-align:left;font-size:12px;padding:8px 7px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;cursor:pointer}.conversation-actions{display:flex;opacity:0;gap:1px}.conversation-item:hover .conversation-actions,.conversation-item.active .conversation-actions{opacity:1}.icon-button{border:0;color:#758078;background:none;border-radius:5px;padding:5px 6px;cursor:pointer;font-size:14px}.icon-button:hover{background:#d9e7dc;color:#254b34}.sidebar-footer{border-top:1px solid #e2e9e3;padding:12px 5px 3px;display:flex;align-items:center;gap:9px}.sidebar-avatar{height:36px;width:36px;border-radius:50%;object-fit:cover;background:#e4f2e8}.sidebar-footer strong,.sidebar-footer span{display:block}.sidebar-footer strong{font-size:12px;color:#293b2f}.sidebar-footer span{font-size:10px;color:#78837b;margin-top:3px}.main-panel{flex:1;min-width:0;display:flex;flex-direction:column;background:#fff}.topbar{height:68px;flex:0 0 68px;border-bottom:1px solid #edf0ed;display:flex;align-items:center;padding:0 27px;gap:15px}.header-logo{width:170px;height:auto;max-height:40px;object-fit:contain;object-position:left center}.top-heading{min-width:0;flex:1;border-left:1px solid #e6ebe7;padding-left:16px}.top-title{font-size:14px;font-weight:650;color:#26352b;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.top-subtitle{font-size:10px;color:#818c84;margin-top:3px}.connection{font-size:11px;color:#777;display:flex;align-items:center;gap:7px;white-space:nowrap}.status-dot{width:8px;height:8px;border-radius:50%;background:#dda94b;display:inline-block}.connection.online .status-dot{background:#218b54}.connection.offline .status-dot{background:#cf5952}.connection.online{color:#43825d}.connection.offline{color:#a35a57}.mobile-menu{display:none;background:none;border:0;font-size:18px;color:#435148}.chat-area{flex:1;min-height:0;overflow-y:auto}.welcome{max-width:800px;margin:clamp(50px,9vh,105px) auto 30px;padding:0 24px;text-align:center}.welcome-avatar{display:block;width:152px;height:152px;object-fit:cover;border-radius:50%;margin:0 auto 18px;box-shadow:0 8px 26px #0d69351c}.welcome h1{font-weight:650;font-size:28px;letter-spacing:-.6px;margin:0 0 9px;color:#23372a}.welcome p{font-size:14px;color:#718078;margin:0 auto 27px;line-height:1.65}.suggestions{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:11px;max-width:650px;margin:auto}.suggestions button{background:#fff;border:1px solid #e1e9e3;border-radius:11px;padding:14px;text-align:left;color:#36503e;cursor:pointer;transition:border-color .15s,background .15s}.suggestions button:hover{background:#f7fbf8;border-color:#94bea2}.suggestions button span,.suggestions button small{display:block}.suggestions button span{font-size:12px;font-weight:650}.suggestions button small{font-size:11px;color:#839087;margin-top:5px}.messages{max-width:850px;margin:0 auto;padding:34px 28px 30px}.message{display:flex;align-items:flex-start;gap:12px;margin:0 0 22px;line-height:1.7;font-size:14px;white-space:normal;overflow-wrap:anywhere}.message.user{justify-content:flex-end}.message-avatar{height:32px;width:32px;flex:0 0 32px;border-radius:50%;display:grid;place-items:center;font-weight:650;font-size:11px}.message.user .message-avatar{order:2;background:#e8f1eb;color:#42644b}.message.assistant .message-avatar{background:#e8f4ec;object-fit:cover}.message-body{padding-top:1px;min-width:0;max-width:calc(100% - 48px)}.message.user .message-body{order:1;max-width:min(76%,620px);background:#f1f5f2;border-radius:15px 4px 15px 15px;padding:11px 15px}.message.assistant .message-body{flex:1}.message-role{font-size:11px;font-weight:650;color:#66746a;margin-bottom:4px}.message-content{color:#27332a}.message.user .message-role{display:none}.message.pending .message-content{color:#888}.message-content p{margin:0 0 10px}.message-content p:last-child{margin-bottom:0}.message-content h1,.message-content h2,.message-content h3{line-height:1.35;color:#263b2d;margin:15px 0 7px}.message-content h1{font-size:19px}.message-content h2{font-size:17px}.message-content h3{font-size:15px}.message-content ul,.message-content ol{padding-left:23px;margin:5px 0 11px}.message-content li{padding:2px 0}.message-content blockquote{margin:8px 0;padding:5px 12px;border-left:3px solid #8cba98;color:#637269;background:#f7faf7}.message-content pre{white-space:pre;overflow:auto;background:#202a23;color:#edf4ed;padding:13px 15px;border-radius:9px;font-size:12px;line-height:1.55}.message-content code{font-family:Consolas,"SFMono-Regular",monospace;font-size:.92em;background:#eef2ee;border-radius:4px;padding:2px 4px}.message-content pre code{background:none;padding:0;color:inherit}.message-content a{color:#087647;text-decoration:underline}.typing{display:flex;gap:4px;padding:9px 0}.typing i{height:6px;width:6px;background:#8aa391;border-radius:50%;animation:pulse 1s infinite alternate}.typing i:nth-child(2){animation-delay:.2s}.typing i:nth-child(3){animation-delay:.4s}@keyframes pulse{to{opacity:.28;transform:translateY(-3px)}}.composer-wrap{padding:12px 24px 14px}.composer{max-width:780px;margin:0 auto;border:1px solid #dce5de;border-radius:15px;box-shadow:0 3px 16px #15391e0a;display:flex;align-items:flex-end;padding:9px 10px 9px 16px;gap:10px}.composer:focus-within{border-color:#75aa83;box-shadow:0 0 0 3px #31834c0d}.composer textarea{font:inherit;font-size:14px;line-height:1.5;resize:none;outline:0;border:0;background:none;flex:1;min-height:25px;max-height:180px;padding:4px 0;color:#222}.composer textarea::placeholder{color:#969e98}.send-button{border:0;width:35px;height:35px;border-radius:10px;background:var(--green);color:white;display:grid;place-items:center;cursor:pointer;flex:0 0 35px}.send-button:hover{background:#066c41}.send-button:disabled{background:#a7c6af;cursor:wait}.send-button svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}.disclaimer{text-align:center;font-size:10px;color:#929b94;margin-top:8px}.mobile-scrim{display:none}@media(max-width:860px){.sidebar{width:250px;flex-basis:250px}.header-logo{width:140px}}@media(max-width:700px){.sidebar{position:fixed;z-index:5;inset:0 auto 0 0;transform:translateX(-100%);transition:transform .2s ease;width:278px}.sidebar.open{transform:translateX(0)}.mobile-scrim.visible{display:block;position:fixed;inset:0;background:#0005;z-index:4}.mobile-menu{display:block}.topbar{height:58px;flex-basis:58px;padding:0 13px;gap:10px}.header-logo{display:none}.top-heading{border:0;padding-left:0}.top-subtitle{display:none}.connection{font-size:10px}.welcome{margin-top:35px;padding:0 19px}.welcome-avatar{width:122px;height:122px}.welcome h1{font-size:24px}.welcome p{font-size:13px}.suggestions{grid-template-columns:1fr;gap:8px}.suggestions button{padding:11px 13px}.messages{padding:24px 15px}.message{font-size:13px}.message.user .message-body{max-width:82%}.composer-wrap{padding:10px 12px 12px}}

/* Fase 1 · acceso (login, MFA, sin acceso) */
[hidden]{display:none!important}
.auth-screen{min-height:100vh;min-height:100dvh;display:flex;align-items:center;justify-content:center;padding:24px 16px;background:#f7f9f7}
.auth-card{width:100%;max-width:400px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:28px 24px;box-shadow:0 8px 30px rgba(7,91,59,.08)}
.auth-logo{display:block;width:100%;max-width:240px;height:auto;margin:0 auto 22px}
.auth-panel{display:flex;flex-direction:column;gap:8px}
.auth-panel h1{font-size:20px;margin:0 0 8px;color:var(--green-dark)}
.auth-panel p{font-size:14px;line-height:1.5;margin:0 0 6px;color:#3d4a42}
.auth-panel label{font-size:13px;font-weight:600;color:#3d4a42;margin-top:6px}
.auth-panel input{height:42px;border:1px solid #cfd8d2;border-radius:8px;padding:0 12px;font:inherit;font-size:15px}
.auth-panel input:focus{outline:2px solid var(--green);outline-offset:1px;border-color:var(--green)}
.auth-primary{margin-top:14px;height:44px;border:0;border-radius:8px;background:var(--green-dark);color:#fff;font:inherit;font-weight:600;cursor:pointer}
.auth-primary:hover{background:#064c32}.auth-primary:disabled{opacity:.6;cursor:wait}
.auth-secondary{margin-top:8px;height:40px;border:1px solid var(--line);border-radius:8px;background:#fff;color:#3d4a42;font:inherit;cursor:pointer}
.auth-hint{font-size:12px!important;color:var(--muted)!important;margin-top:10px!important}
.auth-error{margin:14px 0 0;padding:10px 12px;border-radius:8px;background:#fdecea;color:#9b2c24;font-size:14px}
.mfa-enroll img{display:block;width:180px;height:180px;margin:6px auto 10px;background:#fff}
.mfa-enroll code{word-break:break-all}
.sidebar-user{flex:1;min-width:0}.sidebar-user strong,.sidebar-user span{display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.icon-button.logout{flex:0 0 auto}
.message.error .message-content{color:#9b2c24}

/* ---------------------------------------------------------------- respuestas en Markdown (marked + DOMPurify) */
.message-content{line-height:1.7;overflow-wrap:break-word;font-synthesis:weight style}
.message-content>:first-child{margin-top:0}
.message-content>:last-child{margin-bottom:0}
.message-content p{margin:0 0 12px}
.message-content h1,.message-content h2,.message-content h3,.message-content h4{color:var(--green-dark);line-height:1.35;font-weight:650;margin:22px 0 8px}
.message-content h1{font-size:19px}
.message-content h2{font-size:17px;padding-bottom:5px;border-bottom:1px solid var(--line)}
.message-content h3{font-size:15.5px}
.message-content h4{font-size:14px}
.message-content strong,.message-content b{font-weight:700;color:#1d2b22}
.message-content ul,.message-content ol{margin:6px 0 14px;padding-left:24px}
.message-content li{margin:4px 0;padding-left:2px}
.message-content li>ul,.message-content li>ol{margin:4px 0 6px}
.message-content li>p{margin:0 0 6px}
.message-content ul li::marker{color:var(--green)}
.message-content ol li::marker{color:var(--green-dark);font-weight:650}
.message-content blockquote{margin:12px 0;padding:10px 14px;border-left:4px solid var(--green);border-radius:0 8px 8px 0;background:var(--green-pale);color:#35483b}
.message-content blockquote p{margin:0 0 6px}
.message-content hr{border:0;border-top:1px solid var(--line);margin:18px 0}
.message-content a{color:var(--green);text-decoration:underline;text-underline-offset:2px;overflow-wrap:anywhere}
.message-content a:hover{color:var(--green-dark)}
.message-content code{font-family:Consolas,"SFMono-Regular",Menlo,monospace;font-size:.88em;background:#eef4f0;color:#0b4f33;border:1px solid #dde8e0;border-radius:5px;padding:1px 5px}
.message-content pre{margin:12px 0 14px;padding:14px 16px;background:#1f2a23;color:#edf4ed;border-radius:10px;overflow-x:auto;white-space:pre;font-size:12.5px;line-height:1.6;-webkit-overflow-scrolling:touch}
.message-content pre code{background:none;border:0;padding:0;color:inherit;font-size:inherit}
/* Tablas: el envoltorio desplaza en horizontal sin ensanchar la página. */
.message-content .table-wrap{margin:12px 0 16px;max-width:100%;overflow-x:auto;-webkit-overflow-scrolling:touch;border:1px solid #d6e6db;border-radius:10px}
.message-content table{width:100%;border-collapse:collapse;font-size:13px;line-height:1.5}
.message-content th,.message-content td{padding:9px 12px;text-align:left;vertical-align:top;border-bottom:1px solid #e3ece5;overflow-wrap:normal;min-width:90px}
.message-content th+th,.message-content td+td{border-left:1px solid #e3ece5}
.message-content thead th{background:var(--green-dark);color:#fff;font-weight:600;border-bottom:0;white-space:nowrap}
.message-content thead th+th{border-left-color:#ffffff2e}
.message-content tbody tr:nth-child(even){background:#f4f9f5}
.message-content tbody tr:hover{background:var(--green-pale)}
.message-content tbody tr:last-child td{border-bottom:0}
.message-content td code{white-space:nowrap}
.message.user .message-content .table-wrap{background:#fff}
@media(max-width:700px){.message-content table{font-size:12px}.message-content th,.message-content td{padding:7px 9px}.message-content pre{font-size:11.5px;padding:12px}}
.message-content .align-left{text-align:left}.message-content .align-center{text-align:center}.message-content .align-right{text-align:right}
