/* ==========================================================================
   Labour Life practice system: compose.css. Owner: send (M10). SPEC 7.6.6.
   The email composer (components/email-compose.js). Class prefix cmp-.
   Nothing restates a class of the core files. Tokens only, no raw colours.
   Phone first: the base styles are the phone.

     .cmp (__in)                         the body of the composer: the full width of its frame
     .cmp-from (__l __v)                 "From: Jose Labour Life jose@..." as text
     .cmp-addr (__wrap __chips __in __err)   an address field: chips and one input in a box that looks like a field
     .cmp-chip (--bad, __t)              one address
     .cmp-sugg (__l __b)                 the suggestions under To
     .cmp-more (__b)                     CC and BCC, behind "Add CC and BCC"
     .cmp-att (__row __l __attach __list __chip __fw __fwrow __fwl __tick __i __n __s __v __x __total __total--over __err __no)
                                         attachments: one small row, as in Outlook (19 Nov 2026)
     .cmp-up                             the rows of files from this computer on their way (the uploader, bare)
     .cmp-attpop .cmp-attmenu .cmp-recent (__i __t __n __note)   the Attach menu: Recent documents, From documents...,
                                         From this computer... (19 Nov 2026)
     .cmp-drop-host .cmp-drop (__in)     "Drop files to attach" over the whole writer while files are dragged over it
     .cmp-docs (__sec __h __list __row __n __none __foot)   the "From documents" popover

   26 Oct 2026 (Jose's HUB comments):
     .rte (__bar __b __sep __area __pop __opt __sw __link)  the box with a formatting bar (components/rich-editor.js),
                                         also the signature box of components/signature-editor.js
     .cmp-book (__i __n __a __k, .is-active)   the address book under To, CC and BCC
     .cmp-link (__row __list __chip __t __add __hint, .is-fixed)   the Link part: where the email is filed
     .cmp-msg  .cmp-sig-note  .cmp-ref   the message, the line about the signature, the line about [LL-000123]
     .cmp-att__v                         Open, on an attachment before it is sent
     .cmp-page (__head __body __foot __err)  .cmp-page-host  .cmp-page-top   the composer as the page of its own tab (/emails/new)

   27 Oct 2026 (Jose's feedback):
     .rte__font                          the Font select of the bar
     .rte__area ul, ol                   the lists of the box get their bullets and numbers back: base.css takes them
                                         off every list of the app, so a list made in the box showed nothing (the cause of
                                         "Bullet and numbering not working correct. It only moves it up")
     .cmp-opts (__c __i)                 "Ask for a read receipt", "Important" (the Spelling select went on 28 Oct 2026)
     .page.cmp-pg, html.cmp-tab          the composer's own tab uses the whole window: the main menu is folded away on a
                                         computer, the composer takes the full width with the normal page padding, and the
                                         message box fills the height that is left, at least 420px

   28 Oct 2026 (Jose: "Spelling werk steeds nie"; decisions 344 and 345):
     ::highlight(ll-spell)               the red wavy line under a word with a mistake (components/spell-check.js):
                                         drawn by the browser over the text, nothing is added to the text
     .sp-menu (__w __s __list __sg __acts __a)   the menu of one word: suggestions, Ignore, Add to dictionary
     .cmp-subj-sp (__w)                  "Check the spelling:" under the subject, a button per word
     .cmp-msg__hint                      the line over the message about the red lines and @
     .cmp-at (__i __a)                   the @ list of the message (components/mention-list.js)

   5 Nov 2026 (email drafts):
     .cmp-draft-line (.is-err)           "Draft saved 10:42" at the start of the row of buttons
     .cmp-draft-note                     what a draft lost since it was saved, at the top of the form

   On a computer every email is written in its own browser tab (27 Oct
   2026): the panel beside the task (19 Oct 2026, item 115) and its styles
   are gone. On a phone or a small tablet the composer is the full-screen
   window (.cmp-modal).
   ========================================================================== */

/* ---------- the frame ---------- */

.cmp { flex: 1 0 auto; min-width: 0; }
.cmp__in { padding: var(--s3) var(--s4) var(--s6); min-width: 0; }

.cmp-from { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s3); margin: 0 0 var(--s4); min-width: 0; }
.cmp-from__l { font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft); }
.cmp-from__v { min-width: 0; overflow-wrap: anywhere; }

/* ---------- addresses ---------- */

