/* Text chat mode of the conversation panel (owner decision, 2026-11-09). voice.css owns the shared panel. */
.chat-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin: 14px 0 0; padding: 4px; border: 1px solid #d8e0d6; border-radius: 999px; background: #eef3ec; }
.chat-modes button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: #20392e; font: 600 15px/1.3 Inter, system-ui, sans-serif; cursor: pointer; }
.chat-modes [aria-selected="true"] { background: #173c30; color: #fff; }
.voice-panel[data-mode="chat"] { display: flex; flex-direction: column; height: min(660px, calc(100dvh - 112px)); overflow: hidden; }
.chat-mode { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.chat-thread { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 10px; padding: 16px 2px 8px; }
.chat-msg { max-width: 86%; margin: 0; padding: 10px 14px; border-radius: 16px; color: #20392e; font-size: 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg.bot { align-self: flex-start; background: #eff5ec; border-end-start-radius: 4px; }
.chat-msg.user { align-self: flex-end; background: #173c30; color: #fff; border-end-end-radius: 4px; }
.chat-msg.system { align-self: center; max-width: 100%; padding: 2px 8px; background: none; color: #526958; font-size: 13px; text-align: center; }
.chat-typing { display: flex; gap: 5px; align-self: flex-start; padding: 12px 14px; border-radius: 16px; border-end-start-radius: 4px; background: #eff5ec; }
.chat-typing span { width: 7px; height: 7px; border-radius: 50%; background: #6d9d72; animation: chat-typing 1s infinite alternate; }
.chat-typing span:nth-child(2) { animation-delay: .2s; } .chat-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes chat-typing { from { opacity: .3; } to { opacity: 1; } }
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 0 12px; }
.chat-chips button { border: 1px solid #b3c5b6; border-radius: 999px; background: #fff; color: #285b43; padding: 8px 13px; font: 500 14px/1.3 Inter, system-ui, sans-serif; cursor: pointer; }
.chat-chips button:hover { background: #eef3ec; }
.chat-composer { display: flex; align-items: flex-end; gap: 8px; padding: 6px 6px 6px 14px; border: 1px solid #9eafa1; border-radius: 16px; background: #fff; }
.chat-composer:focus-within { border-color: #4e8063; }
.chat-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
#chat-input { flex: 1; min-height: 40px; max-height: 120px; padding: 9px 0; border: 0; outline: 0; resize: none; background: transparent; color: #20392e; font: 15px/1.45 Inter, system-ui, sans-serif; }
#chat-input::placeholder { color: #79837c; }
.chat-composer button { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border: 1px solid #173c30; border-radius: 12px; background: #173c30; color: #fff; cursor: pointer; }
.chat-composer button.ghost { border-color: #b3c5b6; background: transparent; color: #173c30; }
.chat-composer button:disabled { opacity: .45; cursor: wait; }
.chat-note { margin: 10px 0 0; color: #526958; font-size: 12px; line-height: 1.4; }
.chat-note a { color: #285b43; }
#chat-status { margin: 8px 0 0; color: #7f3520; font-size: 13px; text-align: center; }
#chat-status:empty { display: none; }
.chat-fallback { margin-top: 12px; display: flex; justify-content: center; }
.chat-fallback button { display: inline-flex; align-items: center; gap: 8px; border: 1px solid #b3c5b6; border-radius: 999px; background: #fff; color: #173c30; padding: 10px 16px; font: 600 15px/1.3 Inter, system-ui, sans-serif; cursor: pointer; }
.chat-expand { display: none; }
@media (prefers-reduced-motion: reduce) { .chat-typing span { animation: none; } }
@media (max-width: 520px) {
  .voice-panel[data-mode="chat"] { inset: 64px 8px 74px 8px; width: auto; height: auto; max-height: none; padding: 16px; }
  .chat-modes { margin-top: 10px; }
  /* Compact sheet after a navigation: the opened page stays visible above the last reply and the composer. */
  .voice-panel[data-mode="chat"][data-size="compact"] { inset: auto 8px 8px 8px; height: 40dvh; padding: 6px 14px 12px; }
  .voice-panel[data-size="compact"] > header, .voice-panel[data-size="compact"] .chat-modes, .voice-panel[data-size="compact"] .chat-chips, .voice-panel[data-size="compact"] .chat-note { display: none; }
  .voice-panel[data-size="compact"] .chat-expand { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; padding: 4px 0 6px; border: 0; background: transparent; color: #526958; font: 500 12px/1.2 Inter, system-ui, sans-serif; cursor: pointer; }
  .chat-expand span { display: block; width: 44px; height: 5px; border-radius: 3px; background: #c9d6c9; }
  .voice-panel[data-size="compact"] .chat-thread { padding-top: 4px; }
}
