/* The letter step is for writing. Finished letters live in Review. */
/* Write (6 October): one toolbar row, the letter as one sheet of paper, and nothing else above it. */
.writing-workspace-focused .editor-toolbar { gap: 20px; padding-inline: 28px; }
.writing-workspace-focused .editor-toolbar-end { gap: 22px; }
.writing-workspace-focused .editor-toolbar-end .editor-tool { font-size: 13px; }
.writing-workspace-focused .editor-toolbar-end .editor-save-status { font-size: 13px; min-width: 52px; text-align: right; }
.writing-workspace-focused .editor-tool[aria-expanded="true"] { color: var(--ink); }
.writing-workspace-focused .editor-main { padding: 24px 32px 32px; background: var(--subtle); }
.writing-workspace-focused .editor-preview { min-width: 0; padding: 24px 32px 32px 0; background: var(--subtle); }
.writing-workspace-focused .editor-preview[hidden] { display: none; }
/* The Write preview is for checking the filled-in text; Full letter/Close-up stay in Review. */
.writing-workspace-focused .editor-preview .handwriting-views { display: none; }
.writing-workspace-focused .editor-preview .letter-review-stage { height: clamp(300px, calc(100dvh - 400px), 680px); }
.writing-workspace-focused .editor-assistance[hidden], .writing-workspace-focused .editor-recipient-context[hidden] { display: none; }
/* "+ Personalise": a quiet outlined button that opens the list's columns, with example values. */
.writing-workspace-focused .editor-insert-field { width: auto; }
.writing-workspace-focused .editor-insert-field .select-trigger { min-height: 34px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--paper); color: var(--ink); font-size: 13px; }
.writing-workspace-focused .editor-insert-field .select-trigger:hover:not(:disabled) { border-color: #cfcfcf; background: var(--subtle); }
.writing-workspace-focused .editor-insert-field .select-trigger > span[aria-hidden] { display: none; }
.writing-workspace-focused .editor-insert-field .select-menu { width: 290px; }
.editor-insert-field [role="option"] small, .editor-token-menu [role="option"] small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-token-menu { position: fixed; min-width: 0; z-index: 60; }
/* Above the sheet only when one person's letter is open, or some letters are adjusted. */
.editor-scope { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; max-width: 760px; margin: 0 0 12px; color: var(--muted); font-size: 13px; }
.editor-scope[hidden] { display: none; }
.editor-scope b { color: var(--ink); font-weight: 500; }
.editor-scope .text-link { font-size: 13px; }
.editor-scope .editor-quiet { color: var(--muted); }
.editor-tag { padding: 1px 8px; border-radius: 999px; background: #f5ecd9; color: #6b5320; font-size: 12px; }
/* The sheet: the text sits in a transparent textarea over a copy that draws personal details as labels.
   Both share every measure that affects line breaks, so the caret and the labels stay aligned. */
.editor-sheet { position: relative; max-width: 760px; padding: 48px 56px 56px; border: 1px solid #e6e6e6; border-radius: 4px; background: var(--paper); box-shadow: 0 10px 30px #0000000d; }
.editor-sheet:focus-within { border-color: #d9d9d9; }
.editor-sheet textarea, .editor-highlights { display: block; width: 100%; margin: 0; padding: 0; border: 0; font-family: inherit; font-size: 16px; font-weight: 400; line-height: 1.75; letter-spacing: normal; white-space: pre-wrap; overflow-wrap: break-word; word-break: normal; tab-size: 4; }
.editor-highlights { position: absolute; inset: 48px 56px 56px; width: auto; color: var(--ink); pointer-events: none; overflow: hidden; }
.editor-sheet textarea { position: relative; z-index: 1; min-height: 320px; resize: none; overflow: hidden; border-radius: 0; background: transparent; color: transparent; caret-color: var(--ink); box-shadow: none; outline: 0; }
.editor-sheet textarea:focus, .editor-sheet textarea:focus-visible { border: 0; box-shadow: none; outline: 0; }
.editor-sheet textarea::placeholder { color: #8a8a8a; }
.editor-sheet textarea::selection { background: #1111111f; color: transparent; }
.editor-sheet textarea[readonly] { cursor: default; }
.editor-token { border-radius: 5px; background: #e9ecf1; color: #26303d; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.editor-token.is-unknown { background: #fbe3e1; color: #8a1f17; }
.editor-token-brace { color: transparent; }
/* Below the sheet: the length against the 750-character limit, with a mark at 500, and Import text. */
.writing-workspace-focused .editor-document-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 760px; margin: 14px 0 0; font-size: 13px; color: var(--muted); }
.editor-meter { display: flex; align-items: center; gap: 12px; min-width: 0; }
.editor-meter-bar { position: relative; flex: 0 0 160px; height: 4px; border-radius: 2px; background: #e4e4e4; }
.editor-meter-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 2px; background: var(--ink); transition: width .2s ease; }
.editor-meter-bar b { position: absolute; top: -4px; width: 1px; height: 12px; background: #a3a3a3; }
.editor-meter.is-long { color: #6b5320; }
.editor-meter.is-long .editor-meter-bar i { background: #b8892e; }
.editor-meter.is-over { color: var(--danger); }
.editor-meter.is-over .editor-meter-bar i { background: var(--danger); }
.editor-meter.is-over [data-letter-stats] b { font-weight: 600; }
.writing-workspace-focused .editor-upload { flex: none; color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: #c4c4c4; }
.writing-workspace-focused .editor-upload:hover { color: var(--ink); }
.writing-workspace-focused .editor-upload:focus-within { outline: 0; }
.writing-workspace-focused .editor-upload:has(input:focus-visible) { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
/* Undo, for a few seconds after an import, an applied tip or a reset adjustment. */
.editor-toast { position: fixed; left: 50%; bottom: 28px; z-index: 70; display: flex; align-items: center; gap: 16px; transform: translateX(-50%); padding: 10px 16px; border-radius: 8px; background: #111; color: #fff; font-size: 13px; box-shadow: 0 10px 30px #0003; }
.editor-toast[hidden] { display: none; }
.editor-toast .text-link { color: #fff; font-size: 13px; text-decoration-color: #ffffff80; }
.writing-workspace-focused .editor-assistance-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 22px; }
.writing-workspace-focused .editor-assistance-heading h2 { margin: 0; }
.writing-workspace-focused .editor-assistance-heading .editor-tool { padding: 3px; }
.writing-workspace-focused .editor-sender h3 { font-size: 13px; font-weight: 500; margin: 0 0 17px; }
.writing-workspace-focused .editor-sender fieldset { border: 0; margin: 0; padding: 0; }
.writing-workspace-focused .editor-field { color: var(--muted); font-size: 12px; margin-bottom: 13px; }
.writing-workspace-focused .editor-field input { font-size: 13px; min-height: 36px; }
.writing-workspace-focused .editor-address-fields { grid-template-columns: 100px minmax(0,1fr); }
.writing-workspace-focused .editor-context { margin-top: 24px; }
.writing-workspace-focused .editor-error { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.writing-workspace-focused .editor-error[hidden] { display: none; }
.writing-workspace-focused .editor-error button { color: inherit; font-size: inherit; }
@media (max-width: 1100px) {
  .writing-workspace-focused .editor-toolbar { padding-inline: 20px; gap: 10px; }
  .writing-workspace-focused .editor-toolbar-end { gap: 14px; }
  .writing-workspace-focused .editor-main { padding-inline: 24px; }
  .editor-sheet { padding: 40px 44px 48px; }
  .editor-highlights { inset: 40px 44px 48px; }
}
@media (max-width: 900px) {
  .writing-workspace-focused .editor-columns { display: flex; flex-direction: column; }
  .writing-workspace-focused .editor-assistance { order: -1; border-top: 0; border-bottom: 1px solid var(--line); }
  .writing-workspace-focused .editor-preview { padding: 0 24px 24px; }
  .writing-workspace-focused .editor-details-panel .editor-sender fieldset { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 0 16px; }
}
/* Phones only need to work (95% of customers write on a computer). */
@media (max-width: 700px) {
  .writing-workspace-focused .editor-toolbar { padding: 10px 14px; flex-wrap: wrap; }
  .writing-workspace-focused .editor-toolbar-end { margin-left: auto; gap: 12px; }
  .writing-workspace-focused .editor-toolbar-end .editor-tool, .writing-workspace-focused .editor-toolbar-end .editor-save-status { font-size: 12px; }
  .writing-workspace-focused .editor-main { padding: 14px 12px 24px; }
  .writing-workspace-focused .editor-preview { padding: 0 12px 24px; }
  .editor-sheet { padding: 26px 22px; }
  .editor-highlights { inset: 26px 22px; }
  .writing-workspace-focused .editor-document-footer { flex-wrap: wrap; }
  .editor-meter-bar { flex-basis: 90px; }
  .writing-workspace-focused .editor-details-panel .editor-sender fieldset { display: block; }
}
.writing-workspace-focused .editor-campaign fieldset { border: 0; margin: 0 0 26px; padding: 0; }
/* Write fits the window on laptop widths: the letter column scrolls, not the page. */
@media (min-width: 901px) {
  .page-editor { display: flex; flex-direction: column; height: calc(100dvh - 56px); min-height: 560px; }
  .page-editor #campaign-content, .page-editor #writing-editor, .page-editor .writing-workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .page-editor .editor-columns { flex: 1; min-height: 0; }
  .page-editor .editor-main { min-height: 0; overflow-y: auto; }
  .page-editor .editor-assistance { min-height: 0; overflow-y: auto; }
  .page-editor .editor-preview { display: flex; flex-direction: column; min-height: 0; }
  .page-editor .editor-preview > div { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .page-editor .editor-preview .letter-review-surface { display: flex; flex-direction: column; flex: 1; min-height: 0; }
  .page-editor .editor-preview .letter-review-stage { flex: 1; height: auto; min-height: 0; }
}
/* Brief (6 October): heads the Feedback panel ("Tips for: …"), and the same three questions in Details. */
.editor-brief { margin: -6px 0 20px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.editor-brief > * { margin-right: 6px; }
.editor-original .editor-token { padding: 0 4px; }
.editor-brief[hidden] { display: none; }
.editor-brief b { color: var(--ink); font-weight: 500; }
.editor-brief-dot { color: #c4c4c4; }
.editor-brief .text-link { font-size: 13px; }
.editor-brief-fields h3 { font-size: 13px; font-weight: 500; margin: 0 0 12px; }
.editor-brief-fields fieldset { border: 0; margin: 0 0 26px; padding: 0; }
.editor-brief-fields fieldset fieldset { margin: 0 0 14px; }
.editor-brief-fields legend { font-size: 13px; margin-bottom: 8px; }
.editor-brief-fields .context-choices, .editor-brief-fields .context-choices.is-four { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.editor-brief-fields .context-choices span { min-height: 40px; padding: 6px; font-size: 12.5px; }
.editor-brief-fields .field label { font-size: 12px; color: var(--muted); }
.editor-brief-fields .field input { min-height: 33px; padding: 5px 8px; font-size: 12px; }
.editor-brief-fields .context-hint { font-size: 12px; }
