:root{--pico-font-size:15px;--pico-primary:#7c3aed;--pico-primary-hover:#6d28d9;--pico-primary-background:#7c3aed;--pico-primary-border:#7c3aed}
body{background:#faf8ff}
nav.top{display:flex;justify-content:space-between;align-items:center;gap:1rem;padding:.6rem 1rem;background:#2e1065;flex-wrap:wrap}
nav.top a{color:#ede9fe;text-decoration:none;margin-left:.9rem;font-size:.95rem}nav.top .brand{font-weight:700;margin:0;color:#fff}
nav.top .links{display:flex;flex-wrap:wrap;align-items:center}
main{padding-top:1rem}
.badge{background:#ef4444;color:#fff;border-radius:999px;padding:0 .45rem;font-size:.75rem;font-weight:700}
.flash{background:#ede9fe;border-left:4px solid #7c3aed;padding:.6rem .9rem;border-radius:6px}.flash.err,.err{color:#b91c1c}.flash.err{background:#fee2e2;border-color:#ef4444}
.kpis{display:grid;grid-template-columns:repeat(auto-fit,minmax(140px,1fr));gap:.7rem;margin-bottom:1rem}
.kpis>div{background:#fff;border-radius:10px;padding:.7rem .9rem;box-shadow:0 1px 3px #0001;display:flex;flex-direction:column}
.kpis b{font-size:1.6rem;color:#2e1065}.kpis b.sm{font-size:1rem}.kpis small{color:#6b7280}
.grid2{display:grid;grid-template-columns:repeat(auto-fit,minmax(380px,1fr));gap:1rem}.grid3{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:1rem}
article{margin-bottom:1rem}.row{display:flex;justify-content:space-between;gap:.5rem;margin:.3rem 0;border-bottom:1px solid #f1f0f5;padding-bottom:.3rem}
.muted{color:#6b7280}.small,.small *{font-size:.85rem}.center{text-align:center;margin-top:20vh}
.head{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:.5rem}
.filters{display:flex;flex-wrap:wrap;gap:.4rem}.filters>*{width:auto;margin:0}.filters input[type=search]{min-width:240px}
.inline{display:flex;gap:.4rem;flex-wrap:wrap}.inline>*{width:auto;margin:0}.inl{display:inline}
.tag{background:#f3e8ff;color:#6b21a8;border-radius:6px;padding:0 .35rem;font-size:.75rem}
.st{border-radius:6px;padding:.05rem .45rem;font-size:.8rem;background:#e5e7eb}
.st-cliente,.st-ractivo,.st-cen_curso{background:#dcfce7;color:#166534}.st-vip{background:#fef3c7;color:#92400e}
.st-no_deseado,.st-ranulado,.st-ccancelada{background:#fee2e2;color:#991b1b}.st-dificil{background:#ffedd5;color:#9a3412}
.st-prospecto,.st-potencial,.st-cpausada{background:#e0e7ff;color:#3730a3}
button.link{background:none;border:none;color:var(--pico-primary);padding:0 .3rem;margin:0;width:auto;font-size:.85rem}
button.small,.small button{padding:.25rem .6rem}input.tiny{width:110px;display:inline;padding:.2rem;height:auto;margin:0}
.login{max-width:360px;margin:12vh auto}
.table-wrap{overflow-x:auto}.pager{text-align:center}
.tplbody{white-space:pre-wrap;background:#fff;padding:.7rem;border-radius:8px;font-family:inherit}
.msgline{margin:.2rem 0;font-size:.88rem}.msgline.out{color:#4c1d95}
/* chats */
.chat-wrap{display:grid;grid-template-columns:320px 1fr;gap:0;height:calc(100vh - 110px);background:#fff;border-radius:10px;overflow:hidden;box-shadow:0 1px 3px #0001}
.chat-list{border-right:1px solid #eee;overflow-y:auto;padding:.5rem}
.ci{display:block;padding:.5rem;border-radius:8px;text-decoration:none;color:inherit;border-bottom:1px solid #f5f5f5}
.ci:hover,.ci.sel{background:#f5f3ff}.ci.unread .cn{font-weight:700}
.cn{display:block}.cm{display:block;color:#6b7280;font-size:.82rem;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ct{font-size:.72rem;color:#9ca3af}
.chat-main{display:flex;flex-direction:column;min-width:0}
.chat-head{padding:.6rem 1rem;border-bottom:1px solid #eee;display:flex;justify-content:space-between;flex-wrap:wrap;gap:.4rem}
.ok{color:#15803d}.warn{color:#b45309}
.msgs{flex:1;overflow-y:auto;padding:1rem;background:#efeae2}
.m{max-width:70%;padding:.45rem .7rem;border-radius:10px;margin:.3rem 0;white-space:pre-wrap;background:#fff;box-shadow:0 1px 1px #0001}
.m.out{margin-left:auto;background:#e9d5ff}.m small{display:block;font-size:.7rem;color:#6b7280;text-align:right}
.send{display:flex;gap:.5rem;padding:.6rem;border-top:1px solid #eee;margin:0}.send>*{margin:0}.send textarea{flex:1}.send button{width:auto}
#toasts{position:fixed;right:1rem;bottom:1rem;z-index:99;display:flex;flex-direction:column;gap:.5rem}
.toast{background:#2e1065;color:#fff;padding:.7rem 1rem;border-radius:10px;max-width:340px;box-shadow:0 4px 12px #0003;cursor:pointer}
#notif-panel{position:fixed;right:1rem;top:3.2rem;width:360px;max-height:70vh;overflow-y:auto;background:#fff;border-radius:10px;box-shadow:0 6px 20px #0003;z-index:98;padding:.7rem}
.np-head{display:flex;justify-content:space-between;align-items:center}#notif-panel a{display:block;padding:.4rem 0;border-bottom:1px solid #f1f1f1;font-size:.88rem}
@media(max-width:800px){.chat-wrap{grid-template-columns:1fr}.chat-list{max-height:35vh}.grid2{grid-template-columns:1fr}}

.ver{font-size:.7rem;opacity:.6;font-weight:400}
/* v1.2 chat completo */
.chat-wrap.has-panel{grid-template-columns:300px 1fr 280px}
.tabs{display:flex;flex-wrap:wrap;gap:.2rem;margin:.3rem 0}.tabs a{font-size:.78rem;padding:.2rem .5rem;border-radius:999px;background:#f3f4f6;text-decoration:none;color:#374151}
.tabs a.on{background:#7c3aed;color:#fff}
.head-actions{display:flex;gap:.4rem;align-items:center}.head-actions select{width:auto;margin:0;padding:.25rem 2rem .25rem .5rem;font-size:.85rem;height:auto}
.composer{border-top:1px solid #eee;padding:.5rem .6rem;margin:0;display:flex;flex-direction:column;gap:.3rem;position:relative}
.composer textarea{margin:0;resize:vertical}.composer.closed{flex-direction:row;flex-wrap:wrap;gap:.4rem}.composer.closed>*{margin:0;width:auto;flex:1}.composer.closed button{flex:0 0 auto}
.tools{display:flex;align-items:center;gap:.4rem}.tools #send-btn{margin-left:auto;width:auto}
.tool{background:#f5f3ff;border:none;border-radius:8px;padding:.3rem .55rem;cursor:pointer;font-size:1.1rem;width:auto;margin:0;color:inherit}
.note-toggle{margin:0}.rec-bar{background:#fee2e2;color:#991b1b;padding:.3rem .6rem;border-radius:8px;display:flex;gap:.5rem;align-items:center}
.rec-bar button{width:auto;margin:0}
.qr-pop{position:absolute;bottom:120px;left:1rem;right:1rem;max-height:260px;overflow-y:auto;background:#fff;border-radius:10px;box-shadow:0 6px 20px #0003;z-index:20;padding:.4rem}
.chat-main{position:relative}.qr{padding:.4rem .5rem;border-radius:6px;cursor:pointer;font-size:.86rem}.qr:hover{background:#f5f3ff}
.m.note{margin-left:auto;background:#fef9c3;border:1px dashed #eab308}
.att-img{max-width:260px;max-height:260px;border-radius:8px;display:block;margin-bottom:.3rem}.m audio{max-width:260px;display:block}
.att-file{display:inline-block;margin-bottom:.3rem}
.sale-panel{border-left:1px solid #eee;overflow-y:auto;padding:.7rem;font-size:.9rem}
.sale-panel h4{margin:.2rem 0}.sale-panel input,.sale-panel select{margin-bottom:.35rem;padding:.35rem .5rem;height:auto;font-size:.88rem}
.sale-panel details{margin:.5rem 0}.sale-panel summary{font-weight:600}.rw{border-bottom:1px solid #f1f1f1;padding:.3rem 0}
@media(max-width:1100px){.chat-wrap.has-panel{grid-template-columns:260px 1fr}.sale-panel{display:none}}
@media(max-width:800px){.chat-wrap.has-panel{grid-template-columns:1fr}}