.cmp-addr__wrap { display: grid; gap: var(--s1); min-width: 0; }
.cmp-addr {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s2);
  height: auto; padding: var(--s1) var(--s2); cursor: text;
}
.cmp-addr:focus-within { border-color: var(--focus); box-shadow: var(--focus-ring); }
.cmp-addr:has(.cmp-addr__in[aria-invalid="true"]) { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.cmp-addr__chips { display: contents; }
.cmp-addr__in {
  flex: 1 1 12ch; min-width: 12ch; min-height: var(--control-h-sm);
  border: 0; padding: 0 var(--s1); background: transparent; color: var(--ink);
  font: 400 1rem/1.4 var(--font-body);
}
.cmp-addr__in:focus, .cmp-addr__in:focus-visible { outline: 2px solid transparent; box-shadow: none; }
@media (pointer: coarse) { .cmp-addr__in { min-height: var(--tap); } }

.cmp-chip { max-width: 100%; cursor: default; }
.cmp-chip__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-chip--bad { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-ink); }

.cmp-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: calc(var(--s2) * -1) 0 var(--s4); min-width: 0; }
.cmp-sugg__l { font-size: var(--fs-sm); color: var(--ink-mute); }
.cmp-sugg__b { max-width: 100%; min-height: var(--tap); font-weight: 400; overflow-wrap: anywhere; text-align: left; }

.cmp-more__b { margin: calc(var(--s2) * -1) 0 var(--s4) calc(var(--s3) * -1); min-height: var(--tap); }

/* ---------- read receipt, Important (27 Oct 2026; the Spelling select went on 28 Oct 2026) ---------- */

.cmp-opts {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s1) var(--s5);
  margin: calc(var(--s2) * -1) 0 var(--s4); min-width: 0;
}
.cmp-opts__c { padding: var(--s1) 0; }
.cmp-opts__c .check__t { display: inline-flex; align-items: center; gap: var(--s1); }
.cmp-opts__i { color: var(--danger-ink); }

/* ---------- attachments: one small row, as in Outlook (19 Nov 2026) ----------
   Jose: "make it smaller like outlook not a whole block". The word, the
   Attach button and the files as chips in one row that wraps; with nothing
   attached it is one line high. A chip: the kind of file, the name cut in
   its middle (the whole name in its title), the size, Open and Remove. */

.cmp-att { gap: var(--s2); }
.cmp-att__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; }
.cmp-att__l { margin: 0 var(--s1) 0 0; }
.cmp-att__attach { min-height: var(--control-h-sm); }
.cmp-att__list { display: contents; list-style: none; margin: 0; padding: 0; }
.cmp-att__chip {
  display: inline-flex; align-items: center; gap: var(--s1); max-width: 100%; min-width: 0;
  min-height: var(--control-h-sm); padding: 0 2px 0 var(--s2);
  border: 1px solid var(--line-strong); border-radius: var(--r-sm); background: var(--sunken);
  font-size: var(--fs-sm); color: var(--ink);
}
.cmp-att__chip.is-off { color: var(--ink-mute); background: var(--surface); border-style: dashed; }
.cmp-att__i { display: inline-grid; place-items: center; flex: none; color: var(--ink-soft); }
.cmp-att__n {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; color: inherit; text-align: left;
}
button.cmp-att__n { padding: 0; border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; }
button.cmp-att__n:hover { text-decoration: underline; }
.cmp-att__s { flex: none; color: var(--ink-mute); white-space: nowrap; }
.cmp-att__v, .cmp-att__x { flex: none; width: 28px; height: 28px; }
.cmp-att__tick { display: inline-flex; align-items: center; gap: var(--s1); min-width: 0; cursor: pointer; }
.cmp-att__fwrow { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; }
.cmp-att__fwl { margin: 0; }
.cmp-att__total { margin: 0; font-size: var(--fs-sm); color: var(--ink-soft); white-space: nowrap; }
.cmp-att__total--over { color: var(--danger-ink); font-weight: 600; white-space: normal; }
.cmp-att__no { margin: 0; }
.cmp-up { min-width: 0; }
.cmp-up .up__list:not([hidden]) { display: grid; gap: var(--s1); }
.cmp-up .up__row { padding: var(--s2) var(--s3); border-radius: var(--r-sm); }
.cmp-up:not(:has(.up__row:not([hidden]))) { display: none; }
@media (pointer: coarse) {
  /* A touch screen: everything that is pressed is at least 44px. */
  .cmp-att__attach, .cmp-att__chip { min-height: var(--tap); }
  .cmp-att__v, .cmp-att__x { width: var(--tap); height: var(--tap); }
  button.cmp-att__n { min-height: var(--tap); }
}

