:root{--portal-ink:#172740;--portal-accent:#356bef;--portal-muted:#728097;--portal-border:#e5eafa;--portal-bg:#f4f7fc}
body.portal-ready{display:block;min-height:100dvh;overflow:auto;background:var(--portal-bg);color:var(--portal-ink)}
body.portal-ready #portalRoot{display:grid;grid-template-columns:248px minmax(0,1fr);min-height:100dvh;width:100%;background:var(--portal-bg)}
#portalRoot[hidden],.portal-view[hidden]{display:none!important}
.portal-sidebar{background:#fff;border-right:1px solid var(--portal-border);min-height:100dvh;padding:24px 17px;display:flex;flex-direction:column;gap:22px}
.portal-brand{display:flex;align-items:center;gap:11px;text-decoration:none;color:var(--portal-ink);padding:8px 7px;font-weight:850;letter-spacing:-.4px;font-size:16px}
.portal-mark{height:41px;width:41px;display:grid;place-items:center;border-radius:14px;background:linear-gradient(135deg,#3376f7,#8863f2);color:white;font-size:23px;box-shadow:0 8px 18px #356bef35}
.portal-brand small{display:block;color:#8c9aaf;letter-spacing:0;font-size:11px;font-weight:500}
.portal-nav{display:grid;gap:5px}.portal-nav button{font:600 14px inherit;font-family:inherit;background:transparent;border:0;color:#687a95;text-align:left;width:100%;display:flex;align-items:center;gap:12px;padding:13px;border-radius:14px;cursor:pointer}.portal-nav button:hover{background:#f3f6ff;color:#2d5ed4}.portal-nav button.active{background:#eaf1ff;color:#275ad2;font-weight:800}.portal-nav svg{width:19px;height:19px;flex:none}
.portal-bottom{margin-top:auto;border-top:1px solid var(--portal-border);padding-top:16px}.portal-identity{display:flex;align-items:center;gap:10px;background:#f7f9fd;border-radius:15px;padding:12px;min-width:0}.portal-avatar{flex:none;height:36px;width:36px;display:grid;place-items:center;border-radius:12px;background:#dce8ff;color:#285bd0;font-weight:850}.portal-identity strong{font-size:12px;display:block;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.portal-identity small{display:block;color:#8796ad;font-size:11px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.portal-main{min-width:0;padding:25px clamp(17px,3.7vw,58px) 50px}.portal-wrap{max-width:1130px;margin:auto}.portal-top{display:flex;justify-content:space-between;align-items:center;gap:14px;margin:0 0 28px}.portal-top .cap{font-weight:800;letter-spacing:.11em;text-transform:uppercase;color:#7b8ba4;font-size:11px}.portal-status{color:#3970c8;border:1px solid #dae6fb;background:#fff;padding:7px 12px;border-radius:100px;font-size:12px;font-weight:700}
.portal-eyebrow{font-size:11px;letter-spacing:.14em;text-transform:uppercase;font-weight:800;color:#4577e4;margin:0 0 10px}.portal-h1{font-size:clamp(25px,3vw,38px);letter-spacing:-1.15px;line-height:1.15;margin:0 0 11px}.portal-sub{color:#74839a;line-height:1.6;font-size:14px;max-width:650px;margin:0 0 25px}
.portal-grid{display:grid;grid-template-columns:repeat(12,minmax(0,1fr));gap:17px}.portal-card{grid-column:span 4;background:#fff;border:1px solid var(--portal-border);border-radius:21px;padding:24px;box-shadow:0 6px 28px #28518a09;min-width:0}.portal-card h2{font-size:18px;margin:0 0 7px;letter-spacing:-.4px}.portal-card p{font-size:13px;color:#76849a;line-height:1.6;margin:0 0 15px}.portal-feature{grid-column:span 8;background:linear-gradient(125deg,#dfeaff,#eee6ff);border-color:#dce6fc;min-height:224px}.portal-feature h2{font-size:24px;max-width:390px}.portal-feature p{max-width:420px}.portal-mini-stat{display:flex;align-items:center;gap:14px}.portal-statnum{font-size:28px;font-weight:850;letter-spacing:-1px}.portal-icon{height:45px;width:45px;display:grid;place-items:center;background:#ecf2ff;color:#4373e4;border-radius:14px;font-size:23px;flex:none}.portal-specialties{grid-column:span 12}.portal-special-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:11px;margin-top:19px}.portal-special-btn{border:1px solid #e7edfa;background:#fbfcff;padding:17px 13px;border-radius:16px;text-align:left;cursor:pointer;color:#243a59;font:inherit;min-height:108px}.portal-special-btn:hover{border-color:#7a9bfa;background:#f4f7ff}.portal-special-btn b{display:block;font-size:13px;margin-top:8px}.portal-special-btn small{color:#8895a9;font-size:11px}.portal-special-btn .sicon{font-size:22px}
.portal-btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;border:1px solid #d9e4fb;color:#3869e5;border-radius:13px;padding:11px 15px;background:#fff;font:700 13px inherit;font-family:inherit;cursor:pointer;text-decoration:none}.portal-btn.primary{background:var(--portal-accent);border-color:var(--portal-accent);color:white}.portal-btn:disabled{opacity:.55;cursor:wait}.portal-actions{display:flex;flex-wrap:wrap;gap:10px;margin-top:16px}
.portal-form{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:14px}.portal-field{min-width:0}.portal-field.full{grid-column:1/-1}.portal-field label{font-weight:750;font-size:12px;color:#465571;display:block;margin-bottom:6px}.portal-field input,.portal-field select,.portal-field textarea{border:1px solid #dce4f4;border-radius:12px;padding:12px 13px;width:100%;background:#fff;color:#253956;font:14px/1.4 system-ui,sans-serif;min-width:0}.portal-field textarea{resize:vertical;min-height:82px}.portal-hint{font-size:12px;color:#8795aa;line-height:1.5}.portal-group{margin:0 0 15px;padding:13px;border:1px solid #e7edfa;border-radius:13px;background:#fafcff}.portal-group-actions{display:flex;justify-content:flex-end}.portal-notice{background:#edf4ff;color:#315ba5;padding:12px 15px;border-radius:13px;font-size:13px;margin:13px 0}.portal-notice.error{background:#fff0f1;color:#a42b42}.portal-notice.good{background:#eaf8f1;color:#157755}
.portal-doc-row{display:flex;align-items:center;justify-content:space-between;gap:12px;border-bottom:1px solid #edf1fa;padding:16px 0}.portal-doc-row:last-child{border:0}.portal-doc-row strong{font-size:14px}.portal-doc-row small{font-size:12px;color:#8290a6;display:block;margin-top:4px}.portal-doc-row button{flex:none}
.portal-chat-host{background:#fff;border:1px solid var(--portal-border);border-radius:22px;overflow:hidden;min-height:calc(100dvh - 155px);height:calc(100dvh - 155px)}body.portal-ready>.app{display:none!important}.portal-chat-host .app{width:100%;max-width:none;height:100%;background:#fff;box-shadow:none;border-radius:0}.portal-chat-host .app header{border-bottom:1px solid #eef1fa}.portal-chat-host .app .foot{display:none}
.portal-chat-host #thread{padding:20px clamp(16px,12%,130px)}.portal-chat-host #chips,.portal-chat-host .bar{padding-left:clamp(16px,12%,130px);padding-right:clamp(16px,12%,130px)}
.portal-mobile-head{display:none}.portal-listwrap{max-width:850px}.portal-loading{color:#7a879a;font-size:13px}.portal-pick{display:flex;gap:9px;flex-wrap:wrap;margin:8px 0 24px}.portal-pick button{border:1px solid #dce7fc;border-radius:15px;padding:11px 13px;background:#fff;color:#3566c5;cursor:pointer;font-weight:700}.portal-pick button.active{background:#356bef;color:#fff}
@media(max-width:1060px){.portal-special-grid{grid-template-columns:repeat(2,1fr)}}
@media(max-width:760px){body.portal-ready #portalRoot{grid-template-columns:1fr}.portal-sidebar{display:none}.portal-mobile-head{display:flex;gap:11px;align-items:center;justify-content:space-between;margin:0 0 22px}.portal-mobile-head strong{font-size:16px}.portal-mobile-head button{background:#fff;border:1px solid var(--portal-border);border-radius:12px;padding:10px;color:#3467e1}.portal-sidebar.open{display:flex;position:fixed;z-index:82;top:0;bottom:0;left:0;width:265px;box-shadow:15px 0 80px #101b3544}.portal-main{padding:17px 16px 45px}.portal-top{display:none}.portal-grid{gap:12px}.portal-card,.portal-feature,.portal-specialties{grid-column:span 12}.portal-feature{min-height:200px}.portal-special-grid{grid-template-columns:repeat(2,1fr)}.portal-form{grid-template-columns:1fr}.portal-chat-host{min-height:calc(100dvh - 110px);height:calc(100dvh - 110px)}.portal-chat-host #thread,.portal-chat-host #chips,.portal-chat-host .bar{padding-left:16px;padding-right:16px}}


/* Plano de aula: experiência conversacional, sem campos excessivos. */
.lesson-shell{border:1px solid #e3eafb;background:#fff;border-radius:24px;box-shadow:0 14px 35px #2448870d;display:flex;flex-direction:column;min-height:550px;height:min(76dvh,760px);overflow:hidden;max-width:900px}
.lesson-top{display:flex;align-items:center;gap:12px;padding:15px 19px;border-bottom:1px solid #eef1fa}
.lesson-top strong{display:block;font-size:14px;color:#213958}.lesson-top small{display:block;color:#8594aa;font-size:12px}
.lesson-icon{background:linear-gradient(140deg,#3978f5,#7767df);color:#fff;width:38px;height:38px;border-radius:12px;display:grid;place-items:center;font-size:20px}
.lesson-spacer{flex:1}.lesson-secondary{font-size:11px;padding:9px 11px}
.lesson-thread{padding:23px clamp(16px,5%,42px);flex:1;overflow-y:auto;background:linear-gradient(180deg,#fbfcff 0%,#fff 45%)}
.lesson-bubble{white-space:pre-wrap;overflow-wrap:anywhere;width:fit-content;max-width:min(90%,670px);padding:13px 17px;margin-bottom:14px;border-radius:16px;font:14px/1.6 system-ui,sans-serif}
.lesson-bubble.assistant{background:#f1f5ff;color:#294361;border-top-left-radius:5px;margin-right:auto}
.lesson-bubble.user{background:#306cf0;color:white;border-top-right-radius:5px;margin-left:auto}
.lesson-bottom{border-top:1px solid #ecf0f8;padding:16px clamp(14px,3%,26px) 13px}
#lessonForm{border:1px solid #dbe4f5;border-radius:16px;display:flex;align-items:flex-end;gap:10px;padding:10px 10px 10px 16px;background:#fff}
#lessonInput{flex:1;max-height:145px;resize:vertical;background:transparent;color:#253956;border:0;outline:0;padding:7px 0;font:14px/1.55 system-ui,sans-serif;min-width:0}
#lessonInput:focus-visible{outline:none}#lessonForm:focus-within{border-color:#6994f6;box-shadow:0 0 0 3px #3e72eb1a}
#lessonSend{flex:none;height:39px;width:42px;border:0;border-radius:12px;background:#366beb;color:#fff;cursor:pointer;font-size:22px}
#lessonSend:disabled{opacity:.5;cursor:progress}.lesson-tools{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-top:9px;font-size:11px;color:#8a97a9}
#lessonRedo{border:0;background:transparent;color:#376de5;cursor:pointer;font-size:12px;font-weight:700}
.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
@media(max-width:760px){.lesson-shell{height:calc(100dvh - 225px);min-height:400px}.lesson-top{padding:12px}.lesson-secondary{font-size:10px}.lesson-bubble{max-width:96%}.lesson-thread{padding:16px}.lesson-tools{align-items:flex-start;flex-direction:column}}

/* Estado de créditos do agente */
#portalRoot .portal-nav button:disabled,#portalRoot #goAgent:disabled{opacity:.45;cursor:not-allowed;filter:grayscale(.4)}
#portalRoot #portalGuidedChat{height:100%;display:flex;flex-direction:column;align-items:stretch}
#portalRoot #portalGuidedChat .lesson-shell{width:100%;max-width:none;flex:1;height:100%;min-height:470px;border-radius:0;border:0;box-shadow:none}
#portalRoot #portalGuidedChat .lesson-thread{flex:1;min-height:150px;overflow-y:auto}

/* Editor manual de avaliações com banco de imagens */
#portalRoot .portal-manual-actions{display:flex;align-items:center;flex-wrap:wrap;gap:12px}
#portalRoot .portal-manual-toolbar{display:flex;justify-content:space-between;align-items:center;flex-wrap:wrap;gap:16px;padding:16px;background:#f3f7ff;border:1px solid #dbe6fb;border-radius:14px;margin:8px 0 18px}
#portalRoot .portal-manual-toolbar strong{display:block;font-size:15px;color:#253c64}
#portalRoot .portal-manual-toolbar strong[data-valid="false"]{color:#a1414a}
#portalRoot .portal-manual-toolbar small{display:block;margin-top:4px;color:#687b98;font-size:12px}
#portalRoot .portal-manual-buttons{display:flex;align-items:center;flex-wrap:wrap;gap:8px}
#portalRoot .portal-manual-buttons .portal-btn{font-size:12px;padding:9px 11px}
#portalRoot #manualImagesInfo{margin:0 0 12px;padding:0 2px}
#portalRoot .portal-question-item{padding:17px 18px 19px;margin:0 0 15px;border:1px solid #dce5f6;border-radius:16px;background:#fff;box-shadow:0 3px 13px #233d6910;display:flex;flex-direction:column;gap:11px}
#portalRoot .portal-question-head{display:flex;align-items:center;gap:12px;flex-wrap:wrap;padding-bottom:9px;border-bottom:1px solid #eff2f8}
#portalRoot .portal-question-select{display:inline-flex;align-items:center;gap:9px;flex-shrink:0;font-weight:750;font-size:14px;color:#253b60;cursor:pointer}
#portalRoot .portal-question-type{border:1px solid #e3eaf8;border-radius:30px;padding:4px 10px;background:#f5f8ff;font-size:11px;color:#5c7093}
#portalRoot .portal-question-score{display:inline-flex;align-items:center;gap:8px;margin-left:auto;font-size:12px;font-weight:700;color:#586982}
#portalRoot .portal-question-score input{width:83px!important;padding:8px!important;font-size:13px}
#portalRoot .portal-question-field{display:flex;flex-direction:column;gap:6px;font-size:12px;font-weight:700;color:#53647d}
#portalRoot .portal-question-field textarea{width:100%;border:1px solid #dce4f4;border-radius:11px;padding:12px;background:#fff;color:#253956;font:14px/1.45 system-ui,sans-serif;resize:vertical}
#portalRoot .portal-question-choices{display:grid;gap:8px}
#portalRoot .portal-question-choice{display:grid;grid-template-columns:22px 24px minmax(0,1fr);gap:10px;align-items:center}
#portalRoot .portal-question-choice span{font-weight:800;color:#3d5b8d}
#portalRoot .portal-question-choice input[type="text"]{border:1px solid #dce4f4;border-radius:10px;padding:11px;color:#263b60;width:100%;min-width:0;background:#fff}
#portalRoot .portal-question-choice input[type="radio"],#portalRoot .portal-question-select input[type="checkbox"],#portalRoot .portal-question-image-toggle input[type="checkbox"]{width:17px!important;height:17px!important;min-width:17px;flex:none;padding:0!important;margin:0;accent-color:#386cec;cursor:pointer;box-shadow:none}
#portalRoot .portal-manual-image{padding:12px;background:#f5f8ff;border:1px solid #dce7f9;border-radius:13px;display:grid;grid-template-columns:110px minmax(0,1fr);gap:10px 15px;align-items:start}
#portalRoot .portal-question-image-toggle{grid-column:1/-1;display:inline-flex!important;gap:9px;align-items:center;font-weight:700;font-size:12px;color:#2b487a;cursor:pointer}
#portalRoot .portal-manual-image img{width:110px;height:80px;object-fit:contain;border-radius:8px;background:#fff;border:1px solid #dde5f2}
#portalRoot .portal-manual-image-info{display:flex;flex-direction:column;gap:5px;min-width:0;font-size:12px;color:#354b69}
#portalRoot .portal-manual-image-info small{color:#778aa2}
#portalRoot .portal-manual-image-info a{font-size:12px;color:#2c65d9;text-decoration:underline}
@media(max-width:650px){#portalRoot .portal-question-item{padding:13px}#portalRoot .portal-question-score{margin-left:0}#portalRoot .portal-manual-image{grid-template-columns:90px minmax(0,1fr)}#portalRoot .portal-manual-image img{width:90px;height:75px}#portalRoot .portal-question-choice{gap:7px}}

#portalRoot .portal-manual-image .portal-image-choice{grid-column:1/-1;display:block;width:100%;max-width:600px;border:1px solid #d6e1f2;border-radius:10px;padding:10px;background:#fff;color:#283e60}
#portalRoot .portal-manual-image .portal-image-preview{grid-column:1/-1;display:grid;grid-template-columns:110px minmax(0,1fr);gap:14px;align-items:start}
#portalRoot .portal-manual-image .portal-image-preview[hidden]{display:none!important}
@media(max-width:650px){#portalRoot .portal-manual-image .portal-image-preview{grid-template-columns:88px minmax(0,1fr)}}

/* Consultas de IA e crédito: visibilidade sem condicionar o modo manual */
#portalRoot .portal-credit-panel{padding:14px 12px;border:1px solid #dde6f5;border-radius:15px;background:#f6f9ff;margin-top:auto;display:flex;flex-direction:column;gap:4px;color:#314565}
#portalRoot .portal-credit-title{font-size:10px;font-weight:800;letter-spacing:.12em;color:#5878b0}
#portalRoot .portal-credit-main{font-size:20px;line-height:1.35;font-weight:850;color:#244f9d}
#portalRoot .portal-credit-sub,#portalRoot .portal-credit-renew{font-size:11px;color:#677d9b}
#portalRoot #portalImageFree{font-size:10px;color:#0e8267;border-top:1px solid #dce7f5;margin-top:7px;padding-top:7px}
#portalRoot .portal-bottom{margin-top:0}
#portalRoot .portal-credit-panel+#portalRoot .portal-bottom{margin-top:0}
#portalRoot .portal-pdf-overlay[hidden],#portalRoot .portal-pdf-float[hidden]{display:none!important}
#portalRoot .portal-pdf-overlay{position:fixed;inset:0;z-index:10050;background:rgba(16,31,58,.35);backdrop-filter:blur(3px);display:grid;place-items:center;padding:24px}
#portalRoot .portal-pdf-modal{width:min(370px,92vw);display:flex;flex-direction:column;align-items:center;gap:13px;padding:31px 25px;background:#fff;border:1px solid #e3e8f5;border-radius:22px;box-shadow:0 18px 70px #1024443b;text-align:center;color:#233f69}
#portalRoot .portal-pdf-modal strong{font-size:17px}
#portalRoot .portal-pdf-modal small{font-size:12px;color:#7b8ca6}
#portalRoot .portal-pdf-spinner{width:43px;height:43px;border-radius:50%;border:4px solid #dbe6ff;border-top-color:#396df0;animation:professorSpinner .85s linear infinite}
#portalRoot .portal-pdf-float{position:fixed;z-index:10051;bottom:25px;right:23px;width:48px;height:48px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(140deg,#3d78f7,#8066f3);color:#fff;font-size:21px;box-shadow:0 8px 26px #3766d968;animation:professorFloat 1.8s ease-in-out infinite}
@keyframes professorSpinner{to{transform:rotate(360deg)}}
@keyframes professorFloat{0%,100%{transform:translateY(0)}50%{transform:translateY(-5px)}}
#portalRoot #headerFormFields .portal-form{grid-column:1/-1}
@media(max-width:760px){#portalRoot .portal-credit-panel{margin:6px 0 0}}


/* Chat responsivo unificado: avaliação, plano, apostila, relatório */
#portalRoot .portal-chat-host{
 width:100%;max-width:100%;min-width:0;
 display:flex;flex-direction:column;
 height:clamp(430px,calc(100dvh - 290px),740px);
 min-height:0;max-height:740px;
}
#portalRoot .portal-chat-host > .app{flex:1;min-height:0;min-width:0}
#portalRoot #portalGuidedChat{flex:1;min-height:0;max-height:100%;min-width:0;overflow:hidden}
#portalRoot #portalGuidedChat .lesson-shell{
 display:flex;flex-direction:column;
 height:100%;max-height:100%;min-height:0;
 min-width:0;max-width:none;overflow:hidden;
}
#portalRoot #portalGuidedChat .lesson-top,
#portalRoot #portalGuidedChat .lesson-bottom{flex:0 0 auto;min-width:0}
#portalRoot #portalGuidedChat .lesson-thread{
 flex:1 1 0;min-height:0;min-width:0;
 padding:clamp(14px,2vw,24px) clamp(15px,6%,64px);
 overflow-y:auto;overscroll-behavior:contain;
}
#portalRoot .portal-chat-host .lesson-bottom{
 width:100%;padding:12px clamp(12px,5%,52px) calc(12px + env(safe-area-inset-bottom,0px));
 background:#fff;
}
#portalRoot .portal-chat-host #agentDialogForm,
#portalRoot .portal-chat-host #lessonForm{
 width:100%;min-width:0;
 display:flex;align-items:flex-end;gap:9px;
 margin:0;padding:0;border:0;border-radius:0;
 background:transparent;box-shadow:none;
}
#portalRoot .portal-chat-host #agentDialogInput,
#portalRoot .portal-chat-host #lessonInput{
 box-sizing:border-box;
 display:block;flex:1 1 0;
 width:100%;min-width:0;min-height:48px;max-height:144px;
 padding:13px 17px;margin:0;
 border:1px solid #dbe4f5;border-radius:24px;
 outline:none;background:#fff;
 box-shadow:0 4px 14px rgba(47,107,255,.08);
 color:#1e3457;font:15px/1.4 system-ui,sans-serif;
 resize:none;overflow-y:auto;overflow-wrap:anywhere;
}
#portalRoot .portal-chat-host #agentDialogInput:focus-visible,
#portalRoot .portal-chat-host #lessonInput:focus-visible{
 border-color:#7598f3;outline:2px solid #dbe6ff;outline-offset:0;
}
#portalRoot .portal-chat-host .portal-chat-send{
 box-sizing:border-box;width:48px;height:48px;min-width:48px;
 display:grid;place-items:center;flex:0 0 48px;
 padding:0;border:0;border-radius:50%;
 background:#326cf4;color:#fff;
 cursor:pointer;box-shadow:0 4px 12px #3671f240;
 transition:background .15s ease,transform .15s ease;
}
#portalRoot .portal-chat-host .portal-chat-send:hover{background:#2559d9}
#portalRoot .portal-chat-host .portal-chat-send:active{transform:scale(.95)}
#portalRoot .portal-chat-host .portal-chat-send:focus-visible{outline:3px solid #abc6ff;outline-offset:2px}
#portalRoot .portal-chat-host .portal-chat-send:disabled{opacity:.45;cursor:not-allowed;box-shadow:none}
#portalRoot .portal-chat-host .portal-chat-send svg{display:block;width:22px;height:22px}
#portalRoot .portal-chat-host .lesson-tools{min-width:0;flex-wrap:wrap}
#portalRoot .portal-chat-host .lesson-bubble{
 max-width:min(87%,670px);
 font-size:clamp(13px,1.2vw,15px);
}
@media(max-width:760px){
 #portalRoot .portal-chat-host{
  height:clamp(390px,calc(100dvh - 295px),680px);
  max-height:680px;min-height:0;
 }
 #portalRoot #portalGuidedChat .lesson-top{padding:11px 12px;gap:9px}
 #portalRoot #portalGuidedChat .lesson-icon{width:34px;height:34px;flex:0 0 34px}
 #portalRoot #portalGuidedChat .lesson-top strong{font-size:13px}
 #portalRoot #portalGuidedChat .lesson-top small{font-size:11px}
 #portalRoot #portalGuidedChat .lesson-thread{padding:15px 12px}
 #portalRoot .portal-chat-host .lesson-bottom{padding:10px 10px calc(9px + env(safe-area-inset-bottom,0px))}
 #portalRoot .portal-chat-host .lesson-bubble{max-width:95%;font-size:14px}
 #portalRoot .portal-chat-host .lesson-tools{font-size:10px;gap:6px}
}
@media(max-width:380px){
 #portalRoot #portalGuidedChat .lesson-top .lesson-secondary{font-size:10px;padding:8px}
 #portalRoot .portal-chat-host #agentDialogInput,
 #portalRoot .portal-chat-host #lessonInput{font-size:14px}
 #portalRoot .portal-chat-host .portal-chat-send{width:44px;height:44px;min-width:44px;flex-basis:44px}
}

/* Cabeçalhos cadastrados — cards claros com edição e exclusão */
#portalRoot .portal-header-list{margin-bottom:16px;background:#fff;border:1px solid #e0e9f7;border-radius:18px;padding:18px}
#portalRoot .portal-header-list h2{margin:0 0 14px;color:#203957;font-size:17px;font-weight:780}
#portalRoot .portal-header-list h2 span{font-weight:500;margin-left:6px}
#portalRoot .portal-header-cards{display:grid;gap:10px}
#portalRoot .portal-header-card{display:flex;align-items:center;justify-content:space-between;gap:15px;border:1px solid #dce7fa;border-radius:13px;padding:13px 15px;background:#f8fbff;min-width:0}
#portalRoot .portal-header-card-info{display:flex;flex-direction:column;min-width:0;gap:4px}
#portalRoot .portal-header-card-info strong{font-size:14px;color:#253d62;overflow-wrap:anywhere}
#portalRoot .portal-header-card-info small{font-size:12px;color:#73859f;overflow-wrap:anywhere}
#portalRoot .portal-header-card-actions{display:flex;gap:8px;flex:none;align-items:center}
#portalRoot .portal-header-card-actions .portal-btn{font-size:12px;padding:8px 12px}
#portalRoot .portal-header-card-actions .portal-header-delete{color:#b43349;border-color:#ecc6ce;background:#fff}
#portalRoot .portal-chat-host #agentDialogInput,#portalRoot .portal-chat-host #lessonInput{background:#fff;color:#203650}
@media(max-width:600px){
 #portalRoot .portal-header-card{flex-direction:column;align-items:stretch}
 #portalRoot .portal-header-card-actions{align-self:flex-start}
 #portalRoot .portal-header-list{padding:13px}
}


/* Minha conta: cadastro, segurança e assinatura */
#portalRoot .portal-account-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:18px;margin-top:20px}
#portalRoot .portal-account-card{min-width:0;display:flex;flex-direction:column;gap:10px}
#portalRoot .portal-account-card h2{font-size:18px;margin:0;color:#203451}
#portalRoot .portal-account-card h3{font-size:15px;margin:5px 0 0;color:#273e61}
#portalRoot .portal-account-form{display:flex;flex-direction:column;align-items:stretch;gap:9px;margin-top:7px}
#portalRoot .portal-account-form label{font-size:12px;font-weight:750;color:#465b79}
#portalRoot .portal-account-form input{width:100%;max-width:100%;min-width:0;box-sizing:border-box;padding:12px 14px;border:1px solid #dbe4f4;border-radius:12px;background:#fff;color:#243951;font:14px/1.4 system-ui,sans-serif}
#portalRoot .portal-account-form input[readonly]{background:#f5f7fc;color:#6b7c97}
#portalRoot .portal-account-form input:focus-visible{outline:2px solid #b8c9ff;outline-offset:0;border-color:#688dfa}
#portalRoot .portal-account-form .portal-btn{align-self:flex-start;margin-top:7px}
#portalRoot .portal-account-form .portal-notice{font-size:12px;max-width:100%;overflow-wrap:anywhere}
#portalRoot .portal-account-divider{height:1px;background:#e4eafa;margin:13px 0 5px}
#portalRoot .portal-account-span{grid-column:1/-1}
#portalRoot .portal-account-row{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap}
#portalRoot .portal-account-billing-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;margin-top:10px}
#portalRoot .portal-account-stat{display:flex;flex-direction:column;gap:7px;padding:14px;border:1px solid #e4ebf8;border-radius:12px;background:#f7faff;min-width:0}
#portalRoot .portal-account-stat small{font-size:12px;color:#6d7e96}
#portalRoot .portal-account-stat strong{font-size:14px;color:#293d60;overflow-wrap:anywhere}
#portalRoot .portal-account-warning{background:#f9faff;border-left:3px solid #b3c3e7;padding:12px 13px;border-radius:8px;font-size:12px;line-height:1.55;color:#667792}
@media(max-width:860px){#portalRoot .portal-account-grid{grid-template-columns:minmax(0,1fr)}#portalRoot .portal-account-span{grid-column:auto}}
@media(max-width:530px){#portalRoot .portal-account-billing-grid{grid-template-columns:minmax(0,1fr)}#portalRoot .portal-account-card{padding:16px}#portalRoot .portal-account-form .portal-btn{width:100%;align-self:stretch}}

/* Correções móveis: cards com largura real e chat acessível sem rolagem da página. */
@media (max-width:760px){
  body.portal-ready{overflow-x:hidden}
  #portalRoot .portal-main,#portalRoot .portal-wrap{min-width:0}
  #portalRoot #pHome .portal-grid>.portal-card{grid-column:1 / -1}
  #portalRoot #pHome .portal-card{padding:20px;max-width:100%}
  #portalRoot #pHome .portal-feature{min-height:0}
  #portalRoot #pHome .portal-library-card{display:flex;flex-direction:column;align-items:flex-start}
  #portalRoot #pHome .portal-library-card .portal-btn{max-width:100%;white-space:normal;text-align:center;min-height:44px}
  #portalRoot #pHome .portal-special-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  body.portal-ready.portal-agent-open .portal-main{padding:10px 12px 0}
  body.portal-ready.portal-agent-open .portal-mobile-head{margin-bottom:8px}
  #portalRoot #pAgent:not([hidden]){display:flex;flex-direction:column;min-height:0;min-width:0}
  #portalRoot #pAgent>.portal-eyebrow,#portalRoot #pAgent>.portal-sub{display:none}
  #portalRoot #pAgent>.portal-h1{font-size:19px;letter-spacing:-.5px;margin:2px 0 9px;line-height:1.2}
  #portalRoot #pAgent>.portal-pick{
    display:flex;flex-wrap:nowrap;gap:8px;overflow-x:auto;
    -webkit-overflow-scrolling:touch;overscroll-behavior-x:contain;
    margin:0 0 10px;padding:0 0 3px;max-width:100%;
  }
  #portalRoot #pAgent>.portal-pick button{flex:0 0 auto;white-space:nowrap;min-height:44px;padding:10px 13px}
  #portalRoot #pAgent>.portal-chat-host{
    height:calc(100dvh - 178px - env(safe-area-inset-bottom,0px));
    max-height:none;min-height:340px;min-width:0;
    flex:1 1 auto;overflow:hidden;
  }
  #portalRoot .portal-chat-host>.app{
    display:flex;flex-direction:column;flex:1 1 auto;min-height:0;min-width:0;
    height:100%;overflow:hidden;
  }
  #portalRoot .portal-chat-host .app>header{
    box-sizing:border-box;display:flex;flex:0 0 auto;flex-wrap:nowrap;
    gap:8px;min-width:0;min-height:62px;padding:9px 12px;
  }
  #portalRoot .portal-chat-host .app>header .logo{width:35px;height:35px;border-radius:11px;flex:0 0 35px}
  #portalRoot .portal-chat-host .app>header>div:not(.logo){min-width:0;flex:1 1 0}
  #portalRoot .portal-chat-host .app>header h1{font-size:14px;line-height:1.15;margin:0}
  #portalRoot .portal-chat-host .app>header small{font-size:10px;line-height:1.25}
  #portalRoot .portal-chat-host .app>header .sp,
  #portalRoot .portal-chat-host .app>header #savedButton,
  #portalRoot .portal-chat-host .app>header #exitButton{display:none!important}
  #portalRoot .portal-chat-host .app>header .ghost{
    flex:0 0 auto;font-size:12px;min-height:40px;padding:7px 10px;
    max-width:72px;white-space:nowrap;
  }
  #portalRoot .portal-chat-host #thread{
    flex:1 1 0;min-height:0;min-width:0;padding:12px;
    overflow-y:auto;overscroll-behavior-y:contain;-webkit-overflow-scrolling:touch;
  }
  #portalRoot .portal-chat-host #chips{
    flex:0 0 auto;min-height:0;max-height:min(33dvh,240px);
    overflow-y:auto;overflow-x:hidden;overscroll-behavior-y:contain;
    -webkit-overflow-scrolling:touch;touch-action:pan-y;
    gap:8px;padding:11px 12px;background:#fff;
    border-top:1px solid #edf1fa;
  }
  #portalRoot .portal-chat-host #chips:empty{display:none!important}
  #portalRoot .portal-chat-host #chips .chip{
    min-height:44px;max-width:100%;white-space:normal;text-align:left;
    touch-action:manipulation;cursor:pointer;flex:0 0 auto;
    padding:10px 13px;line-height:1.3;
  }
  #portalRoot .portal-chat-host .app>.bar{
    flex:0 0 auto;min-width:0;width:100%;background:#fff;
    border-top:1px solid #f0f3fa;
    padding:9px 12px calc(10px + env(safe-area-inset-bottom,0px));
  }
  #portalRoot .portal-chat-host .app>.bar textarea{
    min-width:0;font-size:16px;min-height:46px;
  }
  #portalRoot .portal-chat-host .app>.bar #send{flex:0 0 46px;width:46px;height:46px}
}
@media (max-width:370px){
  #portalRoot .portal-chat-host .app>header #adminButton{max-width:60px;font-size:11px}
  #portalRoot #pHome .portal-special-grid{gap:8px}
  #portalRoot #pHome .portal-special-btn{padding:12px 10px}
}
/* Menu lateral no celular: rola quando é mais alto que a tela e respeita as bordas do iPhone. */
@media (max-width: 900px){
 .portal-sidebar.open{height:100dvh;max-height:100dvh;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;
  padding-top:max(20px,env(safe-area-inset-top));padding-bottom:calc(20px + env(safe-area-inset-bottom))}
 .portal-sidebar.open>*{flex-shrink:0}
}


/* Suporte no cabeçalho, sem botão flutuante sobre o chat ou o PDF. */
#portalRoot .portal-support-widget{position:relative;z-index:10040;right:auto;bottom:auto;margin-left:auto;flex:none;font:14px/1.45 system-ui,sans-serif}
#portalRoot .portal-support-launch{border:1px solid #dce6f9;background:#fff;color:#326dff;border-radius:12px;padding:9px 12px;min-height:40px;display:flex;align-items:center;justify-content:center;gap:7px;box-shadow:none;font:700 13px system-ui,sans-serif;cursor:pointer;touch-action:manipulation;white-space:nowrap}
#portalRoot .portal-support-launch .portal-support-mark{border:1.7px solid #326dff;border-radius:50%;height:21px;width:21px;display:inline-grid;place-items:center;font-weight:800;font-size:15px;flex:none}
#portalRoot .portal-support-panel{position:absolute;right:0;top:calc(100% + 10px);bottom:auto;width:min(370px,calc(100vw - 24px));max-height:calc(100dvh - 112px);overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;background:#fff;border:1px solid #dce6f8;border-radius:20px;box-shadow:0 20px 65px #172d5b3b;padding:18px;color:#1b2d4d}
#portalRoot .portal-support-panel[hidden]{display:none!important}
#portalRoot .portal-support-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:13px}
#portalRoot .portal-support-head b{font-size:18px;display:block}
#portalRoot .portal-support-head small{font-size:12px;color:#687d9c;display:block;margin-top:3px}
#portalRoot .portal-support-head button{border:1px solid #dce5f7;background:#fff;border-radius:10px;width:36px;height:36px;flex:0 0 36px;color:#476083;font-size:22px;cursor:pointer}
#portalRoot .portal-support-panel label{display:block;font-weight:750;font-size:12px;margin:9px 0 6px;color:#345075}
#portalRoot .portal-support-panel select,#portalRoot .portal-support-panel textarea{display:block;box-sizing:border-box;width:100%;max-width:100%;border:1px solid #d1dff3;background:#fff;border-radius:11px;padding:11px 12px;color:#213451;font:16px/1.45 system-ui,sans-serif;outline-offset:2px}
#portalRoot .portal-support-panel textarea{resize:vertical;min-height:115px;max-height:260px}
#portalRoot .portal-support-tip{display:block;font-size:11px;color:#6b7d97;margin:9px 0 14px;line-height:1.5}
#portalRoot .portal-support-send{background:#326dff;color:#fff;border:0;border-radius:12px;min-height:46px;width:100%;font:700 14px system-ui,sans-serif;cursor:pointer}
#portalRoot .portal-support-send:disabled{opacity:.65;cursor:wait}
#portalRoot #portalSupportResult{min-height:0;margin:11px 0 0;font-size:12px;line-height:1.55}
#portalRoot .portal-support-success{color:#0d795f}
#portalRoot .portal-support-error{color:#aa3440}
@media(max-width:760px){
 #portalRoot .portal-mobile-head{gap:8px}
 #portalRoot .portal-mobile-head strong{min-width:0;flex:1;font-size:clamp(13px,3.8vw,16px);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
 #portalRoot .portal-support-widget{margin-left:0}
 #portalRoot .portal-support-launch{width:43px;height:43px;min-height:43px;min-width:43px;padding:0;border-radius:12px}
 #portalRoot .portal-support-launch .portal-support-label{display:none}
 #portalRoot .portal-support-panel{position:fixed;top:calc(68px + env(safe-area-inset-top,0px));right:12px;bottom:auto;width:min(370px,calc(100vw - 24px));max-height:calc(100dvh - 90px - env(safe-area-inset-top,0px));padding:16px;border-radius:18px}
}


/* EduMin-inspired application shell: visual adaptation only. */
body.portal-ready{--portal-accent:#5965f2;--portal-ink:#25334d;--portal-bg:#f5f6fa;--portal-border:#e7eaf1;background:#f5f6fa}
body.portal-ready #portalRoot{background:#f5f6fa}
#portalRoot .portal-sidebar{background:#fff;border-right:1px solid #e6e9f1;padding:20px 13px;gap:17px;box-shadow:5px 0 20px #25305209}
#portalRoot .portal-brand{border-bottom:1px solid #e9ecf3;padding:9px 9px 18px;color:#263550}
#portalRoot .portal-mark{background:linear-gradient(135deg,#5965f2,#8278ed);border-radius:9px}
#portalRoot .portal-nav{gap:2px}
#portalRoot .portal-nav button{position:relative;border-radius:8px;min-height:42px;padding:10px 12px;font-size:13px;color:#687890}
#portalRoot .portal-nav button:hover{background:#f4f5fe;color:#5060df}
#portalRoot .portal-nav button.active{background:#edf0ff;color:#5260e3}
#portalRoot .portal-nav button.active:before{content:"";position:absolute;left:0;top:8px;bottom:8px;width:3px;background:#5b65f2;border-radius:0 3px 3px 0}
#portalRoot .portal-identity{background:#f6f7fc;border-radius:9px}
#portalRoot .portal-avatar{background:#e8ebff;color:#505cd0;border-radius:9px}
#portalRoot .portal-wrap{max-width:1250px}
#portalRoot .portal-top{border-bottom:1px solid #e6e9f2;padding-bottom:13px}
#portalRoot .portal-h1{font-size:clamp(25px,2.7vw,35px)}
#portalRoot .portal-eyebrow{color:#5965f2}
#portalRoot .portal-grid{gap:15px}
#portalRoot .portal-card{border:1px solid #e6e9f2;border-radius:11px;padding:21px;box-shadow:0 5px 19px #2034510b}
#portalRoot .portal-feature{background:linear-gradient(115deg,#5965f2,#7052c8);border-color:#5965f2}
#portalRoot .portal-feature :is(.portal-eyebrow,h2,p){color:#fff}
#portalRoot .portal-feature p{opacity:.94}
#portalRoot .portal-feature .portal-btn.primary{background:#fff;color:#4a57d4;border-color:#fff}
#portalRoot .portal-library-card{border-top:4px solid #b86d00}
#portalRoot .portal-library-card .portal-icon{background:#fff0d5;color:#ab6700}
#portalRoot .portal-special-btn{background:#fff;border-color:#e7eaf1;border-radius:9px}
#portalRoot .portal-special-btn:hover{background:#f5f6ff;border-color:#abb4fb}
#portalRoot .portal-btn{border-radius:8px}
#portalRoot .portal-btn.primary{background:#5965f2;border-color:#5965f2}
#portalRoot .portal-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px;margin:0 0 20px}
#portalRoot .portal-metric{--tile:#5965f2;background:var(--tile);color:#fff;min-height:117px;border-radius:9px;padding:16px;min-width:0;display:flex;flex-direction:column;gap:4px;box-shadow:0 4px 16px #20345126}
#portalRoot .portal-metric:nth-child(4n+2){--tile:#b86d00}
#portalRoot .portal-metric:nth-child(4n+3){--tile:#663db9}
#portalRoot .portal-metric:nth-child(4n+4){--tile:#d52b42}
#portalRoot .portal-metric-icon{display:grid;align-self:flex-end;place-items:center;width:31px;height:31px;border-radius:50%;background:#fff;color:var(--tile);font-size:17px;margin-bottom:-29px}
#portalRoot .portal-metric-label{padding-right:36px;min-height:29px;font-size:11px;font-weight:800;line-height:1.25;letter-spacing:.035em;text-transform:uppercase;color:#fff}
#portalRoot .portal-metric-value{font-size:clamp(25px,2.1vw,32px);font-weight:850;line-height:1.05;color:#fff;font-variant-numeric:tabular-nums}
#portalRoot .portal-metric-note{font-size:11px;opacity:.87;line-height:1.3;color:#fff}
#portalRoot .portal-metric-bar{height:4px;background:#ffffff50;border-radius:999px;margin-top:auto}
#portalRoot .portal-metric-bar:after{content:"";display:block;width:60%;height:100%;background:#fff;border-radius:999px}
@media(max-width:920px){#portalRoot .portal-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:600px){
 #portalRoot .portal-grid{gap:10px}
 #portalRoot .portal-card{padding:15px}
 #portalRoot .portal-metrics{gap:9px}
 #portalRoot .portal-metric{padding:12px;min-height:114px}
 #portalRoot .portal-metric-label{font-size:10px}
 #portalRoot .portal-metric-note{font-size:10px}
 #portalRoot .portal-metric-value{font-size:26px}
}

/* Preserve iPhone safe areas when the off-canvas navigation is open. */
@media(max-width:900px){#portalRoot .portal-sidebar.open{padding-top:max(20px,env(safe-area-inset-top,0px));padding-bottom:calc(20px + env(safe-area-inset-bottom,0px))}}
