/* Mobile Arbeitsplatz: Gespräch oben, gut erreichbare Eingabe und Sprachsteuerung unten. */
body.portal-open { overflow: hidden; overscroll-behavior: none; }
.local-test-banner { flex-shrink: 0; padding: 8px 16px; background: #e7f1f8; color: #315b79; text-align: center; font-size: .78rem; line-height: 1.5; }
#app.is-portal {
  position: fixed;
  top: var(--portal-top, 0px);
  left: 0;
  right: 0;
  height: var(--portal-height, 100dvh);
  padding-top: env(safe-area-inset-top, 0px);
  background: white;
}
.sidebar-heading { display: flex; align-items: center; margin-bottom: 33px; }
.sidebar-heading .brand { margin: 0 9px; flex: 1; }
.sidebar-close, .sidebar-scrim { display: none; }
.chat-topbar > div { min-width: 0; }
.chat-topbar > div > div:last-child { min-width: 0; }
.chat-topbar small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 350px; }
.chat-scroll { overflow-anchor: auto; -webkit-overflow-scrolling: touch; scroll-behavior: auto; }
.message-text { line-height: 1.65; }
.composer-area { padding-top: 6px; padding-bottom: max(18px, env(safe-area-inset-bottom, 0px)); position: relative; }
.composer { flex-direction: column; align-items: stretch; gap: 9px; padding: 14px 15px 12px; border-radius: 15px; }
.composer textarea { min-height: 56px; padding: 0 1px; font-size: 16px; line-height: 1.5; border-radius: 0; }
.composer textarea:read-only { color: var(--navy); }
.composer.is-recording { border-color: #b85a38; box-shadow: 0 0 0 3px #bd4f2010; }
.composer-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dictate-button, .composer .send-button {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  height: 48px; min-height: 48px; width: auto; padding: 0 17px;
  border-radius: 10px; font-size: .88rem; font-weight: 550; touch-action: manipulation;
}
.dictate-button { background: #edf3f7; color: #315b79; border: 1px solid #d7e3ec; }
.dictate-button:hover:enabled { background: #e4eef5; }
.dictate-button[aria-pressed="true"] { background: #fff1e9; color: #a44022; border-color: #dfbba8; }
.dictate-button .icon { width: 20px; height: 22px; }
.dictate-button:disabled { opacity: .65; }
.composer .send-button:disabled { opacity: 1; background: #e7eef3; color: #647b8d; }
.composer .send-button .icon { width: 19px; height: 19px; }
.speech-status { display: flex; align-items: flex-start; gap: 8px; min-height: 18px; margin: 10px 3px 0; color: var(--muted); font-size: .76rem; line-height: 1.5; }
.speech-status-text { flex: 1; }
.speech-status.is-recording { color: #964025; }
.speech-status.is-recording::before { content: ""; width: 7px; height: 7px; margin-top: 5px; flex-shrink: 0; border-radius: 50%; background: #b34a2e; animation: pulse 1.5s ease-in-out infinite; }
.speech-status.is-error { color: #954128; }
.speech-status button { flex-shrink: 0; min-height: 44px; margin: -11px -5px -11px 0; padding: 8px; border: 0; background: transparent; color: #954128; font-size: .76rem; text-decoration: underline; text-underline-offset: 3px; }
.speech-status button[hidden] { display: none; }
.composer-caption { margin-top: 9px; min-height: 22px; font-size: .72rem; }
.composer-caption > span { display: inline; }
.speech-info { font-size: .72rem; color: var(--muted); }
.speech-info summary { cursor: pointer; padding: 7px 0 7px 12px; text-underline-offset: 3px; }
.speech-info[open] summary { color: var(--blue); }
.speech-info p { position: absolute; z-index: 10; bottom: 50px; right: 25px; width: min(355px, calc(100% - 30px)); max-height: 40dvh; overflow-y: auto; padding: 18px 20px; background: white; border: 1px solid #cfdee8; border-radius: 10px; box-shadow: 0 8px 30px #18304720; color: #496579; font-size: .82rem; line-height: 1.65; }
.work-status:empty { min-height: 8px; }

@media (max-width: 640px), (max-width: 1000px) and (pointer: coarse) {
  .portal-shell { display: block; }
  .main-panel { height: 100%; }
  .mobile-menu { display: inline-flex; }
  .sidebar { position: fixed; z-index: 25; top: 0; bottom: 0; left: 0; visibility: hidden; transform: translateX(-100%); }
  .sidebar.is-open { visibility: visible; transform: translateX(0); }
  .sidebar { width: min(310px, calc(100vw - 48px)); padding-top: max(22px, env(safe-area-inset-top, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); overflow-y: auto; overscroll-behavior: contain; }
  .sidebar-heading { margin-bottom: 26px; }
  .sidebar-heading .brand { margin-right: 0; }
  .sidebar-close { display: inline-flex; width: 44px; height: 44px; margin: -5px -3px -5px 0; }
  .sidebar-scrim.is-open { display: block; position: absolute; inset: 0; z-index: 24; border: 0; background: #16334b55; padding: 0; }
  .sidebar.is-open { box-shadow: 12px 0 40px #18304728; }
  .sidebar .conversation, .sidebar .nav-button { min-height: 46px; }
  .sidebar .account-row .icon-button, .conversation-heading .icon-button { width: 44px; height: 44px; }
  .topbar .mobile-menu { width: 48px; height: 48px; }
  .chat-topbar { height: 64px; padding-left: max(13px, env(safe-area-inset-left, 0px)); padding-right: max(13px, env(safe-area-inset-right, 0px)); gap: 10px; }
  .chat-topbar > div { gap: 8px; }
  .chat-topbar .agent-symbol.mini { display: none; }
  .chat-topbar strong { font-size: 1rem; }
  .chat-topbar small { max-width: 205px; font-size: .73rem; margin-top: 4px; }
  .chat-topbar .button { width: 48px; height: 48px; min-height: 48px; padding: 0; border-color: #dce6ed; }
  .chat-topbar .button span { display: none; }
  .chat-topbar .button .icon { width: 20px; height: 20px; }
  .chat-inner { padding: 25px max(18px, env(safe-area-inset-right, 0px)) 12px max(18px, env(safe-area-inset-left, 0px)); }
  .chat-welcome { margin: 1vh 0 0; padding-bottom: 20px; }
  .welcome-symbol { width: 42px; height: 48px; margin-bottom: 20px; }
  .chat-welcome h1 { font-size: clamp(1.7rem, 7.1vw, 2.15rem); line-height: 1.15; }
  .chat-welcome > p { font-size: .93rem; margin-top: 15px; line-height: 1.6; }
  .prompt-list { margin-top: 22px; gap: 10px; }
  .prompt-list button { min-height: 52px; font-size: .87rem; padding: 13px 14px; }
  .scope-note { font-size: .74rem; margin-top: 15px; }
  .message { font-size: 1rem; gap: 9px; margin-bottom: 24px; }
  .message-text { line-height: 1.65; }
  .message-author { font-size: .75rem; }
  .from-user { margin-left: 20px; }
  .from-user .message-content { max-width: 100%; padding: 13px 16px; }
  .composer-area { padding: 0 max(12px, env(safe-area-inset-right, 0px)) max(8px, env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px)); }
  .composer { padding: 12px 13px 11px; gap: 10px; border-radius: 15px; }
  .composer textarea { min-height: 55px; max-height: 144px; font-size: 16px; }
  .dictate-button, .composer .send-button { height: 48px; min-height: 48px; padding: 0 15px; font-size: .88rem; }
  .speech-status { margin-top: 8px; font-size: .73rem; line-height: 1.45; }
  .composer-caption { justify-content: space-between; font-size: .68rem; margin-top: 4px; gap: 9px; min-height: 27px; }
  .speech-info { font-size: .68rem; white-space: nowrap; }
  .speech-info summary { padding-top: 9px; padding-bottom: 9px; }
  .speech-info p { right: 12px; bottom: 46px; white-space: normal; width: calc(100% - 24px); }
  .connect-notice { flex-direction: row; align-items: center; gap: 10px; padding: 10px 12px; }
  .connect-notice > button { min-height: 44px; margin: 0; padding: 6px 2px; white-space: normal; line-height: 1.4; text-align: right; }
  .work-status { font-size: .75rem; min-height: 25px; }
  .work-status:empty { min-height: 7px; }
  .toast { top: calc(74px + env(safe-area-inset-top, 0px)); bottom: auto; pointer-events: none; }
  .portal-shell.with-preview ~ .toast { top: calc(124px + env(safe-area-inset-top, 0px)); }
  .keyboard-open .composer-caption { display: none; }
  .keyboard-open > .preview-banner { min-height: 26px; height: 26px; padding: 4px 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .keyboard-open .composer-area { padding-bottom: 8px; }
  .keyboard-open .composer textarea { min-height: 42px; max-height: 90px; }
  .keyboard-open .composer { padding-top: 10px; gap: 7px; }
  .keyboard-open .speech-status { font-size: .7rem; }
}
@media (max-height: 500px) and (orientation: landscape) {
  .chat-topbar { height: 53px; }
  .composer textarea { min-height: 32px; max-height: 64px; }
  .composer { padding: 9px 12px; gap: 4px; }
  .composer-area { padding-bottom: max(4px, env(safe-area-inset-bottom, 0px)); }
  .composer-caption { display: none; }
  .chat-welcome { margin-top: 0; }
  .welcome-symbol { display: none; }
  .chat-welcome h1 { font-size: 1.65rem; }
}
@media (prefers-reduced-motion: reduce) { .speech-status.is-recording::before { animation: none; } }