/* The Attach menu: Recent documents (two lines each), then From documents... and From this computer... */
.cmp-attmenu { min-width: 0; }
.cmp-recent { display: grid; min-width: 0; }
.cmp-recent__i { align-items: flex-start; }
.cmp-recent__i > svg { margin-top: 2px; flex: none; }
.cmp-recent__t { display: grid; min-width: 0; }
.cmp-recent__n { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-recent__i[aria-disabled="true"] { color: var(--ink-mute); cursor: default; }
.cmp-recent__note { margin: 0; }
@media (pointer: coarse) { .cmp-attmenu .menu__i { min-height: var(--tap); } }

/* Files dragged over the writer: a calm veil over the whole of it, the words kept in sight (sticky). */
.cmp-drop-host { position: relative; }
.cmp-drop {
  position: absolute; inset: 0; z-index: var(--z-sticky); pointer-events: none;
  border: 2px dashed var(--red-ink); border-radius: inherit; background: var(--surface); opacity: .94;
}
.cmp-drop[hidden] { display: none; }
.cmp-drop__in {
  position: sticky; top: 30vh; display: grid; justify-items: center; gap: var(--s2);
  margin: 30vh auto 0; padding: var(--s4); text-align: center; color: var(--ink);
}
.cmp-drop__in p { margin: 0; font-weight: 600; font-size: var(--fs-h3); }
.cmp-drop__in svg { color: var(--red-ink); }

@media (min-width: 720px) {
  .cmp__in { padding: var(--s4) var(--s6) var(--s7); }
}

/* ---------- "From documents" ---------- */

.cmp-docs { display: grid; gap: var(--s2); min-width: 0; }
.cmp-docs__sec { padding: 0 var(--s2); min-width: 0; }
.cmp-docs__h { margin: var(--s2) 0 0; font-size: var(--fs-sm); font-weight: 600; color: var(--ink-soft); }
.cmp-docs__list { display: grid; min-width: 0; }
.cmp-docs__row { padding: var(--s1) 0; }
.cmp-docs__row.is-off { color: var(--ink-mute); cursor: default; }
.cmp-docs__n { display: inline-flex; align-items: center; gap: var(--s1); overflow-wrap: anywhere; }
.cmp-docs__none { margin: var(--s1) 0; }
.cmp-docs__foot {
  position: sticky; bottom: calc(var(--s1) * -1); display: flex; justify-content: flex-end;
  padding: var(--s2); background: var(--surface); border-top: 1px solid var(--line);
}

/* ---------- the box with a formatting bar (26 Oct 2026) ---------- */

.rte { display: grid; min-width: 0; }
.rte__bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: var(--s1); border: 1px solid var(--field-line); border-bottom: 0;
  border-radius: var(--r-sm) var(--r-sm) 0 0; background: var(--sunken);
}
.rte__b { width: var(--control-h-sm); height: var(--control-h-sm); color: var(--ink-soft); }
.rte__b[aria-pressed="true"] { background: var(--tint-2); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line-strong); }
.rte__b.is-busy { opacity: .6; cursor: progress; }
.rte__sep { width: 1px; height: 20px; margin: 0 var(--s1); background: var(--line-strong); }
/* The Font select (27 Oct 2026): as high as the buttons, as wide as its longest name. */
.rte__font { width: auto; max-width: 11rem; min-height: var(--control-h-sm); height: var(--control-h-sm); padding-top: 0; padding-bottom: 0; margin-right: var(--s1); font-size: var(--fs-sm); }
@media (pointer: coarse) {
  .rte__b { width: var(--tap); height: var(--tap); }
  .rte__font { min-height: var(--tap); height: var(--tap); }
}

