/* Shared layout rules for the development package; loaded after legacy styles. */
#lumiEmergencyBar{display:flex;flex:0 0 auto;gap:8px;padding:6px 12px;min-width:0;box-sizing:border-box}
#lumiEmergencyBar>button,#lumiEmergencyBar>a{display:flex;align-items:center;justify-content:center;flex:1;min-width:0;min-height:48px;padding:8px;border:1px solid #fda4af;border-radius:10px;background:#762538;color:#fff;font:600 16px/1.3 system-ui;text-align:center;text-decoration:none;box-sizing:border-box;cursor:pointer}
#lumiEmergencyBar [hidden]{display:none!important}
html,body{max-width:100%;overscroll-behavior:none}
.app{height:var(--lumi-viewport-height,100dvh);min-height:0;min-width:0}
.app-header{flex:0 0 auto;flex-wrap:wrap;min-width:0;gap:8px}
.header-actions{min-width:0;max-width:100%;flex-wrap:wrap;flex-shrink:1;justify-content:flex-end}
.header-actions button,#closeSidebarBtn{min-height:44px;min-width:44px;height:44px}
.header-actions .auth-button{width:auto;min-width:max-content;flex:0 0 auto;padding:0 14px;font-size:14px;white-space:nowrap}
.auth-box{flex:0 0 auto}
.composer{flex:0 0 auto;padding-bottom:max(12px,env(safe-area-inset-bottom));min-width:0}
.composer-box{min-width:0}
.composer textarea{font-size:16px;max-height:min(160px,25dvh)}
.messages{min-height:0;min-width:0;overscroll-behavior:contain;overflow-wrap:anywhere}
#conversationSidebar{overflow-y:auto;overscroll-behavior:contain;height:var(--lumi-viewport-height,100dvh)}
#conversationSidebar>button,#conversationSidebar>a,.sidebar-top,.sidebar-label{flex-shrink:0;min-height:44px}
#conversationList{flex:0 0 auto;min-height:0;overflow:visible}
button:focus-visible,a:focus-visible,textarea:focus-visible,input:focus-visible{outline:3px solid #a8dcf2;outline-offset:3px}
dialog{max-width:calc(100vw - 24px);max-height:calc(var(--lumi-viewport-height,100dvh) - 24px);overflow:auto}
#lumiUpdateNotice{position:relative;flex:0 0 auto;max-height:25dvh;overflow:auto;margin:8px 12px;z-index:11;background:#20354b;color:#fff;border:1px solid #a8dcf2;border-radius:12px;padding:8px;display:flex;align-items:center;gap:8px;font:14px system-ui}
#lumiUpdateNotice span{flex:1;min-width:0}#lumiUpdateNotice button{flex:0 0 auto;min-height:44px;padding:8px 12px}
@media(max-width:900px){
 .app-header{padding:8px 12px}.header-actions{justify-content:flex-start;gap:6px}
 html.lumi-authenticated .header-actions{width:100%}
 #conversationSidebar[aria-hidden=true]{visibility:hidden}
}
@media(max-height:500px){.companion-profile{display:none!important}.app-header{min-height:0;padding:4px 8px}.messages{padding:8px}.composer{padding:4px 8px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{scroll-behavior:auto!important;animation:none!important;transition:none!important}}
.voice-button{flex:0 0 44px;min-width:44px;min-height:44px;border:0;border-radius:50%;background:var(--surface-2);color:var(--text)}
#loadEarlierBtn{flex:0 0 auto;min-height:44px;background:var(--surface-2);color:var(--text);border:1px solid var(--border)}
#lumiResearchBtn{min-height:44px}
#lumiAgendaBtn{margin:0 14px 12px;padding:12px;border:1px solid #9bd6f5;border-radius:12px;background:#25344a;color:#fff;font:17px system-ui;text-align:left}
#lumiCalendarDay,#lumiCalendarWeek{max-width:100%;min-width:0;overflow-wrap:anywhere}
#lumiCalendarDay input,#lumiCalendarDay button,#lumiCalendarWeek input,#lumiCalendarWeek button{max-width:100%;min-height:44px}

#lumiImportantLinksBtn,#lumiInstitutionalLink{margin:0 14px 12px;padding:12px;border:1px solid #9bd6f5;border-radius:12px;background:#25344a;color:#fff;font:17px system-ui;text-align:left;cursor:pointer}
#lumiImportantLinksDialog{width:min(560px,calc(100vw - 24px));background:#101827;color:#f5f7fb;border:1px solid #9bd6f5;border-radius:16px;padding:20px;box-sizing:border-box}
#lumiImportantLinksDialog::backdrop{background:rgba(0,0,0,.65)}
#lumiImportantLinksList article{padding:12px 0;border-bottom:1px solid #53657c}
#lumiImportantLinksList h3{margin:0 0 8px;overflow-wrap:anywhere}
#lumiImportantLinksList a{display:flex;align-items:center;min-height:44px;color:#a8dcf2;overflow-wrap:anywhere}
#lumiImportantLinksDialog button{min-height:44px;padding:10px 16px}

#lumiInstitutionalLink{text-decoration:none;display:block;min-height:44px}


/* Android/narrow-screen presentation only. Desktop nodes return to their original positions. */
#lumiMobileNav,#lumiMobileMore,#lumiMobileContext{display:none}
@media(max-width:900px){
 html.lumi-mobile-light .app-header{min-height:52px;padding:10px 16px;flex-wrap:nowrap;border-bottom:0;backdrop-filter:none}
 html.lumi-mobile-light .header-actions{display:none!important}
 html.lumi-mobile-light .companion-avatar,html.lumi-mobile-light .companion-status{display:none!important}
 html.lumi-mobile-light .companion-info h1{font-size:20px}
 html.lumi-mobile-light #lumiMobileContext{display:block;color:#b8c6d8;font:14px system-ui}
 html.lumi-mobile-light #lumiEmergencyBar{padding:0 12px 10px;border-bottom:1px solid #29374b}
 html.lumi-mobile-light #lumiEmergencyBar>button,html.lumi-mobile-light #lumiEmergencyBar>a{min-height:48px;background:#182536;border-color:#526279;font-weight:500}
 html.lumi-mobile-light #lumiEmergencyBar>#lumiSosSamuCall{background:#492535;border-color:#a35c70}
 html.lumi-mobile-light #loadEarlierBtn{align-self:center;background:transparent;border:0;min-height:48px;padding:6px 14px;color:#b8c6d8;font-size:14px;box-shadow:none}
 html.lumi-mobile-light .messages{padding:14px 12px}
 html.lumi-mobile-light .messages .msg{box-shadow:none}
 html.lumi-mobile-light .messages .msg.user{background:#254d7e}
 html.lumi-mobile-light #lumiMobileNav{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));flex:0 0 auto;gap:4px;padding:6px 10px max(8px,env(safe-area-inset-bottom));border-top:1px solid #29374b;background:#101827}
 html.lumi-mobile-light #lumiMobileNav>button{display:flex!important;align-items:center;justify-content:center;min-width:0;min-height:48px;width:auto!important;margin:0!important;padding:10px 6px!important;border:0!important;border-radius:10px!important;background:transparent!important;color:#bac7d8!important;font:500 16px/1.2 system-ui!important;text-align:center;box-shadow:none!important}
 html.lumi-mobile-light #lumiMobileNav>button[aria-current=page]{background:#203b5c!important;color:#eef6ff!important}
 html.lumi-mobile-light #conversationSidebar[aria-hidden=true]{display:none!important}
 html.lumi-mobile-light #conversationSidebar{width:min(360px,94vw);background:#101827;box-shadow:10px 0 28px #0004}
 html.lumi-mobile-light #conversationSidebar .sidebar-top{padding:14px 16px 10px;min-height:60px}
 html.lumi-mobile-light #conversationSidebar .sidebar-top h2{font-size:20px}
 html.lumi-mobile-light #closeSidebarBtn{min-height:48px;min-width:48px}
 html.lumi-mobile-light #lumiMobileMore{display:flex;flex:0 0 auto;flex-direction:column;gap:14px;padding:4px 12px 20px}
 html.lumi-mobile-light #lumiMobileFeatures,html.lumi-mobile-light #lumiMobileMore details>div{display:flex;flex-direction:column;gap:4px;min-width:0}
 html.lumi-mobile-light #lumiMobileMore details{border-top:1px solid #354256;padding-top:6px}
 html.lumi-mobile-light #lumiMobileMore summary{display:list-item;color:#f0f4fa;min-height:48px;padding:12px 4px;font:500 16px/1.4 system-ui;cursor:pointer}
 html.lumi-mobile-light #lumiMobileMore details:not([open])>div{display:none}
 html.lumi-mobile-light #lumiMobileMore button,html.lumi-mobile-light #lumiMobileMore a{min-height:48px;width:100%;height:auto;margin:0!important;padding:12px!important;border:0!important;border-radius:8px!important;background:transparent!important;color:#f0f4fa!important;font:16px/1.4 system-ui!important;text-align:left;white-space:normal;box-shadow:none!important;text-decoration:none;display:flex!important;align-items:center;gap:12px}
 html.lumi-mobile-light #lumiMobileMore [data-mobile-label]::after{content:attr(data-mobile-label)}
 html.lumi-mobile-light #lumiMobileMore .auth-box{display:block;width:100%}
 html.lumi-mobile-light #lumiMobileMore [hidden]{display:none!important}
 html.lumi-mobile-light #lumiLanguageControl{display:flex;width:100%;justify-content:space-between;gap:12px;padding:8px 12px;min-height:48px}
 html.lumi-mobile-light #lumiLanguageControl .lumi-language-label{position:static;width:auto;height:auto;margin:0;clip-path:none;overflow:visible;font:16px system-ui}
 html.lumi-mobile-light #lumiLanguageSelect{max-width:140px;border-color:#526279;background:#182536}
 html.lumi-mobile-light #conversationList{padding:0}
 html.lumi-mobile-light .sidebar-label{padding:6px 12px;font-size:12px;color:#b4c2d5;min-height:0}
 html.lumi-mobile-light #sidebarStatus{padding:4px 12px;font-size:14px}
 html.lumi-mobile-light .lumi-mobile-agenda #chatForm,html.lumi-mobile-light .lumi-mobile-agenda #loadEarlierBtn,html.lumi-mobile-light .lumi-mobile-agenda #messages>.msg:not(#lumiCalendarWeek):not(#lumiCalendarDay){display:none!important}
 html.lumi-mobile-light #messages>#lumiCalendarWeek,html.lumi-mobile-light #messages>#lumiCalendarDay{max-width:100%;width:100%;margin:0!important;padding:12px!important;box-sizing:border-box}
}
@media(max-width:900px) and (max-height:500px){
 html.lumi-mobile-light .app-header{min-height:40px;padding:6px 12px}
 html.lumi-mobile-light .companion-profile{display:flex!important}
 html.lumi-mobile-light #lumiEmergencyBar{padding:0 8px 6px}
 html.lumi-mobile-light #lumiMobileNav{padding-top:3px;padding-bottom:3px}
}

/* Keep reply speech control next to the mobile message bar. */
#lumiVoicePlaybackControls{display:none}
@media(max-width:900px){
 html.lumi-mobile-light #lumiVoicePlaybackControls{display:flex;justify-content:flex-end;margin-bottom:4px}
 html.lumi-mobile-light #lumiVoicePlaybackControls #soundButton{display:flex!important;align-items:center;gap:8px;min-height:48px;padding:6px 12px;border:1px solid #526279;border-radius:10px;background:#182536;color:#f0f4fa;font:14px/1.3 system-ui;cursor:pointer}
 html.lumi-mobile-light #lumiVoicePlaybackControls #soundButton::after{content:attr(aria-label)}
}

/* Primary conversation actions stay visible without opening More. */
#lumiMobilePrimaryActions{display:none}
@media(max-width:900px){
 html.lumi-mobile-light .app-header{padding:6px 12px}
 html.lumi-mobile-light #lumiMobileContext{display:none}
 html.lumi-mobile-light #lumiMobilePrimaryActions{display:flex;align-items:center;gap:6px;margin-left:auto;min-width:0}
 html.lumi-mobile-light #lumiMobilePrimaryActions #sidebarNewChatBtn{margin:0;min-height:44px;padding:8px;border:1px solid #526279;border-radius:10px;background:#182536;color:#f0f4fa;font:14px system-ui;white-space:nowrap;cursor:pointer}
 html.lumi-mobile-light #lumiMobilePrimaryActions #lumiLanguageControl{width:auto;min-height:44px;padding:0}
 html.lumi-mobile-light #lumiMobilePrimaryActions .lumi-language-label{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%)}
 html.lumi-mobile-light #lumiMobilePrimaryActions #lumiLanguageSelect{width:102px;max-width:102px;padding:8px 4px;font-size:14px}
}
@media(max-width:900px) and (max-height:500px){
 html.lumi-mobile-light .app-header{min-height:48px;padding:2px 12px}
 html.lumi-mobile-light #chatForm{display:grid;grid-template-columns:auto minmax(0,1fr);align-items:center;gap:4px 6px}
 html.lumi-mobile-light #chatForm .composer-box{grid-column:2;grid-row:1}
 html.lumi-mobile-light #lumiVoicePlaybackControls{grid-column:1;grid-row:1;margin:0}
 html.lumi-mobile-light #lumiVoiceStatus{grid-column:1 / -1;grid-row:2;min-width:0}
 html.lumi-mobile-light #lumiVoicePlaybackControls #soundButton::after{display:none}
 html.lumi-mobile-light #lumiUpdateNotice{margin:2px 12px;padding:4px}
}
/* Keep essential mobile actions reachable in browser and standalone PWA. */
@media(max-width:900px){
 html.lumi-mobile-light #lumiMobileNav{grid-template-columns:repeat(4,minmax(0,1fr))}
 html.lumi-mobile-light #lumiMobileNav>button{font-size:14px!important;padding:8px 3px!important;line-height:1.15!important}
 html.lumi-mobile-light #lumiMobileNav>#sidebarNewChatBtn{color:#f0f8ff!important;background:#254f73!important;white-space:normal;overflow-wrap:normal}
 html.lumi-mobile-light #conversationSidebar .sidebar-top{position:sticky;top:0;z-index:2;background:#101827;gap:8px}
 html.lumi-mobile-light #conversationSidebar .sidebar-top h2{margin-right:auto}
 html.lumi-mobile-light #conversationSidebar .sidebar-top .auth-box{flex:0 0 auto;max-width:40%}
 html.lumi-mobile-light #conversationSidebar .sidebar-top .auth-button{width:auto;min-width:60px;min-height:48px;height:auto;padding:10px;white-space:normal;background:#25344a;color:#fff}
}

@media(max-width:900px){
 html.lumi-mobile-light #lumiMobileNav{grid-template-columns:repeat(3,minmax(0,1fr))}
 html.lumi-mobile-light #lumiMobileNav.has-chat-return{grid-template-columns:repeat(4,minmax(0,1fr))}
 html.lumi-mobile-light #lumiMobileNav>button[hidden]{display:none!important}
}

/* Visible on replies without changing saved content or spoken text. */
#messages .lumi-reply-notice,#lumiGuideDialog > .lumi-reply-notice,#lumiDemoDialog > .lumi-reply-notice{display:block;margin-top:12px;padding-top:9px;border-top:1px solid #ffffff24;color:#bac7d8;font-size:13px;font-weight:400;line-height:1.45;overflow-wrap:anywhere}
#profileDialog{width:min(520px,94vw);padding:20px;overflow:auto;max-height:88dvh}
#profileDialog fieldset{border:0;padding:0;margin:0;min-width:0}
#profileDialog label{display:block;margin:18px 0;font-size:16px}
#profileDialog input,#profileDialog select,#profileDialog textarea{display:block;box-sizing:border-box;width:100%;max-width:100%;min-height:48px;margin-top:8px;padding:12px;border:1px solid #4a5d7b;border-radius:10px;background:#1f2d43;color:#f1f5f9;font:inherit;font-size:16px}
#profileDialog .lumi-profile-back{min-height:44px;padding:8px 0;background:transparent;color:#9bd6f5;text-decoration:underline;text-underline-offset:3px;margin-bottom:12px}
#profileDialog .lumi-profile-tabs{display:flex;gap:4px;background:#1b273b;border-radius:12px;padding:4px}
#profileDialog .lumi-profile-tabs button{flex:1;min-width:0;min-height:46px;padding:8px 6px;background:transparent;color:inherit;font-size:14px}
#profileDialog .lumi-profile-tabs button[aria-selected=true]{background:#34465f}
#profileDialog #lumiProfileSave{width:100%;min-height:48px;background:#9bd6f5;color:#112c40;font-size:16px;font-weight:600;margin-top:12px}
#profileDialog #lumiProfileSave:disabled{opacity:.6}
#profileDialog h2{font-size:24px;margin:4px 0 8px}
#profileDialog h3{font-size:19px}
#profileDialog>p{color:#bdcadd;line-height:1.5}

#companionTabs{display:flex;gap:8px;padding:8px 12px;flex-shrink:0;border-bottom:1px solid #334155;background:#111827}
html:not(.lumi-authenticated) #companionTabs,html:not(.lumi-authenticated) #companionScience{display:none!important}
#companionTabs button{flex:1;min-width:0;min-height:44px;padding:8px;border:1px solid #64748b;border-radius:10px;background:#1e293b;color:#f8fafc;font:inherit;font-size:15px;cursor:pointer}
#companionTabs button[aria-pressed=true]{background:#214f74;border-color:#9bd6f5;font-weight:700}
#companionScience[hidden]{display:none!important}
.app.companion-science-active #messages,.app.companion-science-active #chatForm,.app.companion-science-active #loadEarlierBtn{display:none!important}
#companionScience{overflow-y:auto;overscroll-behavior:contain;min-height:0;min-width:0;flex:1;padding:16px 18px 26px;color:#f1f5f9;background:#111827;line-height:1.55;overflow-wrap:anywhere}
#companionScience *{box-sizing:border-box}
#companionScience h2{font-size:23px;margin:0 0 8px}#companionScience h3{font-size:16px;margin:18px 0 5px}
#companionScience p{margin:8px 0 14px}#companionScience .science-note,#companionScience small{color:#cbd5e1;font-size:13px;display:block}
#companionScience .science-controls{display:grid;grid-template-columns:minmax(0,1.5fr) minmax(0,1fr);gap:10px;margin:18px 0}
#companionScience #companionScienceSubmit{grid-column:1/-1;margin:0}
#companionScience #companionScienceCount{padding:10px 12px;border-left:4px solid #9bd6f5;border-radius:6px;background:#214058;font-weight:600}
#companionScience label{display:grid;gap:5px;font-size:14px;min-width:0}
#companionScience input,#companionScience select{width:100%;min-width:0;min-height:44px;padding:10px;background:#1e293b;color:#f8fafc;border:1px solid #64748b;border-radius:8px;font:inherit;font-size:16px}
#companionScience details{margin:10px 0;border:1px solid #475569;border-radius:10px;background:#172336}
#companionScience summary{padding:14px;cursor:pointer;font-weight:600;min-height:48px}
#companionScience .science-record{padding:0 14px 16px;max-width:900px}
#companionScience .science-evidence{display:inline-block;border:1px solid #537b96;border-radius:6px;padding:4px 8px;font-size:13px;color:#bae6fd}
#companionScience a{color:#9bd6f5;text-decoration:underline}#companionScience ul{padding-left:20px}#companionScience li{margin:12px 0}
#companionScience button{min-height:44px;padding:10px 12px;max-width:100%;margin:16px 0 6px;border:1px solid #9bd6f5;border-radius:8px;background:#214f74;color:white;font:inherit;cursor:pointer;white-space:normal}
#companionScience .science-methodology{background:transparent}#companionScience .science-methodology p,#companionScience .science-methodology>small{margin:10px 14px}
#companionTabs button:focus-visible,#companionScience :focus-visible{outline:3px solid #fbbf24;outline-offset:3px}
@media(max-width:600px){#companionScience{padding:12px 12px 20px}#companionScience .science-controls{grid-template-columns:1fr}#companionTabs{padding:6px 10px;gap:6px}#companionTabs button{font-size:14px}}

#lumiCompanionScienceBtn,#lumiBrazilResearchBtn{margin:0 14px 12px;padding:12px;min-height:48px;border:1px solid #9bd6f5;border-radius:12px;background:#25344a;color:#fff;font:16px system-ui;text-align:left;cursor:pointer}
#lumiCompanionScienceBtn:focus-visible,#lumiBrazilResearchBtn:focus-visible{outline:3px solid #fbbf24;outline-offset:3px}

#companionScience:not(.science-research-view) #companionDoctoralResearch{display:none}
#companionScience.science-research-view > :not(h2):not(#companionDoctoralResearch){display:none}
@media(max-width:900px){html.lumi-mobile-light #lumiMobileScienceEntries{display:flex;flex-direction:column;gap:4px}}
