:root{
  --bg:#0f1115;--bg2:#161a22;--bg3:#1d222c;--line:#262a33;--tx:#e9ecf1;--mut:#8b93a3;
  --p:#7c3aed;--p2:#9d5cff;--g:#22c55e;--r:#ef4444;--y:#f59e0b;--b:#3b82f6;
  --st0:#6b7280;--st1:#3b82f6;--st2:#06b6d4;--st3:#22c55e;--st4:#f59e0b;--st5:#a855f7;--st6:#ef4444;--st7:#64748b;
}
*{box-sizing:border-box}
html,body{margin:0;background:var(--bg);color:var(--tx);font:15px/1.45 -apple-system,Segoe UI,Roboto,Inter,sans-serif;-webkit-tap-highlight-color:transparent}
a{color:var(--p2);text-decoration:none}
button,input,select,textarea{font:inherit;color:inherit}
main{max-width:1100px;margin:0 auto;padding:14px 14px 90px}
.top{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:10px;padding:10px 14px;background:rgba(15,17,21,.92);backdrop-filter:blur(8px);border-bottom:1px solid var(--line)}
.brand{color:var(--tx);font-weight:600;display:flex;align-items:center;gap:8px;white-space:nowrap}
.brand .dot{width:12px;height:12px;border-radius:50%;background:linear-gradient(135deg,var(--p),var(--g))}
.top nav{display:flex;align-items:center;gap:6px;overflow-x:auto}
.top nav a{color:var(--mut);padding:6px 10px;border-radius:8px;white-space:nowrap;position:relative}
.top nav a:hover{background:var(--bg3);color:var(--tx)}
.top .who{color:var(--mut);font-size:13px;padding:0 6px;white-space:nowrap}
.top .sair{color:var(--r)}
.badge[hidden]{display:none}
.badge{position:absolute;top:-2px;right:-4px;min-width:18px;height:18px;border-radius:9px;background:var(--r);color:#fff;font-size:11px;font-weight:700;display:flex;align-items:center;justify-content:center;padding:0 5px}
.flash{padding:10px 14px;border-radius:10px;margin-bottom:12px;background:var(--bg3);border:1px solid var(--line)}
.flash.ok{border-color:var(--g)} .flash.err{border-color:var(--r)}
h1{font-size:22px;margin:6px 0 14px} h2{font-size:17px;margin:18px 0 10px}
.card{background:var(--bg2);border:1px solid var(--line);border-radius:14px;padding:14px;margin-bottom:12px}
.row{display:flex;gap:10px;flex-wrap:wrap;align-items:center}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:12px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:11px 16px;border-radius:11px;border:1px solid var(--line);background:var(--bg3);color:var(--tx);cursor:pointer;font-weight:600;min-height:44px}
.btn:hover{filter:brightness(1.12)} .btn:disabled{opacity:.45;cursor:not-allowed}
.btn.p{background:var(--p);border-color:var(--p);color:#fff}
.btn.g{background:#15803d;border-color:#15803d;color:#fff}
.btn.r{background:transparent;border-color:var(--r);color:var(--r)}
.btn.sm{padding:7px 11px;min-height:34px;font-size:13px;border-radius:9px}
.btn.block{width:100%}
input[type=text],input[type=password],input[type=number],input[type=url],select,textarea{width:100%;background:var(--bg);border:1px solid var(--line);border-radius:10px;padding:11px 12px;color:var(--tx);min-height:44px}
textarea{min-height:90px;resize:vertical}
label{display:block;font-size:13px;color:var(--mut);margin:10px 0 5px}
.mut{color:var(--mut)} .small{font-size:13px}
.pill{display:inline-block;padding:3px 10px;border-radius:999px;font-size:12px;font-weight:600;color:#fff;background:var(--st0)}
.st-0{background:var(--st0)}.st-1{background:var(--st1)}.st-2{background:var(--st2)}.st-3{background:var(--st3)}.st-4{background:var(--st4);color:#000}.st-5{background:var(--st5)}.st-6{background:var(--st6)}.st-7{background:var(--st7)}
select.status{padding:6px 10px;min-height:36px;border-radius:9px;background:var(--bg);font-weight:600}
.quota{display:flex;align-items:center;gap:12px}
.quota .bar{flex:1;height:10px;background:var(--bg3);border-radius:5px;overflow:hidden}
.quota .bar i{display:block;height:100%;background:linear-gradient(90deg,var(--p),var(--p2))}
.ficha{display:block;color:var(--tx);background:var(--bg2);border:1px solid var(--line);border-radius:14px;padding:12px 14px;margin-bottom:10px;position:relative}
.ficha:hover{border-color:var(--p)}
.ficha>b{display:block;font-size:15px}
.ficha .meta b{font-weight:700}
.ficha .meta{color:var(--mut);font-size:13px;margin-top:3px}
.ficha .pill{position:absolute;top:12px;right:12px}
.ficha .unread{position:absolute;bottom:12px;right:12px;background:var(--r);color:#fff;border-radius:999px;font-size:11px;font-weight:700;padding:2px 8px}
.ficha.alerta{border-color:var(--y)}
.tabs{display:flex;gap:4px;border-bottom:1px solid var(--line);margin-bottom:14px;overflow-x:auto}
.tabs a{padding:10px 14px;color:var(--mut);border-bottom:2px solid transparent;white-space:nowrap}
.tabs a.on{color:var(--tx);border-color:var(--p)}
.kv{display:grid;grid-template-columns:110px 1fr;gap:6px 10px;font-size:14px}
.kv dt{color:var(--mut)} .kv dd{margin:0;word-break:break-word}
.msgbox{background:var(--bg);border:1px dashed var(--line);border-radius:10px;padding:12px;white-space:pre-wrap;font-size:14px}
.chat{display:flex;flex-direction:column;gap:8px;padding:6px 0 10px;min-height:200px}
.m{max-width:86%;padding:9px 12px;border-radius:14px;background:var(--bg3);font-size:14px;white-space:pre-wrap;word-break:break-word}
.m.rev,.m.revendedor{align-self:flex-end;background:#2b1f52;border-bottom-right-radius:4px}
.m.admin{align-self:flex-start;background:#123b2a;border-bottom-left-radius:4px}
.m.ai{align-self:flex-start;background:#253455;border:1px solid #3d5c91;border-bottom-left-radius:4px}
.m.lead-ready{width:min(680px,86%);max-width:86%;background:#172b24;border-color:#2d765a}
.lead-copy-text{white-space:pre-wrap}
.copy-lead{display:block;margin-top:12px;margin-left:auto}
.m.sistema{align-self:center;background:transparent;color:var(--mut);font-size:12px;text-align:center}
.m .who{font-size:11px;color:var(--mut);margin-bottom:3px}
.m img{max-width:100%;max-height:360px;border-radius:10px;display:block;margin-top:6px;cursor:zoom-in}
.m .time{font-size:11px;color:var(--mut);margin-top:4px;text-align:right}
.sug{margin-top:8px;padding:8px 10px;border-radius:10px;background:var(--bg);border:1px solid var(--line)}
.sug .row{margin-top:8px}
.composer{position:fixed;left:0;right:0;bottom:0;background:var(--bg2);border-top:1px solid var(--line);padding:10px 12px calc(10px + env(safe-area-inset-bottom))}
.composer .in{max-width:1100px;margin:0 auto;display:flex;gap:8px;align-items:flex-end}
.composer textarea{min-height:44px;max-height:140px;flex:1}
.composer .file{position:relative;overflow:hidden}
.composer .file input{position:absolute;inset:0;opacity:0;cursor:pointer}
.preview{display:flex;gap:8px;align-items:center;max-width:1100px;margin:0 auto 8px;font-size:13px;color:var(--mut)}
.preview img{height:48px;border-radius:6px}
table{width:100%;border-collapse:collapse;font-size:14px}
th,td{text-align:left;padding:8px 8px;border-bottom:1px solid var(--line);vertical-align:top}
th{color:var(--mut);font-weight:600;font-size:12px;text-transform:uppercase}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(110px,1fr));gap:8px;margin:8px 0 14px}
.stats div{background:var(--bg3);border-radius:10px;padding:10px;text-align:center}
.stats b{display:block;font-size:20px}
.stats span{font-size:12px;color:var(--mut)}
.login{max-width:380px;margin:60px auto}
.lightbox{position:fixed;inset:0;background:rgba(0,0,0,.92);display:flex;align-items:center;justify-content:center;z-index:99;cursor:zoom-out}
.lightbox img{max-width:96vw;max-height:94vh}
.lead-form{display:grid;grid-template-columns:1fr 1fr;gap:0 12px}
@media(max-width:640px){.lead-form{grid-template-columns:1fr}.kv{grid-template-columns:90px 1fr}}
.toast{position:fixed;left:50%;bottom:90px;transform:translateX(-50%);background:var(--g);color:#000;padding:8px 14px;border-radius:999px;font-weight:600;z-index:50}
.help-fab{position:fixed;right:18px;bottom:18px;z-index:30;display:flex;align-items:center;gap:7px;background:var(--p);color:#fff;padding:11px 15px;border-radius:999px;font-weight:700;box-shadow:0 8px 30px #0008}
.tour-overlay{position:fixed;inset:0;z-index:100;background:#080a0dcc;display:none;align-items:center;justify-content:center;padding:18px;backdrop-filter:blur(5px)}
.tour-overlay.show{display:flex}.tour-card{width:min(560px,100%);background:var(--bg2);border:1px solid #4c3478;border-radius:18px;padding:20px;box-shadow:0 30px 90px #000}
.tour-progress{height:5px;background:var(--bg3);border-radius:5px;overflow:hidden;margin-bottom:22px}.tour-progress i{display:block;height:100%;background:linear-gradient(90deg,var(--p),var(--g));transition:.2s}
.tour-step{display:none;min-height:205px}.tour-step.on{display:block}.tour-step h2{font-size:24px;margin:8px 0 12px}.tour-step p{font-size:16px;line-height:1.65;color:#c8ced9}.tour-num{color:var(--p2);font-weight:700;font-size:13px;text-transform:uppercase}
.tour-actions{display:flex;gap:8px;align-items:center}.tour-actions>span{flex:1}
.help-head{display:flex;justify-content:space-between;align-items:center;gap:12px}.help-head h1{margin-bottom:2px}.help-head p{margin-top:0}
.roadmap{display:grid;grid-template-columns:repeat(5,1fr);gap:8px;margin:8px 0 18px}.roadmap>div{display:flex;gap:9px;background:var(--bg2);border:1px solid var(--line);border-radius:12px;padding:10px}.roadmap b{display:grid;place-items:center;flex:0 0 28px;height:28px;border-radius:50%;background:var(--p);color:#fff}.roadmap span,.roadmap strong,.roadmap small{display:block}.roadmap small{color:var(--mut);margin-top:3px;line-height:1.3}
.help-chat{display:flex;flex-direction:column;gap:9px;min-height:280px;padding:10px 0 120px}.help-msg{max-width:82%;padding:11px 13px;border-radius:14px;white-space:pre-wrap}.help-msg.ai{align-self:flex-start;background:#253455;border:1px solid #3d5c91}.help-msg.user{align-self:flex-end;background:#2b1f52}.help-msg .who{font-size:11px;color:var(--mut);margin-bottom:4px}
.help-composer{position:fixed;left:0;right:0;bottom:0;z-index:22;background:var(--bg2);border-top:1px solid var(--line);padding:10px 14px calc(10px + env(safe-area-inset-bottom));display:flex;gap:8px}.help-composer textarea{min-height:44px;max-height:110px;max-width:960px;margin-left:auto}.help-composer button{margin-right:auto}
@media(max-width:800px){.roadmap{grid-template-columns:1fr}.roadmap>div{align-items:center}.help-fab span{display:none}.help-fab{padding:12px 16px}.tour-step{min-height:260px}}