.rte__area {
  display: block; height: auto; min-width: 0; padding: var(--s3);
  border-radius: 0 0 var(--r-sm) var(--r-sm);
  overflow-wrap: anywhere; line-height: var(--lh-body); cursor: text;
  font: 400 1rem/var(--lh-body) var(--font-body); color: var(--ink); background: var(--surface);
}
.rte__area:focus, .rte__area:focus-visible { border-color: var(--focus); box-shadow: var(--focus-ring); outline: 2px solid transparent; }
.rte__area[aria-invalid="true"] { border-color: var(--danger); }
.rte__area > :first-child { margin-top: 0; }
.rte__area p { margin: 0 0 var(--s3); }
/* The bullets and numbers that base.css takes off every list of the app, back in the box (27 Oct 2026). */
.rte__area ul, .rte__area ol { margin: var(--s2) 0; padding-left: var(--s6); list-style-position: outside; }
.rte__area ul { list-style-type: disc; }
.rte__area ol { list-style-type: decimal; }
.rte__area ul ul, .rte__area ol ul { list-style-type: circle; }
.rte__area ul ul ul, .rte__area ol ul ul, .rte__area ol ol ul, .rte__area ul ol ul { list-style-type: square; }
.rte__area ol ol, .rte__area ul ol { list-style-type: lower-alpha; }
.rte__area ul ul, .rte__area ol ol, .rte__area ul ol, .rte__area ol ul { margin: 0; }
.rte__area li { display: list-item; }
.rte__area blockquote { margin: var(--s2) 0 var(--s2) var(--s1); padding: 0 0 0 var(--s3); border-left: 2px solid var(--line-strong); color: var(--ink-soft); }
.rte__area a { color: var(--link); text-decoration: underline; }
.rte__area img { max-width: 100%; height: auto; }
.rte__area table { border-collapse: collapse; max-width: 100%; }
.rte__area td, .rte__area th { padding: 2px var(--s2); border: 1px solid var(--line); }

.rte__pop { display: grid; padding: var(--s1); }
.rte__opt { display: flex; align-items: center; gap: var(--s2); }
.rte__sw { display: inline-block; width: 16px; height: 16px; border-radius: var(--r-xs); box-shadow: inset 0 0 0 1px var(--line-strong); }
.rte__link { display: grid; gap: var(--s2); padding: var(--s3); }
.rte__link .btns { justify-content: flex-end; }

/* ---------- the message, the signature line, the reference line ---------- */

.cmp-msg { gap: var(--s1); }
.cmp-msg .rte__area { min-height: 14em; }
.cmp-sig-note, .cmp-ref { margin: var(--s1) 0 0; }
.cmp-ref { color: var(--ink-mute); }

/* ---------- the address book ---------- */

.cmp-addr__wrap { position: relative; }
.cmp-book {
  position: absolute; z-index: var(--z-pop); top: calc(100% - var(--s1)); left: 0; right: 0;
  margin: 0; padding: var(--s1) 0; list-style: none; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-sm); box-shadow: var(--shadow-pop);
}
.cmp-book__i {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: var(--s3); align-items: baseline;
  padding: var(--s2) var(--s3); cursor: pointer; min-height: var(--tap);
}
.cmp-book__i:hover, .cmp-book__i.is-active { background: var(--tint); }
.cmp-book__n { min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp-book__a { grid-column: 1; min-width: 0; font-size: var(--fs-sm); color: var(--ink-soft); overflow-wrap: anywhere; }
.cmp-book__k { grid-column: 2; grid-row: 1; color: var(--ink-mute); }

/* ---------- the Link part ---------- */

.cmp-link__row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); min-width: 0; }
.cmp-link__list { display: contents; list-style: none; margin: 0; padding: 0; }
/* 14 Nov 2026 (decision 489; Jose: "beskrywing moet ook voluit staan"): a chip shows a task's reference and
   title in full. A long one wraps onto more lines inside its chip; it is never cut with dots. */
.cmp-link__chip { max-width: 100%; gap: var(--s1); padding-block: var(--s1); }
.cmp-link__chip > svg, .cmp-link__chip > .chip__x { flex: none; }
.cmp-link__chip.is-fixed { background: var(--sunken); }
.cmp-link__t { min-width: 0; overflow-wrap: anywhere; }
.cmp-link__add { min-height: var(--control-h-sm); }
.cmp-link__hint { margin: var(--s1) 0 0; }
@media (pointer: coarse) { .cmp-link__add { min-height: var(--tap); } }

/* ---------- the full-screen window (a phone, a small tablet) ---------- */

.cmp-modal .modal__head { display: flex; align-items: center; gap: var(--s3); }
.cmp-modal .modal__head h2 { flex: 1 1 auto; min-width: 0; }

/* ---------- the pop-up on a computer, with Minimise (27 Oct 2026, Franro) ----------
   A large window over the page it was opened from. Minimised it is a bar at
   the bottom right with the subject: no backdrop, the page can be used, and
   the bar opens it again (components/modal.js setMinimised). */

