*{box-sizing:border-box}:root{--g:#173f35;--g2:#246252;--soft:#e8f2ee;--page:#eef2f0;--text:#17201d;--muted:#66736e;--line:#e3e9e6;--assistant:#f3f5f4}html,body{height:100%}body{margin:0;font-family:Inter,-apple-system,BlinkMacSystemFont,"Segoe UI",Arial,sans-serif;color:var(--text);background:var(--page)}button,textarea{font:inherit}.app{width:min(100%,920px);height:100dvh;margin:auto;display:flex;flex-direction:column;background:#fff;box-shadow:0 18px 50px rgba(20,48,40,.1)}.app-header{min-height:82px;padding:14px 22px;padding-top:max(14px,env(safe-area-inset-top));display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.brand{display:flex;align-items:center;gap:12px}.brand-mark,.welcome-icon{display:grid;place-items:center;background:var(--g);color:#fff;font-weight:800}.brand-mark{width:46px;height:46px;border-radius:14px;font-size:22px}.brand h1{margin:0 0 4px;font-size:clamp(18px,3vw,22px)}.status{font-size:13px;color:var(--muted);display:flex;align-items:center;gap:6px}.status span{width:8px;height:8px;border-radius:50%;background:#39a96b}.icon-button{width:42px;height:42px;border:0;border-radius:12px;background:var(--soft);color:var(--g);cursor:pointer;font-size:22px}#chat{flex:1;overflow-y:auto;padding:26px 22px;scroll-behavior:smooth}.welcome{width:min(100%,620px);margin:clamp(20px,8vh,72px) auto 20px;text-align:center}.welcome-icon{width:62px;height:62px;margin:0 auto 16px;border-radius:20px;font-size:28px}.welcome h2{margin:0 0 9px;font-size:clamp(24px,4vw,31px)}.welcome>p{max-width:560px;margin:0 auto 24px;color:var(--muted);line-height:1.55}.suggestions{display:grid;grid-template-columns:1fr 1fr;gap:10px}.suggestion{min-height:58px;padding:12px 14px;border:1px solid var(--line);border-radius:15px;background:#fff;cursor:pointer;display:flex;align-items:center;gap:10px;text-align:left}.suggestion:hover{background:#f8fbfa;border-color:#b7d2c8}.message-row{display:flex;margin-bottom:16px}.message-row.user{justify-content:flex-end}.message{max-width:min(78%,650px);padding:12px 15px;border-radius:18px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}.assistant .message{background:var(--assistant);border-bottom-left-radius:5px}.user .message{background:var(--g);color:#fff;border-bottom-right-radius:5px}.error .message{background:#fff0f0}.typing{display:flex;gap:5px;min-width:62px}.typing span{width:7px;height:7px;background:#7a8782;border-radius:50%;animation:b 1.2s infinite}.typing span:nth-child(2){animation-delay:.15s}.typing span:nth-child(3){animation-delay:.3s}@keyframes b{0%,60%,100%{transform:translateY(0);opacity:.45}30%{transform:translateY(-5px);opacity:1}}.composer{padding:12px 18px max(12px,env(safe-area-inset-bottom));border-top:1px solid var(--line)}.input-wrap{display:flex;align-items:flex-end;gap:8px;padding:7px 7px 7px 14px;border:1px solid #cdd7d3;border-radius:18px}.input-wrap:focus-within{border-color:var(--g2);box-shadow:0 0 0 3px rgba(36,98,82,.1)}#message{flex:1;min-height:42px;max-height:130px;resize:none;border:0;outline:0;padding:10px 2px;background:transparent}#send-button{width:42px;height:42px;flex:0 0 42px;border:0;border-radius:13px;background:var(--g);color:#fff;cursor:pointer;font-size:20px}#send-button:disabled{opacity:.45}.disclaimer{margin-top:7px;text-align:center;color:var(--muted);font-size:11px}@media(max-width:640px){body{background:#fff}.app{box-shadow:none}.app-header{min-height:72px;padding-left:15px;padding-right:15px}.brand-mark{width:40px;height:40px}#chat{padding:20px 14px}.welcome{margin-top:18px}.suggestions{grid-template-columns:1fr}.message{max-width:88%}.composer{padding-left:10px;padding-right:10px}}
.brand-logo{width:46px;height:46px;border-radius:14px;object-fit:cover}
.welcome-logo{width:62px;height:62px;border-radius:20px;margin:0 auto 16px;display:block}
.header-actions{display:flex;align-items:center;gap:8px}
.install-button{border:0;border-radius:12px;padding:10px 14px;background:var(--g);color:#fff;cursor:pointer}
.install-banner{margin:10px 18px 0;padding:14px 16px;border:1px solid #cfe0da;border-radius:16px;background:#f5faf8;display:flex;align-items:center;justify-content:space-between;gap:18px}
.install-banner[hidden],.ios-sheet[hidden],.install-button[hidden]{display:none!important}
.install-banner strong{color:var(--g)}.install-banner p{margin:4px 0 0;color:var(--muted);font-size:13px}
.install-actions{display:flex;gap:8px;flex-shrink:0}.install-actions button,.ios-card>button:last-child{border:0;border-radius:11px;padding:10px 12px;background:var(--g);color:#fff;cursor:pointer}.install-actions .secondary{background:#e7efec;color:var(--g)}
.ios-sheet{position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,.38);display:grid;place-items:end center;padding:18px}
.ios-card{position:relative;width:min(100%,430px);padding:26px 22px 22px;border-radius:24px;background:#fff;text-align:center;box-shadow:0 20px 60px rgba(0,0,0,.2)}
.ios-card img{width:72px;height:72px;border-radius:18px}.ios-card h3{margin:12px 0 8px}.ios-card p{color:var(--muted);line-height:1.5}.ios-close{position:absolute;right:14px;top:10px;border:0;background:transparent;font-size:28px;color:#65726d;cursor:pointer}
@media(max-width:640px){.brand-logo{width:40px;height:40px;border-radius:12px}.install-banner{margin:8px 10px 0;display:block}.install-actions{margin-top:10px}.install-button{display:none!important}}


/* Fontes clicáveis nas respostas */
.message-text{white-space:pre-wrap}
.message-sources{margin-top:12px;padding-top:11px;border-top:1px solid #dbe3e0}
.message-sources-title{margin-bottom:7px;font-size:12px;font-weight:700;color:#66736e;text-transform:uppercase;letter-spacing:.035em}
.message-sources-list{display:flex;flex-wrap:wrap;gap:7px}
.source-link{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:7px 10px;border:1px solid #c9d9d3;border-radius:10px;background:#fff;color:#173f35;font-size:12px;font-weight:600;cursor:pointer;text-align:left}
.source-link:hover{background:#edf6f2;border-color:#9fc2b5}
.source-link-icon{font-size:14px}

/* Modal de fontes */
body.modal-open{overflow:hidden}
.source-modal{position:fixed;inset:0;z-index:2000;display:grid;place-items:center;padding:20px}
.source-modal[hidden]{display:none!important}
.source-modal-backdrop{position:absolute;inset:0;background:rgba(12,28,23,.58);backdrop-filter:blur(2px)}
.source-modal-dialog{position:relative;z-index:1;width:min(760px,100%);max-height:min(82dvh,820px);display:flex;flex-direction:column;background:#fff;border-radius:22px;box-shadow:0 26px 80px rgba(0,0,0,.28);overflow:hidden}
.source-modal-header{display:flex;align-items:flex-start;justify-content:space-between;gap:18px;padding:22px 24px 17px;border-bottom:1px solid #e3e9e6}
.source-modal-label{display:block;margin-bottom:5px;color:#246252;font-size:11px;font-weight:800;text-transform:uppercase;letter-spacing:.08em}
.source-modal-header h2{margin:0;color:#17201d;font-size:22px}
.source-modal-meta{margin-top:6px;color:#66736e;font-size:13px}
.source-modal-close{flex:0 0 38px;width:38px;height:38px;border:0;border-radius:11px;background:#edf3f0;color:#173f35;font-size:26px;line-height:1;cursor:pointer}
.source-modal-content{overflow-y:auto;padding:20px 24px;background:#f8faf9}
.source-excerpt{margin:0 0 14px;padding:16px 17px;border:1px solid #dfe7e4;border-radius:15px;background:#fff}
.source-excerpt:last-child{margin-bottom:0}
.source-excerpt-header{display:flex;justify-content:space-between;gap:12px;margin-bottom:10px;color:#173f35;font-size:12px}
.source-excerpt-header span{color:#75817d;font-weight:500}
.source-excerpt-text{white-space:pre-wrap;color:#28332f;line-height:1.65;font-size:14px}
.source-empty{margin:0;color:#66736e}
.source-modal-footer{display:flex;align-items:center;justify-content:space-between;gap:18px;padding:14px 24px;border-top:1px solid #e3e9e6;background:#fff;color:#75817d;font-size:12px}
.source-modal-ok{border:0;border-radius:11px;padding:10px 16px;background:#173f35;color:#fff;font-weight:700;cursor:pointer}

@media(max-width:640px){
  .source-modal{place-items:end center;padding:0}
  .source-modal-dialog{width:100%;max-height:88dvh;border-radius:22px 22px 0 0;padding-bottom:env(safe-area-inset-bottom)}
  .source-modal-header{padding:18px 17px 14px}
  .source-modal-content{padding:14px}
  .source-modal-footer{padding:12px 14px;align-items:flex-end}
  .source-modal-footer span{max-width:65%}
  .message-sources-list{display:grid;grid-template-columns:1fr}
  .source-link{width:100%}
}
