:root{font-family:Inter,"Segoe UI",sans-serif;color:#182f35;background:#f3f5f3;font-synthesis:none;--green:#174c43;--line:#dce4df;--muted:#63776f}*{box-sizing:border-box}body{margin:0}[hidden]{display:none!important}button,input,select{font:inherit}button{cursor:pointer;border:1px solid transparent;border-radius:8px;padding:12px 18px;background:var(--green);color:white;font-weight:600}button:hover{filter:brightness(1.09)}button:disabled{opacity:.55;cursor:wait}button:focus-visible,input:focus-visible,select:focus-visible{outline:3px solid #c7a05f;outline-offset:3px}input,select{width:100%;border:1px solid #c8d4cd;border-radius:7px;padding:12px;background:#fff;color:#18362e}label{display:block;font-size:14px;font-weight:600;margin:20px 0 0}label input,label select{margin-top:8px}h1,h2,p{margin-top:0}h1{font-size:28px;letter-spacing:-.7px}h2{font-size:23px;letter-spacing:-.4px}.muted{color:var(--muted);line-height:1.6}.small{font-size:13px}.eyebrow{font-size:11px;letter-spacing:2px;font-weight:700;color:#667f73}.login-wrap{min-height:100vh;display:grid;grid-template-columns:1fr 1fr}.brand-panel{background:#123c35;color:#fff;padding:10vh 10%;display:flex;flex-direction:column;justify-content:center}.brand-panel .eyebrow{color:#d3b47c;margin:30px 0}.monogram{font-family:Georgia,serif;font-size:58px;border:1px solid #6c8878;width:144px;height:118px;display:grid;grid-auto-flow:column;align-items:center;justify-content:center}.monogram span{font-style:italic;font-size:32px;color:#d3b47c}.brand-panel h1{font-family:Georgia,serif;font-size:clamp(32px,3vw,46px);line-height:1.25;font-weight:400}.brand-panel p:not(.eyebrow){color:#bdcfc6;max-width:420px;line-height:1.8}.brand-panel small{color:#a6beb0;margin-top:50px}.login-panel{display:flex;align-items:center;justify-content:center;padding:40px;background:#fafbf8}.login-panel form{width:100%;max-width:375px}.login-panel h2{font-size:30px}.login-panel button{width:100%;margin:26px 0 20px;display:flex;justify-content:space-between}.sidebar{position:fixed;inset:0 auto 0 0;width:246px;background:#143e36;color:#f0f6f0;padding:34px 18px;display:flex;flex-direction:column}.wordmark{font-family:Georgia,serif;font-size:25px;padding:0 14px;margin-bottom:45px}.wordmark span{color:#d9b67c}.wordmark small{display:block;font:9px "Segoe UI",sans-serif;letter-spacing:1.7px;margin-top:12px;color:#b8d0c3}.nav-btn{display:block;width:100%;text-align:left;background:transparent;color:#c8d9cf;font-size:14px;margin:5px 0;padding:14px}.nav-btn.active{background:#2b564b;color:#fff;border-left:3px solid #cfb27d}.side-footer{margin-top:auto;padding:20px 14px 0;border-top:1px solid #3a5b4d}.side-footer strong,.side-footer small{display:block;margin-bottom:9px}.side-footer small{color:#a8c2b2}.text-btn{background:transparent;padding:8px 0;font-size:13px;margin-right:15px}.content{margin-left:246px;padding:35px 38px;max-width:1800px}.topbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px}.topbar h1{margin:8px 0}.secondary{background:white;border-color:var(--line);color:var(--green)}.scope-note{background:#e9efea;border:1px solid #d8e3d9;border-radius:8px;color:#50695c;font-size:13px;padding:13px 16px;line-height:1.5;margin-bottom:25px}.conversation-layout{display:grid;grid-template-columns:minmax(240px,340px) 1fr;min-height:60vh;background:white;border:1px solid var(--line);border-radius:12px;overflow:hidden}.queue-pane{border-right:1px solid var(--line)}.pane-heading{padding:22px 18px;display:flex;align-items:center;justify-content:space-between;border-bottom:1px solid var(--line)}.pane-heading h2{font-size:15px;margin:0}.badge{padding:4px 9px;border-radius:20px;background:#eaf0eb;font-size:12px}.queue-card{display:block;border-radius:0;border:0;border-bottom:1px solid #edf1ed;background:white;color:#203d32;text-align:left;width:100%;padding:20px;font-weight:400}.queue-card.selected{background:#edf4ed;border-left:3px solid #39785c}.queue-card strong{display:block;font-size:15px;margin-bottom:7px}.queue-card small{display:block;color:var(--muted);font-size:12px;margin:5px 0}.detail{padding:28px;min-width:0}.empty{padding:90px 25px;text-align:center;color:var(--muted)}.empty h2{font-size:21px;color:#2e4b3e}.empty p{max-width:360px;line-height:1.6;margin:auto}.empty-icon{font-size:35px;margin-bottom:24px;color:#8aa293}.detail-head{display:flex;justify-content:space-between;gap:15px;align-items:flex-start;border-bottom:1px solid var(--line);padding-bottom:20px}.detail-head h2{margin:0 0 8px}.detail-head p{font-size:12px;color:var(--muted)}.actions{display:flex;justify-content:flex-end;gap:10px;flex-wrap:wrap;margin-top:24px}.message{background:#f0f4ef;border-radius:0 12px 12px 12px;margin:18px 0;padding:16px;max-width:85%;white-space:pre-wrap;overflow-wrap:anywhere;line-height:1.6}.message small{display:block;color:#68796d;font-size:11px;margin-top:10px}.section-heading{display:flex;justify-content:space-between;align-items:center;gap:20px;margin:24px 0}.section-heading p{margin:0;color:var(--muted)}.table-wrap{overflow-x:auto;border:1px solid var(--line);border-radius:10px;background:white}table{width:100%;border-collapse:collapse}th,td{text-align:left;padding:17px;border-bottom:1px solid var(--line);font-size:14px}th{font-size:11px;letter-spacing:1px;text-transform:uppercase;color:var(--muted);background:#eef3ee}td small{display:block;color:var(--muted);margin-top:5px}td button{font-size:12px;padding:8px;margin:3px}dialog{border:1px solid var(--line);border-radius:14px;padding:30px;width:min(480px,94vw);box-shadow:0 20px 70px #132d3430}dialog::backdrop{background:#102e3866}#notice{position:fixed;top:16px;left:50%;transform:translateX(-50%);z-index:99;background:#173e34;color:white;padding:15px 25px;border-radius:8px;max-width:90vw;box-shadow:0 4px 20px #0003}.warning{background:#fff2d8;color:#664b1a;padding:14px;border-radius:8px;font-size:13px}.assign{display:flex;gap:10px;margin-top:18px}.assign select{max-width:280px}.tag{font-size:11px;color:#57705e}.queue-empty{padding:30px;color:var(--muted);line-height:1.6}.more{margin:10px 0}#more-queue{margin:15px}
@media(max-width:950px){.sidebar{width:205px}.content{margin-left:205px;padding:25px 20px}.conversation-layout{grid-template-columns:240px 1fr}.detail{padding:18px}.detail-head{display:block}.message{max-width:100%}}
@media(max-width:700px){.login-wrap{grid-template-columns:1fr}.brand-panel{padding:30px;min-height:210px}.brand-panel h1{font-size:26px;margin-bottom:0}.brand-panel p:not(.eyebrow),.brand-panel small,.monogram{display:none}.brand-panel .eyebrow{margin:0 0 15px}.login-panel{padding:35px 25px}.sidebar{position:static;width:auto;padding:18px}.wordmark{margin-bottom:15px;font-size:22px}.sidebar nav{display:flex;flex-wrap:wrap}.nav-btn{width:auto;font-size:12px;padding:10px}.side-footer{display:flex;align-items:center;gap:12px;padding:10px 0 0}.side-footer strong{font-size:12px;margin:0}.side-footer small{display:none}.content{margin:0;padding:22px 14px}.topbar h1{font-size:23px}.conversation-layout{grid-template-columns:1fr}.queue-pane{border-right:0;border-bottom:1px solid var(--line);max-height:320px;overflow:auto}.empty{padding:35px 15px}.section-heading{align-items:flex-start}.section-heading p{font-size:13px}.detail{padding:20px}}

.composer { display:grid; gap:12px; margin-top:24px; padding-top:20px; border-top:1px solid #d8e2de; }
.composer textarea { width:100%; box-sizing:border-box; resize:vertical; min-height:100px; padding:12px; border:1px solid #b8cac3; border-radius:8px; font:inherit; }
.composer button { justify-self:end; }
.message.outgoing { background:#e1efe9; margin-left:24px; white-space:pre-wrap; overflow-wrap:anywhere; }
#detail h3 { margin-top:24px; }

/* Conversation workspace: fixed header/composer, independent history and inbox scroll. */
:root{--green:#176653;--line:#dfe6e3;--muted:#6b7d77;font-family:"Segoe UI",Arial,sans-serif;background:#eef2f0}
body.logged-in{overflow:hidden}.sidebar{width:208px;padding:26px 14px;background:#173e35}.wordmark{font-size:22px;padding:0 9px;margin-bottom:30px}.nav-btn{font-size:13px;padding:12px}.content{height:100dvh;max-width:none;padding:0;margin-left:208px;display:flex;flex-direction:column;min-width:0}.menu-hidden .sidebar{display:none}.menu-hidden .content{margin-left:0}.topbar{height:60px;min-height:60px;padding:0 18px;margin:0;gap:14px;background:#fff;border-bottom:1px solid var(--line)}.topbar h1{font-size:18px;font-weight:600;margin:0;letter-spacing:0;flex:1}.icon-btn{background:transparent;color:#48645b;border:0;padding:8px 11px;font-size:21px;line-height:1.15;min-height:36px}.diagnostic{font-size:11px;color:#7b5f2c;background:#fff3d9;padding:6px 9px;border-radius:20px}.conversation-layout{flex:1;min-height:0;height:0;display:grid;grid-template-columns:300px minmax(0,1fr);border:0;border-radius:0;background:white}.queue-pane{display:flex;flex-direction:column;min-height:0;overflow:hidden;background:white;border-right:1px solid var(--line)}.inbox-search{display:flex;gap:8px;align-items:center;padding:14px 12px 10px}.inbox-search input{background:#f1f4f2;border:0;padding:10px 12px;font-size:13px}.inbox-tabs{display:flex;padding:0 10px 10px;gap:4px;border-bottom:1px solid var(--line)}.inbox-tabs button{font-size:12px;padding:8px 10px;background:transparent;color:#6b7d77;font-weight:500;white-space:nowrap}.inbox-tabs button.active{background:#dfeee6;color:#145842;font-weight:650}#queue{overflow-y:auto;flex:1;min-height:0}.queue-card{display:flex;gap:10px;align-items:center;padding:15px 12px;border-bottom:1px solid #edf0ef;min-height:77px}.queue-card.selected{border-left:0;background:#e8f0ec}.queue-card:hover{background:#f0f5f2;filter:none}.avatar{display:grid;place-items:center;border-radius:50%;width:38px;height:38px;flex:0 0 38px;background:#e7ede9;color:#658277;font-size:13px}.queue-copy{min-width:0;flex:1}.queue-name{display:flex;align-items:center;gap:8px}.queue-card strong{font-size:13px;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;margin:0;flex:1}.queue-card time{font-size:10px;color:#84918c}.queue-card small{font-size:11px;margin:6px 0 0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.detail{min-width:0;min-height:0;padding:0;display:flex;flex-direction:column;background:#f2f1ed;overflow:hidden}.detail>.empty{margin:auto}.chat-head{display:flex;align-items:center;gap:10px;padding:10px 18px;min-height:68px;border-bottom:1px solid var(--line);background:#fafcfb}.contact-title{padding:0;text-align:left;background:transparent;color:#233e34;min-width:0;flex:1}.contact-title strong{display:block;font-size:15px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.contact-title small{display:block;color:var(--muted);font-size:11px;font-weight:400;margin-top:5px}.chat-actions{display:flex;align-items:center;gap:4px}.chat-actions>button:not(.icon-btn){font-size:12px;padding:8px 10px}.mobile-back{display:none}.timeline{flex:1;min-height:0;overflow-y:auto;padding:14px clamp(16px,4vw,64px);display:flex;flex-direction:column;gap:5px;scrollbar-gutter:stable}.day-divider{align-self:center;background:#fff9;color:#708079;padding:5px 10px;border-radius:7px;font-size:10px;margin:12px 0;box-shadow:0 1px 1px #1b332110}.bubble{width:fit-content;max-width:min(78%,640px);padding:8px 11px 5px;border-radius:8px;background:white;box-shadow:0 1px 1px #16332917;align-self:flex-start;line-height:1.4;font-size:14px;overflow-wrap:anywhere}.bubble.saida{align-self:flex-end;background:#dcefdc}.bubble.nota{align-self:center;background:#fff0bd;border:1px dashed #d6b95d;max-width:88%;min-width:180px}.bubble-author{display:block;font-size:10px;font-weight:600;color:#3d795b;margin-bottom:3px}.nota .bubble-author{color:#8a661f}.bubble-text{white-space:pre-wrap}.bubble-meta{display:flex;justify-content:flex-end;gap:6px;font-size:9px;color:#748276;margin-top:3px}.send-error{font-size:11px;color:#956034;margin:6px 0}.more{align-self:center;border:1px solid var(--line);background:#fff;color:#577369;font-size:11px;margin:3px 0 8px;padding:7px 12px}.composer{margin:0;border:0;border-top:1px solid var(--line);padding:8px 16px 12px;display:block;background:#f8faf8}.composer-tools{display:flex;align-items:center;gap:5px;margin-bottom:7px;flex-wrap:wrap}.mode-btn,.auto-shortcut{font-size:11px;padding:5px 9px;background:transparent;color:#6c7e74;border-radius:5px}.mode-btn.active{background:#e2ece5;color:#1e6750}.auto-shortcut{margin-left:auto}.compose-row{display:flex;gap:10px;align-items:flex-end}.composer textarea{min-height:42px;max-height:112px;resize:none;overflow-y:auto;border:1px solid #e0e7e2;border-radius:9px;padding:10px 12px;background:white;line-height:20px;font-size:14px;flex:1;min-width:0}.compose-row button{height:42px;padding:9px 16px;font-size:12px}.note-mode{background:#fff6dc}.note-mode .mode-btn.active{background:#edd694;color:#705722}.note-mode .primary{background:#8a6b28}.note-hint{font-size:10px;color:#866828;margin:0 0 7px}.composer-readonly{margin:0;padding:18px;text-align:center;font-size:12px;color:#6f7e77;background:#fafcfb;border-top:1px solid var(--line)}.management{padding:24px 30px;overflow-y:auto;flex:1}.dialog-heading{display:flex;align-items:center;justify-content:space-between;gap:12px}.dialog-heading h2{font-size:20px;margin:0}.info-pair{margin-top:17px;border-bottom:1px solid #eff2ef;padding-bottom:10px}.info-pair small{color:#7d8b82;font-size:11px}.info-pair p{margin:4px 0 0;font-size:14px;overflow-wrap:anywhere}dialog{max-height:90dvh;overflow-y:auto}dialog textarea{font:inherit;width:100%;padding:12px;border:1px solid #c8d4cd;border-radius:7px;box-sizing:border-box;resize:vertical;margin-top:8px}.check-label{display:flex;align-items:center;gap:10px}.check-label input{width:18px;height:18px;margin:0}.rules-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}.rule-card{padding:20px;border:1px solid var(--line);border-radius:10px;background:white}.rule-card small{display:block;color:var(--muted);font-size:11px;margin:8px 0 16px}.rule-card p{white-space:pre-wrap;overflow-wrap:anywhere;font-size:13px}.rule-card button{font-size:12px;padding:8px 12px}textarea:focus-visible{outline:2px solid #78a78c;outline-offset:2px}#notice{font-size:13px;padding:12px 18px;top:10px}.empty{font-size:14px}#more-queue{font-size:11px;margin:10px;padding:8px}
@media(max-width:1100px){.conversation-layout{grid-template-columns:270px minmax(0,1fr)}.sidebar{width:185px}.content{margin-left:185px}.wordmark{font-size:19px}.timeline{padding:12px 18px}.chat-head{padding:10px 12px}.chat-actions{gap:0}.chat-actions>button{padding:7px}.bubble{max-width:85%}}
@media(max-width:760px){.sidebar{position:fixed;z-index:20;width:225px;inset:60px auto 0 0;padding:25px 14px;box-shadow:8px 0 20px #0002}.sidebar nav{display:block}.nav-btn{width:100%;font-size:13px}.side-footer{display:block}.side-footer strong{font-size:13px}.side-footer small{display:block}.content{margin-left:0;height:100dvh;padding:0}.topbar{padding:0 10px;height:56px;min-height:56px;gap:8px}.topbar h1{font-size:16px}.diagnostic{display:none}.conversation-layout{grid-template-columns:minmax(0,1fr)}.queue-pane{max-height:none;border:0}.detail{display:none}.chat-open .queue-pane{display:none}.chat-open .detail{display:flex}.mobile-back{display:block}.chat-head{gap:5px;padding:8px 6px;min-height:62px}.contact-title strong{font-size:13px}.chat-actions>button:not(.icon-btn){font-size:10px;padding:7px}.chat-actions>.icon-btn{font-size:18px;padding:7px}.timeline{padding:8px 12px}.bubble{max-width:87%;font-size:13px}.composer{padding:7px 9px 10px}.composer-tools{gap:2px}.mode-btn,.auto-shortcut{font-size:10px;padding:5px 6px}.compose-row{gap:6px}.compose-row button{padding:9px 12px}.management{padding:16px}.section-heading{align-items:flex-start}.section-heading h2{font-size:20px}dialog{padding:20px}#notice{max-width:94vw;width:max-content} }
.nav-caption{font-size:9px;letter-spacing:1.2px;color:#a1b7ac;margin:22px 12px 6px}.nav-caption:first-child{margin-top:0}
/* Agenda, respostas prontas e acompanhamento */
.unread-badge{background:#148b73;color:white;border-radius:20px;min-width:22px;text-align:center;padding:3px 6px;font-size:11px;font-weight:700;flex-shrink:0}
.extra-dialog{width:min(620px,calc(100vw - 28px));max-height:88dvh;overflow:auto}.extra-dialog form{display:grid;gap:12px}.extra-dialog .rule-card{margin:14px 0;white-space:pre-wrap}.sequence-editor{display:grid;gap:10px}.sequence-item{padding:12px;background:#f1f6f4;border-radius:10px}.quick-picker{max-height:220px;overflow:auto;border:1px solid #c5d9d1;background:white;border-radius:10px;padding:8px}.quick-item{display:block;text-align:left;width:100%;background:white;color:#183d34;border:0;padding:9px}.quick-item:hover{background:#e5f2ed}.composer-tools{flex-wrap:wrap}.extra-dialog .dialog-heading{position:sticky;top:0;background:white;z-index:1}#sound-toggle[aria-pressed="true"]{color:#148b73;background:#e1f3ec}
.media-view{margin-top:8px;max-width:100%}.media-view img,.media-view video{max-width:100%;max-height:360px;border-radius:8px}.media-view audio{max-width:100%;width:280px}.media-view iframe{width:100%;height:350px;border:0}.media-download{display:block;font-size:12px;margin-top:8px}
.extra-dialog .text-btn,.quick-picker .text-btn{color:#246353}.extra-dialog input,.extra-dialog select,.extra-dialog textarea{max-width:100%;min-width:0}.extra-dialog .sequence-item label{display:grid;gap:6px}

.channel-identity{display:flex;flex-direction:column;gap:2px;min-width:0;max-width:320px}.channel-identity small{font-size:10px;color:var(--muted,#627770)}.channel-identity select{margin:0;padding:5px 24px 5px 8px;font-size:12px;max-width:100%;background:transparent;border:1px solid #d6e1dc;border-radius:8px}.channel-identity select:disabled{opacity:1;color:inherit;appearance:none;padding-right:8px}@media(max-width:760px){.topbar{flex-wrap:wrap;height:auto;min-height:64px}.channel-identity{order:10;flex-basis:100%;max-width:none;padding-bottom:7px}.channel-identity select{width:100%}}
@media(max-width:760px){.topbar{display:grid;grid-template-columns:auto minmax(0,1fr) repeat(4,auto);grid-template-rows:48px 48px;height:108px;min-height:108px;padding:6px 10px;gap:0 6px}.topbar h1{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.channel-identity{grid-column:1/-1;grid-row:2;padding:0}.sidebar{inset:108px auto 0 0}}
/* Version 0.7: compact identity, quoted replies and read-only provider history. */
.avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}
.contact-avatar{flex:0 0 36px;width:36px;height:36px}
#connected-profile{display:flex;align-items:center;gap:6px;min-width:0}
#connected-profile img{width:22px;height:22px;object-fit:cover;border-radius:50%;flex-shrink:0}
#connected-profile span{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.quoted-message{margin:4px 0 7px;padding:7px 10px;border-left:3px solid #198875;background:#137c6a0d;border-radius:5px;max-width:100%;font-size:12px;overflow-wrap:anywhere}
.quoted-message strong,.quoted-message span{display:block}
.quoted-message span{white-space:pre-wrap;max-height:76px;overflow:auto}
.reply-action{font-size:11px;padding:3px 6px;float:right;background:transparent;color:#216d62;border:0}
.signature-choice{display:flex;align-items:center;gap:5px;font-size:12px;margin:0;font-weight:400;cursor:pointer}
.signature-choice input{width:15px;height:15px;margin:0}
.signed-hint{display:block;color:#58736b;font-size:10px}
.reply-preview{display:flex;align-items:center;gap:8px;width:100%}
.reply-preview blockquote{flex:1;min-width:0}
.external-history{width:min(760px,94vw);max-height:90dvh}
.external-messages{display:flex;flex-direction:column;gap:8px;background:#f1f0eb;padding:12px;height:min(55dvh,550px);overflow:auto}
.external-messages .bubble{max-width:90%;flex-shrink:0}
.history-controls{display:flex;justify-content:space-between;align-items:center;gap:8px;margin:10px 0}
.external-history-button{font-size:11px;max-width:95px;white-space:normal}
@media(max-width:700px){.contact-avatar{display:none}.chat-actions{gap:3px;flex-wrap:wrap;justify-content:flex-end}.chat-actions button{padding:5px 6px;font-size:11px}.external-history-button{max-width:72px}.signature-choice{font-size:11px}.reply-preview .text-btn{max-width:70px}.external-history .dialog-heading h2{font-size:19px}}

.external-history-button,.reply-preview .text-btn,.incoming-quote .text-btn{color:#216d62}.external-history-button{margin-right:0}.reply-action{float:none;display:block;margin-left:auto}.chat-actions{flex-shrink:0}

.external-history-button{font-size:12px;max-width:none;white-space:nowrap;padding:6px 8px;background:transparent;border:0;font-weight:400}.attachment-preview{display:grid;gap:8px;margin:14px 0;overflow-wrap:anywhere}.attachment-preview img{max-width:100%;max-height:280px;object-fit:contain}.attachment-preview audio{max-width:100%}.attachment-dialog{width:min(520px,94vw)}@media(max-width:700px){.external-history-button{white-space:normal;max-width:75px}}
