/* Version 29 — school-branded conversation workspace.
   Narrow screens use a single fixed-height conversation surface: no scrolling
   past toolbars to reach the input. Existing teaching tools are unaffected. */
#view-teacherai.twa-teacher-ai{width:100%;max-width:1120px;margin:0 auto}
#view-teacherai .twa-chat-shell{--chat-ink:#213946;--chat-teal:#0d7770;display:flex;flex-direction:column;min-width:0;height:min(790px,calc(100dvh - 157px));min-height:420px;background:#fff;border:1px solid #e1e9ea;border-radius:22px;overflow:hidden;box-shadow:0 16px 42px rgba(14,55,66,.055)}
#view-teacherai .twa-chat-head{display:flex;align-items:center;gap:13px;padding:17px 24px;border-bottom:1px solid #e8eeee;background:#fff;flex:none;min-height:80px}
#view-teacherai .twa-chat-mark{width:42px;height:42px;display:grid;place-items:center;flex:0 0 42px;border-radius:14px;background:linear-gradient(145deg,#113e50,#0a8980);color:#fff;font-size:23px}
#view-teacherai .twa-chat-ident{min-width:0;flex:1}
#view-teacherai .twa-chat-ident h2{font-size:20px;font-weight:820;line-height:1.15;margin:0;color:#183847;letter-spacing:-.4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
#view-teacherai .twa-chat-ident p{font-size:11px;line-height:1.35;margin:5px 0 0;color:#6b7e85;display:flex;align-items:center;gap:6px}
#view-teacherai .twa-chat-live{width:7px;height:7px;border-radius:50%;background:#31ae8c;flex:0 0 7px}
#view-teacherai .twa-chat-head-actions{display:flex;gap:9px;align-items:center;flex:none}
#view-teacherai .twa-chat-icon-button{display:grid;place-items:center;width:41px;height:41px;min-width:41px;border:1px solid #e1e9ea;border-radius:13px;background:#fff;color:#315d62;padding:0}
#view-teacherai .twa-chat-icon-button:hover{background:#f0f8f5;color:#0d7770}
#view-teacherai .twa-chat-icon-button:focus-visible,#view-teacherai button:focus-visible{outline:3px solid #e9ba5a;outline-offset:2px}
#view-teacherai .twa-chat-options{background:#f7faf9;border-bottom:1px solid #dde9e6;padding:14px 24px 16px;flex:none;box-shadow:0 6px 16px #143a3a07}
#view-teacherai .twa-chat-options[hidden],#view-teacherai .twa-ai-welcome[hidden],#view-teacherai .twa-ai-progress[hidden]{display:none!important}
#view-teacherai .twa-chat-options-title{font-size:12px;color:#294b4c;font-weight:800;margin:0 0 11px}
#view-teacherai .twa-ai-modes{display:flex;flex-wrap:wrap;gap:8px}
#view-teacherai .twa-ai-modes button{font-size:12px;font-weight:720;border:1px solid #dce7e5;padding:9px 17px;background:#fff;color:#45626a;border-radius:999px;min-width:78px}
#view-teacherai .twa-ai-modes button.selected{background:#134b55;color:#fff;border-color:#134b55}
#view-teacherai .twa-ai-context{margin-top:12px;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px;max-width:570px}
#view-teacherai .twa-ai-context label{font-size:11px;color:#466671;font-weight:680}
#view-teacherai .twa-ai-context select{margin-top:3px;max-width:none;min-height:42px;border-radius:10px;font-size:13px;padding:8px 10px}
#view-teacherai .twa-chat-option-note{font-size:11px;line-height:1.45;color:#71858a;margin:11px 0 0}
#view-teacherai .twa-ai-thread{flex:1;min-height:0;height:auto;overflow-y:auto;overscroll-behavior:contain;scrollbar-color:#bedbd3 transparent;background:#fff;display:block;padding:18px max(20px,calc((100% - 850px)/2));scroll-behavior:smooth}
#view-teacherai .twa-ai-welcome{max-width:680px;text-align:center;margin:0 auto;padding:clamp(18px,6vh,68px) 8px 0}
#view-teacherai .twa-ai-welcome-mark{display:grid;place-items:center;margin:0 auto 18px;width:57px;height:57px;border-radius:19px;background:linear-gradient(140deg,#123b4f,#158b82);color:#fff;font-size:27px}
#view-teacherai .twa-ai-welcome h3{color:#1d4050;font-size:clamp(20px,2.6vw,28px);line-height:1.18;letter-spacing:-.55px;margin:0 0 10px}
#view-teacherai .twa-ai-welcome p{color:#72848c;font-size:13px;line-height:1.65;margin:0 auto 22px;max-width:480px}
#view-teacherai .twa-ai-starters{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px;text-align:left}
#view-teacherai .twa-ai-starters button{display:flex;align-items:center;gap:10px;min-height:58px;padding:13px 15px;text-align:left;border:1px solid #e2e9e9;border-radius:15px;background:#fbfdfd;color:#2b5059;font-weight:740;font-size:12px;line-height:1.3;white-space:normal}
#view-teacherai .twa-ai-starters button span{font-size:19px;color:#128578}
#view-teacherai .twa-ai-starters button:hover{background:#eff8f6;border-color:#a9d5cb}
#view-teacherai .twa-ai-messages{display:flex;flex-direction:column;gap:18px;max-width:850px;margin:auto}
#view-teacherai .twa-ai-message{font-size:14px;line-height:1.68;color:#263d49;overflow-wrap:anywhere;flex:none;max-width:100%}
#view-teacherai .twa-ai-message.from-teacher{align-self:flex-end;max-width:85%;background:#edf5f3;border:1px solid #e1ebe8;border-radius:18px 18px 5px 18px;padding:12px 16px;color:#233e47}
#view-teacherai .twa-ai-message.from-assistant{align-self:stretch;background:transparent;border:0;border-radius:0;padding:0 3px 0 44px;position:relative}
#view-teacherai .twa-ai-message.from-assistant:before{content:'✦';display:grid;place-items:center;position:absolute;left:0;top:2px;width:31px;height:31px;border-radius:11px;background:linear-gradient(140deg,#143f51,#178a80);color:white;font-size:16px}
#view-teacherai .twa-ai-message.from-error{background:#fff8f6;color:#9f453c;border:1px solid #f1d2cd;border-radius:13px;padding:14px 15px;align-self:stretch}
#view-teacherai .twa-ai-message-content .twa-chat-line{margin:0 0 7px;white-space:pre-wrap}
#view-teacherai .twa-ai-message-content .twa-chat-blank{height:5px;margin:0}
#view-teacherai .twa-ai-message-content .twa-chat-headline{font-weight:800;font-size:15px;margin:10px 0 6px}
#view-teacherai .twa-ai-message-content .twa-chat-list-line{display:flex;gap:8px;align-items:start;margin:4px 0}
#view-teacherai .twa-ai-message-content .twa-chat-list-mark{min-width:18px;font-weight:700;color:#0c726c}
#view-teacherai .twa-ai-message-content code{background:#e9f1f0;padding:2px 4px;border-radius:4px;font-size:.93em}
#view-teacherai .twa-ai-source-label{margin-top:16px;padding-top:9px;border-top:1px solid #e0eae8;color:#607f7a;font-weight:650;font-size:11px}
#view-teacherai .twa-ai-sources{display:flex;gap:7px;flex-wrap:wrap;margin-top:8px}
#view-teacherai .twa-ai-sources a,#view-teacherai .twa-ai-sources span{border:1px solid #d5e5df;background:#f5faf7;color:#14645e;text-decoration:none;border-radius:11px;font-size:11px;padding:6px 10px;max-width:100%;overflow-wrap:anywhere}
#view-teacherai .twa-ai-message-actions{display:flex;margin-top:8px;justify-content:flex-start}
#view-teacherai .twa-ai-message-actions button{background:transparent;color:#568075;padding:6px 9px 6px 0;border:0;font-size:11px;font-weight:700}
#view-teacherai .twa-chat-retry{margin-top:8px;padding:8px 12px;background:#fff;border:1px solid #e7c4bd;border-radius:10px;font-size:12px;color:#9f453c;font-weight:800}
#view-teacherai .twa-ai-progress{display:flex;align-items:center;gap:11px;margin:15px 0;padding:10px 44px;color:#567e79;font-size:13px}
#view-teacherai .twa-ai-pulse{width:11px;height:11px;border-radius:50%;background:#138c80;box-shadow:0 0 0 5px #e2f5ef;animation:twa-ai-dot 1.1s ease-in-out infinite alternate;flex:none}
@keyframes twa-ai-dot{to{opacity:.4;transform:scale(.65)}}
#view-teacherai .twa-ai-bottom{flex:none;background:#fff;padding:12px max(20px,calc((100% - 850px)/2)) 14px;border-top:1px solid #edf0ef}
#view-teacherai .twa-ai-form{display:flex;align-items:end;gap:8px;padding:7px 8px 7px 15px;background:#f7faf9;border:1.5px solid #d7e5e1;border-radius:20px}
#view-teacherai .twa-ai-form:focus-within{border-color:#168a80;box-shadow:0 0 0 3px rgba(21,138,128,.10)}
#view-teacherai .twa-ai-form textarea{background:transparent!important;resize:none;min-height:35px!important;height:35px;max-height:148px;border:0!important;box-shadow:none!important;outline:none!important;padding:6px 0;line-height:1.5;font-size:14px;color:#203f49;flex:1;width:100%;overflow-y:auto}
#view-teacherai .twa-ai-form button{align-self:flex-end;flex:0 0 41px;width:41px;height:41px;min-height:41px;min-width:41px;padding:0;display:grid;place-items:center;border-radius:14px;border:0;background:#0b7770;color:white}
#view-teacherai .twa-ai-form button:disabled{opacity:.5;cursor:wait}
#view-teacherai .twa-ai-foot{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:8px;color:#8b999b}
#view-teacherai .twa-ai-foot p{font-size:10px;line-height:1.4;margin:0;color:#7d9194}
#view-teacherai .twa-ai-foot p.is-error{color:#b1443c}
#view-teacherai .twa-ai-foot #twa-ai-session-status{font-size:10px;color:#8ba0a2;white-space:nowrap}
@media(max-width:760px){
 body.school-edition:has(#view-teacherai.active) .content{padding:0!important;max-width:none!important;overflow:hidden}
 /* Ordinary teachers may hide the long role banner while using AI. An administrator
   in Teacher Mode must always retain the switch back to Administrator Mode. */
body.school-edition:has(#view-teacherai.active) #workspace-role-banner:not(:has(.twa-mode-switch)){display:none!important}
 body.school-edition:has(#view-teacherai.active) #workspace-warning{display:none!important}
 #view-teacherai.twa-teacher-ai{max-width:none}
 #view-teacherai .twa-chat-shell{height:calc(var(--twa-chat-viewport,100dvh) - 64px - 68px - env(safe-area-inset-bottom,0px));min-height:260px;border:0;border-radius:0;box-shadow:none}
 #view-teacherai .twa-chat-head{height:63px;min-height:63px;padding:8px 15px;gap:10px}
 #view-teacherai .twa-chat-mark{width:36px;height:36px;flex-basis:36px;border-radius:12px;font-size:21px}
 #view-teacherai .twa-chat-ident h2{font-size:16px}
 #view-teacherai .twa-chat-ident p{font-size:10px;margin-top:3px}
 #view-teacherai .twa-chat-head-actions{gap:5px}
 #view-teacherai .twa-chat-icon-button{width:35px;height:35px;min-width:35px;border-radius:11px}
 #view-teacherai .twa-chat-icon-button svg{width:19px;height:19px}
 #view-teacherai .twa-chat-options{padding:12px 15px 11px}
 #view-teacherai .twa-ai-modes{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:5px}
 #view-teacherai .twa-ai-modes button{min-width:0;padding:8px 3px;font-size:11px}
 #view-teacherai .twa-ai-context{gap:8px}
 #view-teacherai .twa-ai-context select{font-size:12px;min-height:38px}
 #view-teacherai .twa-chat-option-note{font-size:10px}
 #view-teacherai .twa-ai-thread{padding:13px 13px 8px}
 #view-teacherai .twa-ai-welcome{padding:clamp(8px,4vh,38px) 4px 0}
 #view-teacherai .twa-ai-welcome-mark{width:45px;height:45px;border-radius:15px;font-size:24px;margin-bottom:12px}
 #view-teacherai .twa-ai-welcome h3{font-size:21px;line-height:1.2}
 #view-teacherai .twa-ai-welcome p{font-size:12px;margin-bottom:15px}
 #view-teacherai .twa-ai-starters{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
 #view-teacherai .twa-ai-starters button{padding:10px;min-height:55px;border-radius:13px;font-size:11px;gap:7px}
 #view-teacherai .twa-ai-starters button span{font-size:17px}
 #view-teacherai .twa-ai-messages{gap:16px}
 #view-teacherai .twa-ai-message{font-size:13px}
 #view-teacherai .twa-ai-message.from-teacher{max-width:87%;padding:10px 13px}
 #view-teacherai .twa-ai-message.from-assistant{padding-left:38px}
 #view-teacherai .twa-ai-message.from-assistant:before{width:29px;height:29px}
 #view-teacherai .twa-ai-progress{padding:10px 38px}
 #view-teacherai .twa-ai-bottom{padding:9px 12px 9px;border-top:1px solid #edf1ef}
 #view-teacherai .twa-ai-form{padding:6px 7px 6px 12px;border-radius:17px}
 #view-teacherai .twa-ai-form textarea{font-size:13px;min-height:35px!important;height:35px}
 #view-teacherai .twa-ai-form button{width:38px;height:38px;min-width:38px;min-height:38px;border-radius:12px;flex-basis:38px}
 #view-teacherai .twa-ai-foot{gap:6px;margin-top:5px}
 #view-teacherai .twa-ai-foot p{font-size:9px;line-height:1.3}
 #view-teacherai .twa-ai-foot #twa-ai-session-status{display:none}
}
@media(max-width:360px){
 #view-teacherai .twa-chat-head{padding:8px 10px}
 #view-teacherai .twa-chat-ident h2{font-size:14px}
 #view-teacherai .twa-ai-starters button{font-size:10px}
}
@media(prefers-reduced-motion:reduce){#view-teacherai .twa-ai-pulse{animation:none}#view-teacherai .twa-ai-thread{scroll-behavior:auto}}

/* Preserve input accessibility labels without showing them as form content. */
#view-teacherai .twa-ai-form .sr-only{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;}
#view-teacherai .twa-chat-list-copy{min-width:0;flex:1;}
@media(max-width:760px){#view-teacherai .twa-chat-ident h2{display:none;}#view-teacherai .twa-chat-ident p{margin:0;font-size:11px;font-weight:650;color:#53746e;}}
/* The legacy lesson-revision chat caps .twa-ai-messages at 190px on phones.
   Do not inherit that cap in this full-screen conversation. */
#view-teacherai .twa-ai-messages{max-height:none!important;overflow:visible!important;padding:0!important;overscroll-behavior:auto!important}

/* V30 school-AI-first lesson preparation. A short, in-chat panel replaces the
   separate multi-step teacher flow without removing whole-term tools. */
#view-teacherai .twa-ai-lesson-panel[hidden]{display:none!important}
#view-teacherai .twa-chat-lesson-cta{border:1px solid #b8d9d1;border-radius:12px;background:#e8f6f1;color:#0c665e;font-weight:800;font-size:12px;white-space:nowrap;padding:9px 12px;min-height:35px}
#view-teacherai .twa-ai-lesson-start{background:#e4f4ef;border-color:#9ccfc2;color:#0f675f}
#view-teacherai .twa-ai-lesson-panel{max-width:740px;margin:0 auto 18px;background:#fff;border:1px solid #d1e5e0;border-radius:20px;padding:23px 24px;box-shadow:0 14px 38px rgba(20,65,67,.10)}
#view-teacherai .twa-ai-lesson-head{display:flex;align-items:center;gap:12px;margin-bottom:16px}
#view-teacherai .twa-ai-lesson-icon{display:grid;place-items:center;width:46px;height:46px;flex:none;border-radius:14px;background:#e8f5ef;color:#147b70;font-size:24px}
#view-teacherai .twa-ai-lesson-head>div{flex:1;min-width:0}
#view-teacherai .twa-ai-lesson-head h3{font-size:21px;line-height:1.2;color:#1c3948;margin:0 0 4px}
#view-teacherai .twa-ai-lesson-head p{font-size:12px;color:#718489;margin:0;line-height:1.4}
#view-teacherai #twa-ai-lesson-close{background:#f0f6f3;border-radius:11px;width:36px;height:36px;font-size:23px;color:#557a78}
#view-teacherai .twa-ai-lesson-form{display:grid;gap:15px}
#view-teacherai .twa-ai-lesson-form label{display:grid;gap:6px;font-size:12px;color:#385e63;font-weight:750}
#view-teacherai .twa-ai-lesson-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#view-teacherai .twa-ai-lesson-form select,#view-teacherai .twa-ai-lesson-form input,#view-teacherai .twa-ai-lesson-form textarea{width:100%;min-height:44px;background:#fbfdfd;border:1px solid #ccdfdb;border-radius:11px;font-size:14px;font-weight:600;color:#24414b;padding:11px 12px;box-shadow:none;max-width:100%}
#view-teacherai .twa-ai-lesson-form textarea{min-height:85px;resize:vertical;font-weight:400}
#view-teacherai .twa-ai-lesson-form label span{font-weight:450;color:#8b9a9e}
#view-teacherai .twa-ai-lesson-form details{border:1px solid #e1eae8;border-radius:12px;padding:12px 14px;background:#fbfdfc}
#view-teacherai .twa-ai-lesson-form details summary{font-weight:800;color:#265e60;cursor:pointer;outline-offset:4px}
#view-teacherai .twa-ai-lesson-form details summary span{float:right;font-size:11px;color:#869f9a;font-weight:600}
#view-teacherai .twa-ai-lesson-form details .twa-ai-lesson-fields{margin:13px 0 10px}
#view-teacherai .twa-ai-source-promise{background:#eff7f3;border-radius:11px;color:#456d64;font-size:11px;line-height:1.55;margin:0;padding:12px 14px}
#view-teacherai .twa-ai-lesson-actions{display:flex;justify-content:flex-end;gap:9px}
#view-teacherai .twa-ai-lesson-actions button{padding:11px 17px;min-height:44px;border-radius:11px;font-size:13px;font-weight:800}
#view-teacherai .twa-ai-lesson-actions #twa-ai-lesson-submit{background:#0f766e;color:white;flex:1;max-width:280px}
#view-teacherai .twa-ai-lesson-actions #twa-ai-lesson-submit:disabled{opacity:.5}
#view-teacherai .twa-ai-lesson-actions #twa-ai-lesson-cancel{background:#eef4f1;color:#396966}
#view-teacherai .twa-ai-lesson-help{font-size:11px;color:#72888a;margin:0;text-align:center}
#view-teacherai .twa-ai-lesson-help button{color:#0b7369;background:transparent;text-decoration:underline;padding:3px;font-weight:750}
#view-teacherai .twa-ai-document{align-self:stretch;background:#fff;border:1px solid #cfe1dc;border-radius:18px;padding:17px 18px;box-shadow:0 8px 30px rgba(10,65,63,.055);overflow:hidden}
#view-teacherai .twa-ai-doc-head{display:flex;align-items:center;gap:12px}
#view-teacherai .twa-ai-doc-icon{display:grid;place-items:center;width:43px;height:43px;flex:none;background:#e8f5ef;border-radius:13px;color:#167c71;font-size:22px}
#view-teacherai .twa-ai-doc-head>div{min-width:0;display:grid;gap:4px}
#view-teacherai .twa-ai-doc-head strong{font-size:16px;color:#193a48;line-height:1.35;overflow-wrap:anywhere}
#view-teacherai .twa-ai-doc-head small{font-size:11px;color:#668287}
#view-teacherai .twa-ai-doc-status{font-size:11px;color:#0e7163;font-weight:650;margin:12px 0 6px}
#view-teacherai .twa-ai-doc-warning{font-size:11px;line-height:1.55;color:#7c6548;background:#fff9ed;padding:9px 11px;border-radius:10px;margin:7px 0 12px}
#view-teacherai .twa-ai-doc-actions{display:flex;gap:7px;flex-wrap:wrap}
#view-teacherai .twa-ai-doc-actions button{background:#edf5f2;color:#116960;border:1px solid #d5e6e0;border-radius:10px;padding:8px 10px;font-weight:800;font-size:11px;min-height:38px}
#view-teacherai .twa-ai-doc-actions button:first-child{background:#0f766e;color:white;border-color:#0f766e}
#view-teacherai .twa-ai-doc-preview{margin-top:14px;border-top:1px solid #e2efea;padding-top:12px}
#view-teacherai .twa-ai-doc-preview summary{font-size:12px;font-weight:800;cursor:pointer;color:#246962}
#view-teacherai .twa-ai-doc-preview-wrap{overflow:auto;max-height:450px;padding:10px 0;margin-top:8px;font-size:12px}
#view-teacherai .twa-ai-doc-preview-wrap table{width:100%;min-width:480px;border-collapse:collapse}
#view-teacherai .twa-ai-doc-preview-wrap td,#view-teacherai .twa-ai-doc-preview-wrap th{border:1px solid #d9e5df;font-size:11px;padding:8px;vertical-align:top}
#view-teacherai .twa-ai-doc-hint{font-size:11px;color:#788c8a;margin:11px 0 0}
@media(max-width:760px){
 #view-teacherai .twa-chat-lesson-cta{font-size:11px;padding:8px;min-height:33px}
 #view-teacherai .twa-ai-lesson-panel{padding:16px 14px;border-radius:17px;margin:0 auto 15px}
 #view-teacherai .twa-ai-lesson-head h3{font-size:18px}
 #view-teacherai .twa-ai-lesson-head p{font-size:11px}
 #view-teacherai .twa-ai-lesson-fields{grid-template-columns:1fr;gap:10px}
 #view-teacherai .twa-ai-lesson-actions #twa-ai-lesson-submit{max-width:none}
 #view-teacherai .twa-ai-document{padding:14px 12px}
}

/* V30.3: curriculum-first selector, real streamed answers and in-chat document editor. */
#view-teacherai .twa-ai-curriculum-fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
#view-teacherai .twa-ai-curriculum-fields label:last-child{grid-column:1/-1}
#view-teacherai .twa-ai-curriculum-status{border-radius:11px;background:#f0f7f4;color:#305f61;padding:11px 13px;font-size:12px;line-height:1.6;margin:0;overflow-wrap:anywhere}
#view-teacherai .twa-ai-curriculum-status.is-warning{background:#fff7ed;color:#785b31}
#view-teacherai .twa-ai-lesson-form [hidden]{display:none!important}
#view-teacherai .twa-ai-revision-banner[hidden]{display:none!important}
#view-teacherai .twa-ai-revision-banner{display:flex;align-items:center;justify-content:space-between;gap:9px;border:1px solid #c8dbf0;border-radius:11px;background:#eef6ff;padding:9px 12px;margin-bottom:9px;font-size:12px;color:#214b74;font-weight:700}
#view-teacherai .twa-ai-revision-banner button{background:transparent;color:#1e668a;text-decoration:underline;font-size:11px;font-weight:700;white-space:normal;text-align:right}
#view-teacherai .twa-ai-message.is-streaming .twa-ai-message-content::after{content:'';display:inline-block;width:7px;height:17px;margin-left:3px;vertical-align:-3px;background:#138779;animation:twa-type-caret .75s steps(1,end) infinite}
@keyframes twa-type-caret{50%{opacity:0}}
#view-teacherai .twa-ai-doc-preview[open]>summary{margin-bottom:11px}
#view-teacherai .twa-ai-doc-preview-wrap{max-height:560px;border:1px solid #e3edea;border-radius:11px;padding:14px;background:#fff}
#view-teacherai .twa-ai-doc-editor[hidden]{display:none!important}
#view-teacherai .twa-ai-doc-editor{margin-top:14px;padding:14px;border:1px solid #badbd5;border-radius:12px;background:#f9fcfb}
#view-teacherai .twa-ai-doc-editor>h4{font-size:14px;color:#184e52;margin:0 0 6px}
#view-teacherai .twa-ai-doc-editor>p{font-size:11px;color:#5e777b;margin:0 0 12px}
#view-teacherai .twa-ai-doc-editor textarea,#view-teacherai .twa-ai-doc-editor input{width:100%;min-height:40px;max-width:100%;padding:9px;border:1px solid #c5dad5;border-radius:9px;background:#fff;color:#203f49;font-size:12px;font-family:inherit;box-sizing:border-box}
#view-teacherai .twa-ai-doc-editor textarea{min-height:70px;resize:vertical}
#view-teacherai .twa-ai-doc-editor .lp-edit-field{min-width:0}
#view-teacherai .twa-ai-doc-editor .lp-scroll{overflow:auto}
#view-teacherai .twa-ai-doc-editor .lp-edit-table{min-width:550px;width:100%}
#view-teacherai .twa-ai-doc-editor .lp-edit-period{margin-top:17px}
#view-teacherai .twa-ai-doc-editor label{display:block;font-size:11px;font-weight:700;color:#2a6062;margin:6px 0}
#view-teacherai .twa-ai-doc-editor .lp-document-table{width:100%;border-collapse:collapse;min-width:550px}
#view-teacherai .twa-ai-doc-editor .lp-document-table td,#view-teacherai .twa-ai-doc-editor .lp-document-table th{padding:7px;border:1px solid #d1e2dc;vertical-align:top}
#view-teacherai .twa-ai-doc-editor .twa-ai-manual-fields{display:grid;gap:8px;margin-top:11px}
#view-teacherai .twa-ai-doc-editor .twa-ai-edit-actions{display:flex;flex-wrap:wrap;gap:8px;justify-content:flex-start;margin-top:13px}
#view-teacherai .twa-ai-doc-editor .twa-ai-edit-actions button{padding:10px 13px;border-radius:9px;background:#0f766e;color:#fff;border:none;font-weight:750}
#view-teacherai .twa-ai-doc-editor .twa-ai-edit-actions button:last-child{background:#e7f0ed;color:#225b57}
#view-teacherai .twa-ai-doc-actions{margin-top:13px}
#view-teacherai .twa-ai-document .twa-ai-doc-preview>summary{font-size:13px}
@media(max-width:760px){#view-teacherai .twa-ai-curriculum-fields{grid-template-columns:1fr}#view-teacherai .twa-ai-doc-preview-wrap{padding:8px}#view-teacherai .twa-ai-doc-editor{padding:10px}#view-teacherai .twa-ai-revision-banner{flex-direction:column;align-items:flex-start}}
@media(prefers-reduced-motion:reduce){#view-teacherai .twa-ai-message.is-streaming .twa-ai-message-content::after{animation:none}}

/* Incremental stream updates should follow the text without restarting CSS smooth scrolling on every token. */
#view-teacherai .twa-ai-thread.is-answer-streaming{scroll-behavior:auto}

/* V30.4: topic-first automatic curriculum lookup, advanced indicators optional. */
#view-teacherai .twa-ai-lesson-panel{scroll-margin-top:10px}
#view-teacherai .twa-ai-advanced-source>summary{font-size:12px}
#view-teacherai .twa-ai-advanced-source>label{margin-top:13px}
#view-teacherai .twa-ai-advanced-source .twa-ai-curriculum-fields{margin-top:12px}
#view-teacherai .twa-ai-doc-source-link{display:inline-flex;margin:0 0 10px;color:#146d66;font-size:12px;font-weight:800;text-decoration:underline;text-underline-offset:3px}
#view-teacherai .twa-ai-lesson-form .twa-ai-source-promise strong{color:#0d645b}

#view-teacherai .twa-ai-lesson-brief{margin:0;font-size:12px;line-height:1.5;color:#397a6d;font-weight:600}
/* V30.5 — optional attachment and school-reference controls */
#view-teacherai .twa-ai-form #twa-ai-attach{background:#e7f3ef;color:#215f59;border:1px solid #c4ddd3;box-shadow:none;font-size:20px;align-self:end}
#view-teacherai .twa-ai-form #twa-ai-attach:hover{background:#d5ebe2}
#view-teacherai .twa-ai-attachment-preview{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:9px 13px;margin-bottom:8px;border:1px solid #c9dfd8;background:#f3faf7;border-radius:11px;color:#265e58;font-size:12px;overflow-wrap:anywhere}
#view-teacherai .twa-ai-attachment-preview[hidden]{display:none!important}
#view-teacherai #twa-ai-attachment-remove{background:transparent;color:#8c3031;border:0;cursor:pointer;font-weight:700;padding:7px}
#view-teacherai .twa-kb-chat-ref{display:grid;gap:6px;margin:10px 0;font-size:12px;font-weight:750;color:#375b58}
#view-teacherai .twa-kb-chat-ref select{width:100%;min-height:40px;padding:8px 10px;background:#f8fcfa;border:1px solid #d5e6e0;border-radius:10px}
#view-teacherai .twa-kb-lesson-ref{margin:0}
@media(max-width:760px){#view-teacherai .twa-ai-form #twa-ai-attach{font-size:18px}#view-teacherai .twa-ai-attachment-preview{font-size:11px}}
