/* Keep draft and skill hosts intact while sharing a single composer toolbar. */
.task-chat-composer.continue-form {
  min-width: 0;
  padding: var(--space-4);
  margin-top: var(--space-4);
  background: var(--surface);
}
.task-chat-composer.continue-form textarea {
  min-height: 96px;
  padding: 0 0 var(--space-3);
  font-size: 14px;
}
.task-chat-toolbar {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding-top: var(--space-3);
  border-top: 1px solid var(--line);
}
.task-chat-toolbar > [data-task-inputs],
.task-chat-toolbar .task-input-tools,
.task-chat-toolbar > .skill-control { display: contents; }
.task-input-tools > :is(button, label),
.task-chat-toolbar .capability-toolbar { order: 10; }
.task-input-tools .button,
.task-chat-toolbar .skill-toggle {
  flex-shrink: 0;
  min-height: 40px;
  padding: var(--space-2);
}
.task-input-tools > [data-task-model-refresh] {
  flex: 0 0 40px;
  width: 40px;
  padding: 0;
}
.task-input-model,
.task-input-effort {
  display: block;
  min-width: 0;
  margin: 0;
}
.task-input-model { flex: 1 1 176px; max-width: 260px; min-width: 128px; }
.task-input-effort { flex: 0 0 120px; }
.task-input-tools select {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 40px;
  padding: var(--space-2);
  font-size: 13px;
  text-overflow: ellipsis;
  background-color: var(--surface);
}
.task-chat-toolbar .task-chat-actions {
  order: 10;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  align-items: center;
  gap: var(--space-2);
  margin: 0 0 0 auto;
}
.task-chat-toolbar .task-send-mode { flex: 0 0 80px; min-width: 0; margin: 0; }
.task-chat-toolbar .task-send-mode select {
  min-height: 40px;
  padding: var(--space-2);
  font-size: 13px;
}
.task-chat-toolbar .task-chat-actions .button { min-width: 80px; min-height: 40px; }
.task-chat-toolbar :is(select, button, input):focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.task-chat-composer .task-chat-hint {
  margin: var(--space-2) 0 0;
  color: var(--secondary);
  font-size: 12px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.task-input-custom {
  order: 20;
  flex: 1 0 100%;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  margin: 0;
  font-size: 12px;
  color: var(--secondary);
}
.task-chat-toolbar .capability-chips {
  order: 30;
  flex: 1 0 100%;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  min-width: 0;
}
.task-chat-toolbar .capability-chips:empty { display: none; }
.task-chat-toolbar .capability-chip > button:first-child { min-width: 0; }
.task-chat-toolbar .capability-picker:not(dialog) { bottom: calc(100% + var(--space-2)); }
.task-chat-toolbar .task-input-status {
  order: 40;
  flex: 1 0 100%;
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}
.task-input-status.is-error { color: var(--red); }
.task-input-files,
.task-message-files { display: flex; flex-wrap: wrap; gap: var(--space-2); min-width: 0; }
.task-input-files { order: 0; flex: 1 0 100%; }
.task-input-file {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  max-width: 100%;
  padding: var(--space-1) var(--space-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
.task-input-file > img { width: 40px; height: 40px; object-fit: cover; border-radius: 4px; }
.task-input-file > span { min-width: 0; overflow-wrap: anywhere; font-size: 12px; }
.task-input-file > .icon { flex-shrink: 0; }
.task-input-file .button { flex-shrink: 0; padding: var(--space-1); min-height: 40px; }
.task-message-files { margin: var(--space-2) 0; white-space: normal; }
.task-message-files .button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; text-align: left; }
.task-message-files .task-message-image {
  display: inline-flex;
  min-width: 96px;
  max-width: min(280px, 100%);
  min-height: 80px;
  padding: var(--space-1);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  overflow: hidden;
}
.task-message-image img { display: block; max-width: 100%; max-height: 200px; width: auto; height: auto; object-fit: contain; border-radius: 4px; }
.task-message-image [data-task-image-status] { padding: var(--space-3); font-size: 12px; color: var(--secondary); }
.task-input-selection { display: block; color: var(--secondary); margin-top: var(--space-1); overflow-wrap: anywhere; }
.task-input-drag { outline: 2px solid var(--blue); outline-offset: 4px; }
.task-attachment-preview.app-modal {
  width: min(1000px, calc(100vw - 32px));
  max-height: calc(100dvh - 48px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--ink);
  background: var(--surface);
  overflow: hidden;
}
.task-attachment-preview.app-modal .dialog-head { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--line); }
.task-attachment-preview.app-modal h2 { flex: 1; font-size: 16px; line-height: 1.6; overflow-wrap: anywhere; min-width: 0; margin: 0; }
.task-attachment-preview.app-modal .dialog-head .icon-button { flex: none; width: var(--control-height); height: var(--control-height); }
.task-attachment-preview.app-modal .task-attachment-content { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; flex: 1 1 auto; min-width: 0; min-height: 80px; margin: 0; padding: var(--space-4); background: var(--bg); overflow: auto; overscroll-behavior: contain; }
.task-attachment-preview.app-modal .task-attachment-content.image-zoom-viewport { height: min(65dvh, 680px); min-height: 220px; padding: 0; overflow: hidden; }
.task-attachment-content img { display: block; max-width: 100%; max-height: 65dvh; width: auto; height: auto; object-fit: contain; margin: auto; }
.task-attachment-content pre { width: 100%; min-width: 0; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.task-attachment-preview.app-modal .dialog-foot { padding: var(--space-3) var(--space-4); }
.task-attachment-preview.app-modal .dialog-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); flex-wrap: wrap; }
.task-attachment-preview::backdrop { background: var(--backdrop, rgba(0, 0, 0, .35)); }

@media (max-width: 650px) {
  .task-chat-composer.continue-form { padding: var(--space-3); }
  .task-input-tools .button,
  .task-input-tools select,
  .task-chat-toolbar .skill-toggle,
  .task-input-file .button,
  .task-chat-toolbar .task-send-mode select,
  .task-chat-toolbar .task-chat-actions .button { min-height: 44px; }
  .task-input-model { flex: 1 1 100%; max-width: none; min-width: 0; }
  .task-input-tools:has(.task-input-effort) .task-input-model { flex-basis: calc(100% - 112px); }
  .task-input-effort { flex: 0 0 104px; }
  .task-input-tools > [data-task-pick],
  .task-input-tools > [data-task-model-refresh],
  .task-chat-toolbar .capability-toolbar { order: 20; }
  .task-input-tools > [data-task-model-refresh] { flex-basis: 44px; width: 44px; }
  .task-chat-toolbar .task-chat-actions {
    order: 30;
    flex: 1 0 100%;
    justify-content: flex-end;
    margin: 0;
  }
  .task-input-custom { order: 40; }
  .task-chat-toolbar .capability-chips { order: 50; }
  .task-chat-toolbar .task-input-status { order: 60; }
  .task-message-files .button { min-height: 44px; }
  .task-attachment-preview.app-modal .dialog-head .icon-button { width: var(--touch-control-height); height: var(--touch-control-height); }
  .task-attachment-preview.app-modal .task-attachment-content { padding: var(--space-3); }
}
