/* Chat and Memory tab styles (owned by the chat/memory modules). Adds to
   styles.css; redefines nothing there. All dynamic values go through
   element.style in code (the textarea's height), never a style attribute. */

/* Chat: a column that fills the tab so the composer sits at the bottom even
   with a short transcript; the document scrolls when it grows. */
.chat { display: flex; flex-direction: column; min-height: calc(100dvh - var(--tab-h) - env(safe-area-inset-bottom) - 140px); }
.chat .page-head { margin-bottom: 8px; }
.chat-list { display: flex; flex-direction: column; gap: 10px; flex: 1; padding-bottom: 8px; }
.chat-turn { display: flex; flex-direction: column; gap: 2px; max-width: 85%; }
.chat-turn.user { align-self: flex-end; align-items: flex-end; }
.chat-turn.assistant { align-self: flex-start; align-items: flex-start; }
.chat-bubble { padding: 9px 14px; border-radius: 18px; background: var(--bg-elev); border: 1px solid var(--line); white-space: pre-wrap; word-break: break-word; }
.chat-turn.user .chat-bubble { background: var(--accent); color: var(--accent-fg); border-color: transparent; }
.chat-time { padding: 0 6px; }
.chat-thinking { display: flex; align-items: center; gap: 8px; color: var(--fg-muted); font-size: 0.86rem; padding: 4px 2px; }
.empty-title { font-weight: 650; color: var(--fg); margin-bottom: 4px; }

/* Composer: sticky above the tab bar on the phone, above the page's end on
   the wide layout where the tabs live in the sidebar. */
.chat-composer {
  position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
  padding: 8px 0 6px; background: var(--bg);
}
@media (min-width: 900px) { .chat-composer { bottom: 0; } }
.chat-compose-row { align-items: flex-end; }
.chat-input { flex: 1; min-height: 42px; max-height: 160px; resize: none; overflow-y: auto; line-height: 1.35; }
.chat-hint { text-align: right; }
@media (hover: none) { .chat-hint { display: none; } }
.chat-error:empty { display: none; }

/* Hold-to-talk */
.chat-voice { display: flex; flex-direction: column; gap: 4px; }
.chat-talk {
  min-height: 46px; padding: 8px 18px; border-radius: 999px;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.chat-talk.active { background: var(--bad); color: #fff; border-color: transparent; }
.chat-voice-live { min-height: 1.3em; color: var(--fg-muted); font-size: 0.9rem; font-style: italic; }
.chat-voice-live:empty { display: none; }
.chat-voice-status { color: var(--warn); }

/* Memory */
.memory-proposal .memory-doc { font-size: 1rem; }
.memory-diff { max-height: 320px; overflow: auto; font-size: 0.8rem; line-height: 1.4; }
.memory-diff .diff-line.add { color: var(--ok); }
.memory-diff .diff-line.del { color: var(--bad); }
.memory-diff .diff-line.ctx { color: var(--fg-muted); }
.memory-interview-log { flex: 0 0 auto; }
.memory-interview-log .chat-turn { max-width: 100%; }
