/* The top-of-feed card keeps the original input mounted. Its writing and media
   scroll separately from the visible feedback scope and Save action. */
.connected-app .capture.card-composer {
  display: flex;
  flex-direction: column;
  padding-block: 16px;
  max-block-size: min(70dvh, 460px);
  min-block-size: 0;
  flex: 0 1 auto;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e0e5df;
  border-radius: 14px;
  box-shadow: 0 2px 10px #23332c04;
  transition: box-shadow 160ms ease;
}
.connected-app .connected-workspace #workspace .capture.card-composer { padding-inline: 16px; }
.connected-app .capture.card-composer:focus-within {
  border-color: #789484;
  box-shadow: 0 0 0 2px #375a4b0d, 0 3px 14px #23332c06;
}
.connected-app .card-capture-form {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  max-block-size: calc(min(70dvh, 460px) - 34px);
  min-block-size: 0;
  flex: 1 1 auto;
}
.connected-app .composer-draft-area {
  min-width: 0;
  min-block-size: 44px;
  flex: 1 1 auto;
  overflow: auto;
  overscroll-behavior: contain;
}
.connected-app .composer-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  flex: 0 0 auto;
}
.connected-app .card-composer #captureInput {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 80px;
  height: 80px;
  max-height: min(25dvh, 200px);
  padding: 4px 0;
  line-height: 1.625;
  resize: vertical;
}
.connected-app .card-composer #captureInput:focus-visible { outline: none !important; }
.connected-app .card-composer .capture-controls {
  min-width: 0;
  gap: 6px;
  flex-wrap: nowrap;
}
.connected-app .card-composer .capture-controls button { min-height: 44px; padding-inline: 10px; }
.connected-app .card-composer .capture-controls .solid-button {
  min-width: 64px;
  margin-left: auto;
  background: var(--tormie-action, #375a4b);
}
.connected-app .card-composer .capture-controls .solid-button:not(:disabled):hover { background: #2e4d40; }
.connected-app .card-composer .capture-controls tormie-companion,
.connected-app .quiet-message .companion-input-cue tormie-companion { display: none; }
.connected-app .card-composer .capture-controls .composer-mic {
  justify-content: center;
  width: 44px;
  flex: 0 0 44px;
  padding: 0;
  gap: 0;
  font-size: 0;
  color: #425349;
}
.connected-app .composer-mic::before {
  content: '';
  width: 22px;
  height: 22px;
  background: currentColor;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cg fill='none' stroke='black' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='3' width='6' height='12' rx='3'/%3E%3Cpath d='M6 11v1a6 6 0 0 0 12 0v-1M12 18v3m-3 0h6'/%3E%3C/g%3E%3C/svg%3E") center / contain no-repeat;
}
.connected-app .composer-mic[data-recording="true"] { color: var(--tormie-error, #8c413b); }
.connected-app .composer-mic[data-recording="true"]::before { width: 13px; height: 13px; border-radius: 2px; mask: none; }
.connected-app .composer-draft-area > #voicePreview,
.connected-app .composer-draft-area > #attachmentPreview,
.connected-app .composer-draft-area > #captureStatus { min-width: 0; margin-top: 8px; }
.connected-app .composer-draft-area > [hidden] + #captureStatus:empty { margin-top: 0; }
.connected-app .composer-feedback { display: flex; align-items: baseline; gap: 2px 14px; flex-wrap: wrap; }
.connected-app .composer-feedback .ask-option { font-size: 12px; line-height: 1.5; margin: 0; flex-shrink: 0; }
.connected-app .ask-option input { flex: 0 0 auto; min-width: 16px; min-height: 16px; }
.connected-app .ask-option:has(input:disabled) { cursor: default; }
.connected-app .composer-preference-note {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--tormie-muted);
  overflow-wrap: anywhere;
}
.connected-app .quiet-composer .capture-note { min-height: 0; margin: 0; line-height: 1.5; overflow-wrap: anywhere; }
.connected-app .quiet-composer .capture-note:empty,
.connected-app .quiet-message #chatStatus:empty { display: none; }
.connected-app #voicePreview,
.connected-app #attachmentPreview { min-width: 0; max-block-size: min(24dvh, 200px); overflow: auto; overscroll-behavior: contain; overflow-wrap: anywhere; }
.connected-app #voicePreview > a,
.connected-app #voicePreview > button { display: inline-flex; align-items: center; min-height: 36px; margin-right: 6px; font-size: 12px; }
.connected-app #voicePreview > p { font-size: 12px; line-height: 1.5; }
.connected-app .selected-file { min-width: 0; align-items: start; }
.connected-app .selected-file > div { flex: 1; min-width: 0; }
.connected-app .selected-file strong { display: block; white-space: normal; overflow-wrap: anywhere; }
.connected-app .selected-file .muted,
.connected-app .selected-file a { display: block; overflow-wrap: anywhere; font-size: 12px; line-height: 1.5; }
.connected-app .selected-file button { flex: 0 0 auto; min-height: 36px; }
.connected-app #saveCapture:disabled,
.connected-app #sendButton:disabled { opacity: .45; cursor: default; }
.connected-app .chat-input-wrap.quiet-message {
  max-block-size: min(60dvh, 560px);
  min-block-size: 0;
  flex-shrink: 1;
  overflow: auto;
  overscroll-behavior: contain;
}
.connected-app .quiet-message .chat-input { padding-block: 6px; }
.connected-app .quiet-message #chatInput { display: block; width: 100%; min-width: 0; min-height: 40px; height: 40px; padding-block: 7px; line-height: 26px; resize: none; }
.connected-app .quiet-message[data-expanded="true"] #chatInput { min-height: 80px; height: 80px; resize: vertical; }
.connected-app .quiet-message .chat-input-bottom:has(#sendButton[hidden]):has(#chatStatus:empty) { display: none; }
.connected-app .quiet-message .companion-input-cue:has(#chatStatus:empty) { display: none; }
.connected-app .quiet-message .chat-input-bottom { min-width: 0; gap: 10px; }
.connected-app .quiet-message .chat-input-bottom .solid-button { margin-left: auto; min-height: 36px; }
.connected-app .quiet-message #chatStatus { font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.connected-app #transcriptStatus { max-block-size: 18dvh; overflow: auto; overflow-wrap: anywhere; white-space: pre-wrap; }

@media (max-height: 400px) {
  .connected-app .card-composer #captureInput,
  .connected-app .card-composer[data-expanded="true"] #captureInput { min-height: 44px; height: 44px; padding-block: 0; line-height: 1.5; }
  .connected-app .capture.card-composer { padding-block: 6px; }
  .connected-app .card-capture-form { max-block-size: calc(min(70dvh, 460px) - 14px); gap: 4px; }
  .connected-app .composer-actions { gap: 4px; }
}
@media (max-height: 700px) {
  .connected-app .context-tray { max-block-size: none; overflow: visible; }
}
@media (max-width: 600px) {
  .connected-app .capture.card-composer { padding-block: 8px; border-radius: 12px; }
  .connected-app .connected-workspace #workspace .capture.card-composer { padding-inline: 12px !important; }
  .connected-app .card-capture-form { gap: 4px; max-block-size: calc(min(70dvh, 460px) - 18px); }
  .connected-app .card-composer #captureInput { min-height: 44px; height: 44px; padding-block: 2px; line-height: 1.5; resize: none; }
  .connected-app .card-composer[data-expanded="true"] #captureInput { min-height: 76px; height: 76px; }
  .connected-app .card-composer .capture-controls { gap: 4px; }
  .connected-app .quiet-composer .capture-controls button { font-size: 12px; }
  .connected-app .quiet-composer .capture-controls .composer-mic { font-size: 0; }
  .connected-app .composer-feedback { row-gap: 2px; }
  .connected-app .selected-file { gap: 8px; flex-wrap: wrap; }
  .connected-app .selected-file > div { min-width: min(150px, 100%); }
  .connected-app .selected-file button { margin-left: auto; }
}
@media (max-width: 600px) and (max-height: 400px) {
  .connected-app .capture.card-composer { padding-block: 6px; }
  .connected-app .card-capture-form { max-block-size: calc(min(70dvh, 460px) - 14px); }
  .connected-app .card-composer[data-expanded="true"] #captureInput { min-height: 44px; height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  .connected-app .quiet-composer *, .connected-app .quiet-message * { transition: none; scroll-behavior: auto; }
}

@media (min-width: 900px) and (pointer: fine) {
  .connected-app #captureInput,
  .connected-app .chat-input textarea { font-size: var(--tormie-text-body); }
}
/* Give optional tools readable weight without adding another primary action. */
.connected-app .card-composer .capture-controls { border-top: 1px solid #edf0eb; padding-top: 8px; }
.connected-app .card-composer #addFiles { display: inline-flex; align-items: center; gap: 7px; color: #425349; font-size: 14px; }
.connected-app .card-composer #addFiles::before { content: ""; width: 18px; height: 18px; background: currentColor; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m8 13 6-6a3 3 0 0 1 4 4l-8 8a5 5 0 0 1-7-7l9-9' fill='none' stroke='black' stroke-width='1.7' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat; }
.connected-app .composer-feedback .ask-option { color: #425349; font-size: 13px; }
.connected-app .composer-preference-note { color: #59665f; }
@media (max-height: 400px) {
  .connected-app .card-composer .capture-controls { padding-top: 0; border-top: 0; }
}
