/* A consistent, quiet writing surface for short notes and long forms. */
dialog.modal:has(.text-form) { width: min(680px, calc(100vw - 32px)); max-width: 1000px; max-height: calc(100dvh - 40px); padding: 34px; border: 1px solid #dfd2dd; border-radius: 22px; background: #fcf9f6; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #d2c0ce transparent; scroll-padding: 80px 20px; }
dialog.modal:has(.text-form)::backdrop { background: #44384470; backdrop-filter: blur(5px); }
dialog.modal:has(.text-form) > .modal-close { position: sticky; top: 0; float: right; z-index: 8; display: grid; place-items: center; width: 32px; height: 32px; margin: -14px -14px 0 0; border-radius: 50%; background: #eee6eb; color: #80687c; }
dialog.modal:has(.text-form) h2 { padding-right: 28px; font-weight: 500; line-height: 1.5; }
.text-form { --form-accent: #816487; --form-line: #ddd0dc; }
#modal form.text-form { max-height: none; overflow: visible; }
.text-form label { line-height: 1.65; }
.text-form .field { min-height: 44px; border: 1px solid var(--form-line); border-radius: 10px; padding: 11px 13px; background: #fffdfb; color: #574856; font: 14px/1.65 var(--font-sans, sans-serif); transition: border-color .15s, box-shadow .15s; }
.text-form .field:focus { border-color: #a184a6; box-shadow: 0 0 0 3px #a184a619; }
.text-form .field::placeholder { color: #b2a2ad; }
.text-form .btn { background: #87668e; border-color: #87668e; color: #fff; }
.text-form .btn:hover { background: #75567e; }
.text-form .field[aria-invalid="true"] { border-color: #b46579; }
.text-form textarea.field { display: block; min-height: 108px; max-height: 420px; resize: vertical; overflow-y: auto; scrollbar-width: thin; }
.text-form textarea[hidden], .text-form .field-meter[hidden] { display: none; }
.field-meter { display: block; margin: 4px 3px 8px; color: #aa99a6; text-align: right; font: 10px/1.5 var(--font-sans, sans-serif); font-variant-numeric: tabular-nums; }
.field-meter.is-near-limit { color: #a46274; }
.form-submit-row { position: sticky; bottom: 0; z-index: 4; display: flex; flex-direction: column; align-items: stretch; gap: 7px; margin: 22px -4px -4px; padding: 14px 4px 8px; border-top: 1px solid #e6dce4; background: #fcf9f6f5; backdrop-filter: blur(8px); }
.text-form .form-submit-row .btn { width: 100%; min-height: 45px; margin: 0; border-radius: 10px; font-size: 13px; }
.form-shortcut { color: #ad9ba9; text-align: center; font-size: 10px; }
.text-form .btn:disabled { cursor: wait; opacity: .7; }
.text-form .is-pending::before { content: ''; display: inline-block; width: 11px; height: 11px; margin-right: 8px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: form-spin .8s linear infinite; vertical-align: -1px; }
.text-form .form-error:not(:empty), .text-form .writing-error:not(:empty) { padding: 10px 12px; border-radius: 9px; background: #f8e9ed; color: #9e5065; line-height: 1.7; }
.conversation-reply .form-submit-row { grid-column: 1 / -1; }
@keyframes form-spin { to { transform: rotate(360deg); } }
@media(max-width:600px) {
 dialog.modal:has(.text-form) { width: calc(100vw - 16px); max-height: calc(100dvh - 20px); padding: 25px 18px; border-radius: 18px; }
 .text-form .field { font-size: 16px; }
 .form-submit-row { padding-bottom: max(10px, env(safe-area-inset-bottom)); }
 .form-shortcut { display: none; }
}
@media(prefers-reduced-motion:reduce) { .text-form .field { transition: none; } .text-form .is-pending::before { animation: none; } }
