/* Held production presentation. Optional Marin audio; dictation remains disabled. */
.emsom-chat-embedded{padding:10px;box-sizing:border-box;background:#faf8ff}
.emsom-chat-embedded .chat-layout{display:flex;flex-direction:column;height:100%;gap:8px}
.emsom-chat-embedded .chat-layout>.chat-language-row{display:flex;justify-content:flex-end;align-items:center;gap:8px;flex:none}
.emsom-chat-embedded #chat-log{flex:1;min-height:65px;overflow:auto;overscroll-behavior:contain}
.emsom-chat-embedded #chat-form{display:flex;flex-direction:column;flex:none;margin:0;gap:7px}
.emsom-chat-embedded #chat-question{height:72px!important;min-height:72px!important;resize:none;padding:10px!important;font-size:16px!important;line-height:1.4}
.emsom-chat-embedded #chat-status{margin:0;min-height:0;font-size:12px}
.emsom-chat-embedded .chat-privacy{font-size:12px;line-height:1.4}
.emsom-chat-embedded .chat-privacy[open]{max-height:110px;overflow:auto}
.emsom-chat-embedded .chat-contact{display:none}
#emsom-school-chat .chat-layout{max-width:850px;margin:0 auto}
#emsom-school-chat #chat-log{max-height:60dvh;overflow:auto;overscroll-behavior:contain}
#emsom-school-chat .chat-submit-actions{display:flex;gap:10px;flex-wrap:wrap}
#emsom-chat-panel .chat-submit-actions{display:flex;gap:10px;flex-wrap:wrap;position:static}
#emsom-chat-panel textarea,#emsom-school-chat textarea{box-sizing:border-box;width:100%}
#emsom-chat-panel nav button{min-height:36px}
@media(max-height:600px){#emsom-chat-panel{bottom:64px;height:calc(100dvh - 80px)}.emsom-chat-embedded .chat-privacy{display:none}.emsom-chat-embedded #chat-question{height:54px!important;min-height:54px!important}}

#voice-options{font-size:12px;line-height:1.4}#voice-options[hidden]{display:none!important}#voice-options summary{cursor:pointer;padding:5px 0}#voice-options label{display:flex;align-items:flex-start;gap:6px;margin:6px 0}#voice-options input{width:auto;flex:none;margin-top:3px}#voice-options[open]{max-height:130px;overflow:auto}#voice-options .button{min-height:36px;padding:6px 10px;font-size:13px}#voice-options p{margin:3px 0}

/* Optional dictation: shared by full-page and corner chat. */
#dictation-options{margin:1rem 0;padding:1rem;border:1px solid currentColor;border-radius:1rem}#dictation-options[hidden],#recording-controls[hidden]{display:none!important}#dictation-options label{display:flex;align-items:flex-start;gap:.5rem}#dictation-options input{flex:0 0 auto}#dictation-options p{font-size:.9rem;line-height:1.5}#recording-controls audio{display:block;width:100%;max-width:100%;margin:.75rem 0}#chat-mic[aria-pressed="true"]{outline:3px solid #d8a9f0;outline-offset:3px}#chat-question[readonly]{opacity:.85}

/* V56: chat owns its contrast rather than inheriting page form/paragraph colors. */
:is(#emsom-school-chat,#emsom-chat-panel){--bg:#181a20;--surface:#24232d;--text:#f8f5ff;--ink:#f8f5ff;--muted:#e5d3f5;--line:#8d789c;color:#f8f5ff;color-scheme:dark}
#emsom-chat-panel,.emsom-chat-embedded{background:#181a20}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-layout{color:#f8f5ff}
:is(#emsom-school-chat,#emsom-chat-panel) :is(.chat-message,#dictation-options,.chat-privacy){background:linear-gradient(125deg,#24262f,#302936);border:1px solid #8d789c;border-radius:16px;color:#f8f5ff}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-privacy{padding:12px}
:is(#emsom-school-chat,#emsom-chat-panel) :is(.chat-message p,.chat-message strong,label,summary){color:#f8f5ff}
:is(#emsom-school-chat,#emsom-chat-panel) :is(#chat-status,#voice-status,#speech-status,#dictation-help,.chat-keyboard-help,.chat-privacy p,.chat-contact,.chat-contact span){color:#e5d3f5}
:is(#emsom-school-chat,#emsom-chat-panel) #chat-question{background:#22242d;color:#f8f5ff;-webkit-text-fill-color:#f8f5ff;caret-color:#eed5ff;border:1px solid #b593cc;opacity:1}
:is(#emsom-school-chat,#emsom-chat-panel) #chat-question::placeholder{color:#dfc9ed;-webkit-text-fill-color:#dfc9ed;opacity:1}
:is(#emsom-school-chat,#emsom-chat-panel) :is(#chat-language,#chat-language option){background:#24232d;color:#f8f5ff;-webkit-text-fill-color:#f8f5ff;border-color:#b593cc}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-submit-actions{background:#181a20}
:is(#emsom-school-chat,#emsom-chat-panel) .button{background:#34303f;color:#f8f5ff;border:1px solid #ac8cc1}
:is(#emsom-school-chat,#emsom-chat-panel) .button.primary{background:linear-gradient(135deg,#7d3bab,#63308f);color:#fff}
:is(#emsom-school-chat,#emsom-chat-panel) a{color:#e6c6ff}
:is(#emsom-school-chat,#emsom-chat-panel) :is(button,textarea,select):focus-visible{outline:3px solid #e6c6ff;outline-offset:3px}
#emsom-chat-panel #chat-log:empty::before{color:#e5d3f5}

/* V58: one readable surface on both pale and dark host pages. */
body:has(#emsom-school-chat){background:#14151b;color:#faf7ff;color-scheme:dark}
body:has(#emsom-school-chat) main{max-width:960px;padding:28px 24px;margin:auto}
body:has(#emsom-school-chat) h1{font-size:clamp(30px,5vw,44px);line-height:1.15;margin:12px 0;color:#faf7ff}
body:has(#emsom-school-chat) main>p{color:#e4d8ef;font-size:17px;line-height:1.6}
body:has(#emsom-school-chat) main>p a{color:#e6c6ff}
:is(#emsom-school-chat,#emsom-chat-panel){font-family:system-ui,-apple-system,sans-serif;font-size:16px;line-height:1.55}
#emsom-school-chat{background:linear-gradient(135deg,#23232c,#1b1c24 70%);border:1px solid #5f536c;border-radius:24px;padding:26px;box-shadow:0 20px 60px #0005}
:is(#emsom-school-chat,#emsom-chat-panel) *{box-sizing:border-box}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-layout{padding:0;max-width:100%;display:flex;flex-direction:column;gap:18px}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-language-row{display:flex;align-items:center;justify-content:flex-end;gap:12px;color:#f8f5ff;font-size:14px}
:is(#emsom-school-chat,#emsom-chat-panel) #chat-language{padding:8px 12px;min-height:42px;border-radius:10px}
:is(#emsom-school-chat,#emsom-chat-panel) nav.actions{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0}
:is(#emsom-school-chat,#emsom-chat-panel) nav.actions button{font-size:14px;min-height:40px;padding:8px 14px;border-radius:20px;background:#30303c;border:1px solid #6e5c7c;color:#f9f5ff}
:is(#emsom-school-chat,#emsom-chat-panel) #chat-log{margin:0;max-height:340px;overflow:auto;scrollbar-color:#9b79b5 #23232c}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-message{margin:0 0 12px;padding:20px;border-color:#746184;background:linear-gradient(125deg,#30303c,#342b40);border-radius:16px;line-height:1.65}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-message:last-child{margin-bottom:0}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-message p{font-size:16px;line-height:1.65;margin:8px 0;color:#faf7ff}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-form{display:flex;flex-direction:column;gap:14px;margin:0}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-composer{background:#191b23;border:1px solid #766087;border-radius:18px;padding:20px;display:flex;flex-direction:column;gap:12px}
:is(#emsom-school-chat,#emsom-chat-panel) label[for=chat-question]{font-size:18px;font-weight:650;line-height:1.4;margin:0;color:#fff}
:is(#emsom-school-chat,#emsom-chat-panel) #chat-question{height:112px;min-height:100px;max-height:240px;resize:vertical;padding:14px;font:400 17px/1.6 system-ui;background:#282a35;border:1px solid #a286b7;border-radius:12px;color:#fff;-webkit-text-fill-color:#fff}
:is(#emsom-school-chat,#emsom-chat-panel) #dictation-options{margin:0;padding:0;background:none;border:0;border-radius:0;display:grid;grid-template-columns:auto 1fr;gap:8px 14px;align-items:center}
:is(#emsom-school-chat,#emsom-chat-panel) #dictation-options>label{grid-column:1/-1;display:flex;gap:10px;align-items:flex-start;font-size:14px;line-height:1.5}
:is(#emsom-school-chat,#emsom-chat-panel) #dictation-consent{width:18px;height:18px;min-height:18px;margin:2px 0 0;accent-color:#c28deb}
:is(#emsom-school-chat,#emsom-chat-panel) #dictation-help{grid-column:1/-1;font-size:13px;line-height:1.5;margin:0 0 4px;color:#e4d5ef}
:is(#emsom-school-chat,#emsom-chat-panel) #voice-status{font-size:14px;line-height:1.5;margin:0;color:#eddbfa}
:is(#emsom-school-chat,#emsom-chat-panel) #recording-controls{grid-column:1/-1}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-submit-actions{position:static;display:flex;align-items:center;gap:10px;margin:0;padding:12px 0 0;background:none;border-top:1px solid #514359}
:is(#emsom-school-chat,#emsom-chat-panel) .button{min-height:46px;padding:10px 18px;border-radius:11px;font:600 15px/1.4 system-ui;cursor:pointer}
:is(#emsom-school-chat,#emsom-chat-panel) .button.primary{background:linear-gradient(135deg,#a65ddd,#71369f);color:#fff;border:1px solid #c99bea}
:is(#emsom-school-chat,#emsom-chat-panel) :is(#chat-status,.chat-keyboard-help){margin:0;font-size:13px;line-height:1.5;color:#e7d9f2;min-height:0}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-privacy{padding:12px 16px;background:#292632;border:1px solid #675474;border-radius:12px;line-height:1.6}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-privacy summary{cursor:pointer;font-size:14px;color:#f9f5ff}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-privacy p{font-size:14px;color:#e7d9f2;line-height:1.7}
:is(#emsom-school-chat,#emsom-chat-panel) .chat-contact{margin:0;padding-top:2px;font-size:14px;line-height:1.7;color:#e7d9f2}
:is(#emsom-school-chat,#emsom-chat-panel) a{color:#e6c6ff;text-decoration:underline;text-underline-offset:3px}
.emsom-chat-embedded{background:#1b1c24;padding:14px;overflow:auto}
#emsom-chat-panel .chat-layout{gap:10px;height:auto;min-height:100%}
#emsom-chat-panel .chat-composer{padding:12px;gap:8px}
#emsom-chat-panel #chat-log{flex:none;max-height:220px;min-height:0}
#emsom-chat-panel #dictation-options{grid-template-columns:1fr}
#emsom-chat-panel #dictation-help,#emsom-chat-panel #voice-status{grid-column:1/-1}
#emsom-chat-panel .chat-privacy[open]{max-height:180px}
@media(max-width:600px){body:has(#emsom-school-chat) main{padding:18px 12px}#emsom-school-chat{padding:16px 12px;border-radius:18px}:is(#emsom-school-chat,#emsom-chat-panel) .chat-composer{padding:14px}:is(#emsom-school-chat,#emsom-chat-panel) #dictation-options{grid-template-columns:1fr}:is(#emsom-school-chat,#emsom-chat-panel) .chat-message{padding:16px}:is(#emsom-school-chat,#emsom-chat-panel) .chat-language-row{justify-content:space-between}:is(#emsom-school-chat,#emsom-chat-panel) #chat-log{max-height:280px}}
/* Override older widget rules that otherwise clip controls and restore a pale frame. */
#emsom-chat-panel .emsom-chat-frame{background:#1b1c24;overflow:auto;min-height:0}
#emsom-chat-panel .chat-layout{height:auto;min-height:100%;overflow:visible}
#emsom-chat-panel #chat-log,#emsom-chat-panel #chat-log:empty{flex:none;min-height:0;max-height:220px}
#emsom-chat-panel #chat-log:empty{display:none}
#emsom-chat-panel .chat-form{border-top:0;padding-top:0}
#emsom-chat-panel .chat-layout>.chat-language-row label{color:#f8f5ff}
#emsom-chat-panel .chat-keyboard-help{display:none}
#emsom-chat-panel #chat-status{font-size:13px}
#emsom-chat-panel>header{background:linear-gradient(120deg,#302a3e,#49305b)}