@media (min-width: 960px) {
  .modal-back--full:has(> .cmp-pop) { padding: 3vh 3vw; place-items: center; }
  .modal--full.cmp-pop {
    width: min(1180px, 100%); height: min(94vh, 1100px); max-height: none;
    border-radius: var(--r-lg); animation-name: llPop;
  }
  .modal-back--min { inset: auto var(--s4) var(--s4) auto; padding: 0 !important; background: transparent; pointer-events: none; animation: none; }
  .modal-back--min > .modal { width: 380px; height: auto; max-height: none; pointer-events: auto; animation: none; }
  .modal--min .modal__body, .modal--min .modal__foot { display: none; }
  .modal--min .modal__head { cursor: pointer; padding: var(--s3) var(--s3) var(--s3) var(--s4); }
  .modal--min .modal__head h2 { font-size: var(--fs-body, 1rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}

/* ---------- the composer as the page of its own tab (/emails/new) ---------- */

.cmp-page-top { margin: 0 0 var(--s3); }
.cmp-page {
  display: flex; flex-direction: column; min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md);
}
.cmp-page:focus { outline: none; }
.cmp-page__head { display: flex; align-items: center; gap: var(--s3); }
.cmp-page__head h1 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: var(--fs-h2); }
.cmp-page .cmp-page__body { padding: 0; overflow: visible; display: flex; flex-direction: column; }
.cmp-page__err { margin: var(--s3) var(--s4) 0; }
.cmp-page .cmp__in { padding: var(--s4); }
/* The row with Send stands fixed at the bottom of the page: the page's scroll-padding is its height
   (--cmp-foot-h, set by components/email-compose.js), so the line with the cursor stays above it
   (components/rich-editor.js, 19 Nov 2026; Jose: "if you type the page doesn't move with the cursor"). */
html.cmp-tab .content { scroll-padding-bottom: var(--cmp-foot-h, 5rem); }
.cmp-page .modal__foot {
  position: sticky; bottom: 0; z-index: var(--z-sticky);
  background: var(--surface); border-top: 1px solid var(--line);
  border-radius: 0 0 var(--r-md) var(--r-md);
}

/*
 * The whole window (27 Oct 2026, Jose: "Mail still needs to utilize the
 * entire screen"). The page is at least as tall as the content area and a
 * column: the frame, its body, the composer and the message each take what
 * is left, so the message box fills the height under the other fields, with
 * 420px at least. The width is the page's: no narrow column.
 */
.page.cmp-pg { display: flex; flex-direction: column; min-height: 100%; padding-top: var(--s4); padding-bottom: var(--s4); }
.page.cmp-pg > * + * { margin-top: 0; }
.cmp-page-host { flex: 1 0 auto; display: flex; flex-direction: column; min-width: 0; }
.cmp-page { flex: 1 0 auto; }
.cmp-page .cmp-page__body { flex: 1 0 auto; }
.cmp--page { display: flex; flex-direction: column; }
.cmp--page .cmp__in { flex: 1 0 auto; display: flex; flex-direction: column; }
.cmp--page .cmp-more__b { align-self: flex-start; }
.cmp--page .cmp-msg { flex: 1 0 auto; display: flex; flex-direction: column; }
.cmp--page .cmp-msg .rte { flex: 1 0 auto; grid-template-rows: auto minmax(420px, 1fr); }
.cmp--page .cmp-msg .rte__area { min-height: 420px; }
@media (min-width: 960px) {
  /* The main menu folds away in the composer's own tab: the top bar stays, with the way back above the email. */
  html.cmp-tab .side { display: none; }
  .cmp-page .cmp__in { padding: var(--s5) var(--s6) var(--s6); }
  .cmp-page__err { margin: var(--s4) var(--s6) 0; }
}

/* ---------- drafts (5 Nov 2026) ---------- */

/* "Draft saved 10:42", quietly at the start of the row of buttons; a failed
   save in the danger colour. On a phone it takes a line of its own above the
   buttons. The note at the top says what a draft lost since it was saved. */
.cmp-draft-line { margin-right: auto; align-self: center; min-width: 0; color: var(--ink-mute); overflow-wrap: anywhere; }
.cmp-draft-line:empty { display: none; }
.cmp-draft-line.is-err { color: var(--danger-ink); }
.cmp-draft-note { margin: 0 0 var(--s4); }
.cmp-draft-note p { margin: 0; }
.cmp-draft-note p + p { margin-top: var(--s1); }
@media (max-width: 559px) {
  .cmp-draft-line { flex: 1 0 100%; margin-right: 0; }
}

