/* One-click reply assistance stays next to the draft, without a modal overlay. */
.ai-composer-open, .ai-composer-edit-toggle, .ai-composer-undo {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 34px; max-width: 100%; padding: 6px 9px; border: 1px solid #dce4fa; border-radius: 8px;
  background: #f2f5ff; color: #3155b5; font: inherit; font-size: 12px; font-weight: 600;
  line-height: 1.3; white-space: nowrap; cursor: pointer;
}
.ai-composer-open svg { width: 16px; height: 16px; flex: 0 0 auto; }
.ai-composer-edit-toggle { padding-inline: 8px; color: #5a6a82; border-color: #e1e7ef; background: #fff; }
.ai-composer-edit-toggle svg { width: 14px; height: 14px; flex: 0 0 auto; }
.ai-composer-open:hover:not(:disabled), .ai-composer-open[aria-expanded="true"] { background: #e9efff; border-color: #b2c3f6; }
.ai-composer-edit-toggle:hover:not(:disabled), .ai-composer-edit-toggle[aria-expanded="true"] { background: #f4f7fc; border-color: #becceb; }
.ai-composer-undo { padding-inline: 7px; border-color: transparent; background: transparent; font-weight: 500; }
.ai-composer-undo:hover { background: #f2f5fc; }
.ai-composer-undo[hidden] { display: none; }
.ai-composer-open:disabled, .ai-composer-edit-toggle:disabled { opacity: .5; cursor: default; }
.ai-composer-notice { min-width: 0; color: #5c6d86; font-size: 11px; line-height: 1.45; overflow-wrap: anywhere; }
.ai-composer-notice:empty { display: none; }
.ai-composer-open:focus-visible, .ai-composer-edit-toggle:focus-visible, .ai-composer-undo:focus-visible,
.ai-composer-panel button:focus-visible, .ai-composer-panel a:focus-visible,
.ai-composer-edit-menu button:focus-visible, .ai-composer-result-text:focus-visible {
  outline: 3px solid #8ea9fa; outline-offset: 2px;
}

.ai-composer-panel, .ai-composer-edit-menu {
  position: fixed; inset: auto; margin: 0; z-index: 1100;
  min-width: 0; max-width: calc(100vw - 16px); padding: 0;
  border: 1px solid #dbe4f3; border-radius: 13px; background: #fff; color: #243148;
  box-shadow: 0 12px 36px #243d6726, 0 2px 8px #243d6710;
  overscroll-behavior: contain;
}
.ai-composer-panel { width: min(400px, calc(100vw - 16px)); max-height: 320px; overflow: hidden; }
.ai-composer-panel:not([hidden]) { display: flex; flex-direction: column; }
.ai-composer-panel::backdrop, .ai-composer-edit-menu::backdrop { background: transparent; pointer-events: none; }
.ai-composer-panel *, .ai-composer-panel *::before, .ai-composer-panel *::after,
.ai-composer-edit-menu * { box-sizing: border-box; }
.ai-composer-panel[hidden], .ai-composer-panel [hidden], .ai-composer-edit-menu[hidden] { display: none; }
.ai-composer-header {
  display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 8px;
  padding: 5px 8px 5px 14px; border-bottom: 1px solid #e9eef6;
}
.ai-composer-header h3 { min-width: 0; margin: 0; color: #3a537c; font-size: 12px; font-weight: 650; line-height: 1.4; }
.ai-composer-close {
  display: grid; place-items: center; flex: 0 0 auto; width: 32px; height: 32px;
  padding: 0; border: 0; border-radius: 8px; color: #6b7c94; background: transparent; cursor: pointer;
}
.ai-composer-close svg { width: 18px; height: 18px; }
.ai-composer-close:hover { background: #f0f4fa; color: #3155b5; }
.ai-composer-content { min-height: 0; min-width: 0; padding: 12px 14px; overflow: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.ai-composer-results { min-width: 0; }
.ai-composer-results:empty { display: none; }
.ai-composer-result { min-width: 0; }
.ai-composer-result-text {
  min-width: 0; margin: 0; padding: 1px; color: #27364c; font-size: 14px; line-height: 1.75;
  white-space: pre-wrap; overflow-wrap: anywhere; text-align: start;
}
.ai-composer-result-text:dir(rtl) { line-height: 1.9; }
.ai-composer-status, .ai-composer-error, .ai-composer-setup { margin: 0; font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.ai-composer-status { color: #617792; }
.ai-composer-status:empty { display: none; }
.ai-composer-status[data-ready="true"] {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.ai-composer-error { color: #983d4c; }
.ai-composer-setup { color: #617595; }
.ai-composer-setup a { color: #3155b5; text-underline-offset: 3px; }
.ai-composer-limit { margin: 10px 0 0; color: #9b4e31; font-size: 12px; line-height: 1.5; }
.ai-composer-footer {
  display: flex; flex: 0 0 auto; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-top: 1px solid #e9eef6; background: #fbfcff;
}
.ai-composer-retry, .ai-composer-apply {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px;
  max-width: 100%; padding: 7px 10px; border: 1px solid #dce4f1; border-radius: 8px;
  color: #556b8d; background: #fff; font: inherit; font-size: 12px; line-height: 1.3; font-weight: 600; cursor: pointer;
}
.ai-composer-retry svg { width: 16px; height: 16px; flex: 0 0 auto; }
.ai-composer-retry:hover:not(:disabled) { background: #f1f5ff; border-color: #b5c6f8; color: #244ecd; }
.ai-composer-apply { margin-inline-start: auto; border-color: #315efb; color: #fff; background: #315efb; }
.ai-composer-apply:hover:not(:disabled) { background: #244bd8; border-color: #244bd8; }
.ai-composer-panel button:disabled, .ai-composer-edit-menu button:disabled { opacity: .5; cursor: default; }
.ai-composer-edit-menu { width: 216px; padding: 5px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.ai-composer-edit-menu:not([hidden]) { display: block; }
.ai-composer-edit-menu button {
  display: block; width: 100%; min-height: 37px; padding: 9px 11px; border: 0; border-radius: 7px;
  color: #425876; background: transparent; font: inherit; font-size: 12px; line-height: 1.4; text-align: start; cursor: pointer;
}
.ai-composer-edit-menu button:hover:not(:disabled), .ai-composer-edit-menu button:focus-visible { background: #eef3ff; color: #3155b5; }
.internal-composer.ai-enabled { flex-direction: column; align-items: stretch; min-width: 0; flex: 0 0 auto; }
.ai-composer-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.internal-compose-main { display: flex; align-items: flex-end; gap: 12px; min-width: 0; }
.internal-compose-main > textarea { width: 100%; }
.internal-compose-main > .send-button { flex: 0 0 auto; }
.reply-composer .reply-composer-bar { gap: 6px; }

@media (max-width: 1199px) {
  .ai-composer-open, .ai-composer-edit-toggle, .ai-composer-undo,
  .ai-composer-panel button, .ai-composer-edit-menu button { min-height: 44px; }
  .ai-composer-close { width: 44px; height: 44px; }
  .ai-composer-result-text { font-size: 16px; }
}
@media (max-width: 760px) {
  .ai-composer-header { padding: 2px 5px 2px 12px; }
  .ai-composer-content { padding: 10px 12px; }
  .ai-composer-footer { padding: 5px 8px; }
  .internal-compose-main { gap: 8px; }
  .mobile-workspace .internal-composer.ai-enabled { gap: 6px; max-height: min(60dvh, calc(var(--workspace-viewport-height, 100dvh) * .52)); overflow-y: auto; }
  .mobile-workspace .reply-composer-bar > .ai-composer-notice { flex-basis: 100%; }
}
@media (max-width: 380px) {
  .reply-composer .reply-picker-open { padding-inline: 7px; }
  .ai-composer-open { padding-inline: 7px; }
  .ai-composer-edit-toggle { padding-inline: 6px; }
  .reply-composer .reply-composer-bar { gap: 4px; }
}
@media (max-width: 760px) and (max-height: 520px) {
  .mobile-workspace .reply-composer-bar > .ai-composer-notice:not(:empty) { display: inline; }
}
