/* Dialog geometry overrides the original side panel at every breakpoint. */
.chat-dialog {
  position:fixed; inset:0; margin:auto; width:60vw; max-width:none;
  height:min(820px,88vh); height:min(820px,88dvh); max-height:none;
}
.chat-heading,.chat-dialog form,.chat-note,.voice-status { flex-shrink:0; }
.chat-messages { min-height:0; overscroll-behavior:contain; scroll-behavior:auto; }
.chat-dialog textarea { flex:1; min-width:0; font-size:15px; line-height:1.5; }
.chat-actions { display:flex; gap:8px; align-items:center; }
.chat-actions button { width:44px; height:44px; flex-shrink:0; }
.chat-actions svg { width:21px; height:21px; }
.chat-actions #chat-voice { background:#ffffffa6; color:#5c71ce; border:1px solid #fff; border-radius:12px; }
button[aria-pressed="true"]#chat-voice,button[aria-pressed="true"]#voice { background:#fce2e7; color:#bd385d; box-shadow:0 0 0 3px #c64e751a; }
.voice-status { margin:8px 22px 0; color:#5a6280; font-size:12px; line-height:1.5; }
.voice-status[hidden] { display:none; }
html:has(#chat-dialog[open]),body:has(#chat-dialog[open]) { overflow:hidden; }
.pwa-install-help { line-height:1.7; color:#69728b; }
.pwa-install-help p { margin:8px 0; }
@media(max-width:700px), (hover:none) and (pointer:coarse) {
  .chat-dialog {
    inset:var(--chat-viewport-top,0px) 0 auto; margin:0;
    width:100%; height:100vh; height:var(--chat-viewport-height,100dvh);
    max-width:100%; max-height:none; border:0; border-radius:0;
    padding:env(safe-area-inset-top,0px) env(safe-area-inset-right,0px) 0 env(safe-area-inset-left,0px);
  }
  .chat-heading { padding:18px 16px; }
  .chat-heading .eyebrow { font-size:8px; }
  .chat-heading h2 { font-size:21px; margin-top:7px; }
  .chat-heading>button { width:44px; height:44px; }
  .chat-messages { padding:16px; gap:14px; }
  .chat-messages .message { font-size:14px; line-height:1.65; }
  .chat-dialog form { margin:10px 12px 0; gap:8px; align-items:flex-end; }
  .chat-dialog textarea { font-size:16px; min-height:88px; max-height:150px; }
  .chat-actions { flex-direction:column; gap:6px; }
  .chat-actions button { width:42px; height:42px; }
  .voice-status { margin:8px 14px 0; font-size:11px; }
  .chat-note { font-size:10px; padding:10px 12px calc(12px + env(safe-area-inset-bottom,0px)); }
  .command .magic { display:none; }
  .command #voice { display:inline-flex; align-items:center; justify-content:center; min-width:36px; }
  @media(display-mode:standalone) {
    .topbar { padding-top:calc(12px + env(safe-area-inset-top,0px)); }
    .sidebar { padding-bottom:calc(12px + env(safe-area-inset-bottom,0px)); }
  }
}
