/* Scoped to the global writer: does not affect received emails or other dialogs. */
.mori-email-compose {
  width: min(1500px, 96vw) !important;
  max-width: min(1500px, 96vw) !important;
  height: 94dvh;
  max-height: 96dvh;
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: var(--background);
  color: var(--foreground);
}
.mori-email-compose[data-fullscreen="true"] {
  top: 0 !important;
  left: 0 !important;
  transform: none !important;
  translate: none !important;
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100dvh;
  max-height: 100dvh;
  border: 0;
  border-radius: 0;
}
.mori-email-compose .email-compose-header {
  padding: max(12px, env(safe-area-inset-top)) 52px 12px 20px;
}
.mori-email-compose .email-compose-main {
  position: relative;
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}
.mori-email-compose .email-compose-writing {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow-y: auto;
}
.mori-email-compose .email-compose-editor {
  display: flex;
  flex-direction: column;
  flex: 1 0 360px;
  min-height: clamp(320px, 45dvh, 640px);
  padding: 20px 24px;
}
.mori-email-compose .email-compose-text {
  flex: 1;
  min-height: 280px;
  height: 100%;
  font-size: 16px;
  line-height: 1.7;
  overflow-y: auto;
  field-sizing: fixed;
}
.mori-email-compose .email-compose-extra {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.mori-email-compose .email-compose-extra > summary {
  padding: 12px 24px;
  cursor: pointer;
  color: var(--muted-foreground);
  font-size: 13px;
}
.mori-email-compose .email-compose-extra-content {
  max-height: 32dvh;
  overflow-y: auto;
}
.mori-email-compose .email-compose-options {
  width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 16px;
  border-left: 1px solid var(--border);
  background: var(--card);
  color: var(--card-foreground);
}
.mori-email-compose .email-compose-options[hidden] { display: none; }
.mori-email-compose .email-compose-actions {
  max-height: 140px;
  overflow-y: auto;
  padding: 10px 20px max(10px, env(safe-area-inset-bottom));
}
@media (max-width: 767px) {
  .mori-email-compose {
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
  }
  .mori-email-compose .email-compose-header { padding-left: 12px; gap: 4px; }
  .mori-email-compose .email-compose-header > svg { display: none; }
  .mori-email-compose .email-compose-editor { padding: 16px; }
  .mori-email-compose .email-compose-options {
    position: absolute;
    inset: 0 0 0 auto;
    z-index: 20;
    width: min(340px, 100%);
    box-shadow: -6px 0 24px #0002;
  }
  .mori-email-compose .email-compose-actions { gap: 6px; padding-left: 12px; padding-right: 12px; }
}
.document-rich-page { width: 100%; min-width: 0; overflow-wrap: anywhere; }
.document-rich-page .tiptap { color: #0f172a; background: #fff; line-height: 1.65; }
.document-rich-page .tiptap p, .document-rich-view p { margin: .7em 0; }
.document-rich-page img { display: block; max-width: 100%; height: auto; margin: 1em auto; }
.document-rich-page table { width: 100%; table-layout: fixed; border-collapse: collapse; margin: 1em 0; }
.document-rich-page td, .document-rich-page th { border: 1px solid #cbd5e1; padding: .4em; min-width: 0; vertical-align: top; }
.document-rich-page th { background: #f1f5f9; font-weight: 600; }
.document-rich-page [data-type="page-break"] { border-top: 2px dashed #94a3b8; margin: 2em 0; min-height: 1.5em; position: relative; }
.document-rich-page [data-type="page-break"]::after { content: "Salto de página"; display: block; color: #64748b; font: 11px sans-serif; text-align: center; }
@media print {
  .document-rich-page [data-type="page-break"] { break-after: page; page-break-after: always; border: 0; margin: 0; min-height: 0; }
  .document-rich-page [data-type="page-break"]::after { display: none; }
  .document-rich-page img, .document-rich-page tr { break-inside: avoid; }
}