@media (forced-colors: active) {
  .rte__b[aria-pressed="true"] { outline: 2px solid Highlight; }
  .cmp-book__i.is-active { outline: 2px solid Highlight; }
}

/* ---------- the spell check and @ (28 Oct 2026, decisions 344 and 345) ---------- */
::highlight(ll-spell) { text-decoration: underline wavy var(--danger); text-decoration-skip-ink: none; text-underline-offset: 3px; }
.cmp-msg__hint { margin: 0 0 var(--s2); }
.cmp-subj-sp { margin: 0; }
.cmp-subj-sp__w { color: var(--danger-ink); text-decoration: underline wavy var(--danger); text-underline-offset: 3px; }
.sp-menu { gap: var(--s1); padding: var(--s1); }
.sp-menu__w { margin: 0; padding: var(--s1) var(--s3) 0; font-weight: 600; color: var(--danger-ink); overflow-wrap: anywhere; }
.sp-menu__s { margin: 0; padding: 0 var(--s3); }
.sp-menu__list { display: grid; }
.sp-menu__sg { font-weight: 600; }
.sp-menu__acts { display: grid; padding-top: var(--s1); border-top: 1px solid var(--line); }
.cmp-at { min-width: 0; }
.cmp-at__i { flex-wrap: wrap; row-gap: 0; }
.cmp-at__a { flex-basis: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (pointer: coarse) {
  .sp-menu .menu__i, .cmp-at__i { min-height: var(--tap); }
}

/* ---------- night mode: the box is paper under a night glass (decision 494) ----------
   Jose: "when you draft mails it switches back to normal. Please keep
   everything in dark mode when switched on." The writer is dark at night by
   the tokens, like every other screen. The box the words are typed in
   (.rte__area: the message of an email, a signature, a group message) needs
   more care, because its content is sent to other people:

   - the box keeps the day colours for real (tokens.css gives it the day
     values again). What a person types has no colour of its own, and where
     the browser writes colours into the text by itself (lines joined, text
     pasted from the box or the page) they are the dark ink of day on white.
     Nothing of the night colours can go out with an email: the HTML that is
     sent is what the same person would send by day;
   - the box is shown through one layer, as the body of a received email is
     (email_dark_css() in app/lib/emails.php, the same numbers): .rte::after
     lies over the box and turns what is under it round, white to the colour
     of a card and dark words to light ones, each colour keeping its hue. A
     colour chosen from the bar shows as it will read in night mode;
   - a picture (the logo of a signature) is lifted above the layer and shows
     exactly as it is.

   The bar and the box are the two rows of .rte's grid, and the layer takes
   the row of the box. A browser without backdrop-filter gets the plain way:
   the filter on the box and its opposite on each picture. Screen only. */
@media screen {
  html.is-dark .rte { position: relative; isolation: isolate; }
  html.is-dark .rte__bar { grid-row: 1; grid-column: 1; }
  html.is-dark .rte__area { grid-row: 2; grid-column: 1; }
  /* The ring is outside the box, so it is not under the layer: the night ring. */
  html.is-dark .rte__area:focus, html.is-dark .rte__area:focus-visible { box-shadow: var(--night-focus-ring); }
  @supports ((backdrop-filter: invert(1)) or (-webkit-backdrop-filter: invert(1))) {
    html.is-dark .rte::after {
      content: ""; grid-row: 2; grid-column: 1; z-index: 1; pointer-events: none;
      border-radius: 0 0 var(--r-sm) var(--r-sm);
      -webkit-backdrop-filter: invert(.918) hue-rotate(180deg); backdrop-filter: invert(.918) hue-rotate(180deg);
    }
    html.is-dark .rte__area img { position: relative; z-index: 2; }
  }
  @supports not ((backdrop-filter: invert(1)) or (-webkit-backdrop-filter: invert(1))) {
    html.is-dark .rte__area { filter: invert(.918) hue-rotate(180deg); }
    html.is-dark .rte__area img { filter: hue-rotate(180deg) invert(1) contrast(1.196); }
  }
}
@media (forced-colors: active) {
  html.is-dark .rte::after { display: none; }
  html.is-dark .rte__area, html.is-dark .rte__area img { filter: none; }
}
