/* Daily Life Doc, round 9, changed in round 10 (zone C): the care team's one chat (docs/build/r10/PLAN.md 3.2; the
   page's Part 2). Pink (--tint-team, --care-d) is what only the care team sees; blue (--note, --note-d) the clinician
   and "@Clinician"; yellow (--try-bg, --try-d) a Note. The patient sees white and ink. Nothing boxed or form-like:
   tinted surfaces, no borders. Every change moves with DD.motion; with "reduce motion" the end state shows at once.
     1. the field (js/convo/field.js, field-plus.js, field-ask.js, field-voice.js, field-draft.js, chat-typing.js)
     2. the round + sheet
     (3. a proposal's card: zone A's css/cards.css)
     4. the small menu, the menu ···, a held message, Patient's view, Search (convo-menu.js, convo-hold.js,
        chat-search.js)
     5. messages of one side a few minutes apart; 7. Ask AI with a file; 8. the "@" list
   The state under an item, the team entries, "Waiting for the patient", the head and the three columns at a
   computer are in css/chat-care.css. */

/* ---------- 1. The field ---------- */
.cf { display: flex; flex-direction: column; gap: 8px; }
.cf-row { display: flex; align-items: flex-end; gap: 8px; }
/* The round +: a quarter turn makes it a ✕ while its sheet is open. */
.cf-plus { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); color: var(--ink);
  transition: transform var(--m-pop) var(--ease-spring), background var(--m-press) ease; }
.cf-plus svg { width: 22px; height: 22px; transition: transform var(--m-pop) var(--ease-spring); }
.cf-plus.is-open { background: var(--ink); color: var(--on-ink); }
.cf-plus.is-open svg { transform: rotate(135deg); }
.cf-plus:active { transform: scale(0.92); }
.cf-box { flex: 1; min-width: 0; border-radius: 20px; background: var(--surface); padding: 4px 6px 4px 14px; transition: background var(--m-step) ease; }
/* "@Clinician" at the start: the field turns blue (only the care team and the clinician read these words). */
.cf.is-clin .cf-box { background: var(--note); }
.cf.is-clin .cf-line textarea { color: var(--note-d); }
/* The words and Speak are one piece; Speak never leaves the words' row. */
.cf-line { display: flex; align-items: flex-end; min-height: 36px; }
.cf-tw { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 6px; }
.cf-tx { position: relative; flex: 1 1 0; min-width: 0; display: flex; }
.cf-line textarea { flex: 1 1 0; min-width: 0; min-height: 36px; max-height: 160px; padding: 8px 0 7px; border: 0; outline: 0; resize: none; background: none;
  font: inherit; font-size: var(--t-m); line-height: 1.35; color: var(--ink); transition: text-indent var(--m-step) var(--ease-out); }
.cf-line textarea::placeholder { color: var(--ink3); }
.cf-spk { flex: none; height: 36px; display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 12px; font-size: var(--t-sm); font-weight: 500; color: var(--ink2); }
.cf-spk svg { width: 18px; height: 18px; }
.cf-spk.live { color: var(--bad); }
.cf-spk.live svg { animation: dd-wait 1100ms ease-in-out infinite; }
/* The words at the start of the field: "@Clinician" (blue), "Voice note", the measure or action "@" named. They
   stand over the first line of the words, which starts after them (field-plus.js `indent`). */
.cf-tokens { position: absolute; top: 5px; left: 0; max-width: 70%; display: flex; gap: 4px; pointer-events: none; }
.cf-tokens:empty { display: none; }
.cf-tok { flex: 0 1 auto; min-width: 0; height: 26px; display: block; padding: 0 10px; border-radius: 9px; font-size: var(--t-sm); font-weight: 600; line-height: 26px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-tok.is-at { background: var(--soft); color: var(--ink); }
.cf-tok.is-clin { background: var(--surface); color: var(--note-d); }
.cf-tok.is-voice { background: var(--soft); color: var(--ink); }
/* Ask AI and Send ▾: always there, greyed while the field is empty; "@Clinician" at a computer. */
.cf-go { display: flex; justify-content: flex-end; align-items: center; gap: 8px; padding: 2px 0 6px; }
.cf-at, .cf-ask, .cf-send, .cf-more { height: 36px; border-radius: 12px; font-size: var(--t-s); font-weight: 600; transition: transform var(--m-press) var(--ease-out), opacity var(--m-press) ease, background var(--m-step) ease; }
.cf-at { padding: 0 12px; background: var(--note); color: var(--note-d); }
/* Where Send goes, beside it, before Send (final review, fault 2): grey "To the patient", blue "To the clinician". It
   takes the free room of the row, so the buttons stay at the right. */
.cf-to { margin-right: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--t-xs); color: var(--ink3); }
.cf-to.is-clin { color: var(--note-d); font-weight: 600; }
/* A phone: the words stand on their own short line over the buttons, so they are never cut ("To the pa…"). */
@media (max-width: 400px) {
  .cf-go { flex-wrap: wrap; row-gap: 0; }
  .cf-to { flex-basis: 100%; margin: 0 0 2px; }
  .cf-to:empty { display: none; }
}
.cf-ask { padding: 0 16px; background: var(--tint-team); color: var(--care-d); }
.cf-sendw { display: inline-flex; gap: 2px; }
.cf-send { padding: 0 16px; background: var(--ink); color: var(--on-ink); border-radius: 12px 4px 4px 12px; }
.cf-more { width: 32px; display: grid; place-items: center; background: var(--ink); color: var(--on-ink); border-radius: 4px 12px 12px 4px; }
.cf-more svg { width: 16px; height: 16px; }
.cf-more[hidden] { display: none; }
.cf-more[hidden] + .cf-send, .cf-sendw:has(.cf-more[hidden]) .cf-send { border-radius: 12px; }
.cf.is-clin .cf-send { background: var(--note-d); color: var(--note); }
.cf-at:active, .cf-ask:active, .cf-send:active, .cf-more:active { transform: scale(0.96); }
.cf-at:disabled, .cf-ask:disabled, .cf-send:disabled, .cf-more:disabled { opacity: .35; }
/* In dark the greyed Ask AI (light pink on dark pink) all but vanished at .35 (round 10 fault 205). */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cf-ask:disabled { opacity: .6; } }
:root[data-theme="dark"] .cf-ask:disabled { opacity: .6; }
.cf-ask[hidden], .cf-at[hidden], .cf-send[hidden] { display: none; }
.cf-go button { white-space: nowrap; }
/* On a phone "@Clinician" is typed ("@" offers Clinician first): the button stands only on a wide window. */
@media (max-width: 699px) { .cf-at { display: none; } }
/* "About: …" over the field: the subject of Ask AI (a tap on a message or on the clinician's answer). */
.cf-about { display: flex; align-items: center; gap: 6px; margin-left: 52px; padding: 4px 4px 4px 12px; border-radius: 14px; background: var(--tint-team); font-size: var(--t-sm); color: var(--ink); }
.cf-about[hidden] { display: none; }
.cf-ab { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cf-ab b { font-weight: 600; color: var(--care-d); }
.cf-abx { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; color: var(--ink2); }
.cf-abx svg { width: 14px; height: 14px; }
/* "Care team · typing…" right above the field. */
.cf-typing { margin-left: 52px; font-size: var(--t-xs); color: var(--ink3); }
.cf-typing[hidden] { display: none; }
/* Listen: a typed voice note in the app's voice, played before Send. */
.cf-listen { display: flex; align-items: center; gap: 10px; margin-left: 52px; }
.cf-listen[hidden] { display: none; }
.cf-lb { flex: none; height: 34px; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; border-radius: 12px; background: var(--surface); font-size: var(--t-sm); font-weight: 600; color: var(--ink); }
.cf-lb svg { width: 14px; height: 14px; }
.cf-lb:disabled { opacity: .45; }
.cf-lp { flex: 1; min-width: 0; }
.cf-lp[hidden] { display: none; }
/* The answer buttons above the field: they fade in when the words end with "?". */
.cf-ans { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 0; padding: 0; opacity: 0; transform: translateY(6px);
  transition: opacity var(--m-step) ease, transform var(--m-step) var(--ease-out); }
.cf-ans.on { opacity: 1; transform: none; }
.cf-ans[hidden] { display: none; }
.cf-al { flex: none; margin: 0 6px 0 4px; font-size: var(--t-2xs); font-weight: 600; color: var(--ink3); }
.cf-ans button { flex: none; white-space: nowrap; height: 30px; padding: 0 7px; border-radius: 10px; font-size: var(--t-sm); color: var(--ink2); transition: background var(--m-press) ease, color var(--m-press) ease; }
@media (max-width: 400px) {
  .cf-ans:not(.is-one) .cf-al { flex-basis: 100%; margin: 0 0 2px 6px; line-height: 1.4; }
  .cf-ans button { padding: 0 6px; }
}
.cf-ans button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); font-weight: 600; }
/* What is added stands above the words, each with ✕. */
.cf-items { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 2px 52px; scrollbar-width: none; }
.cf-items::-webkit-scrollbar { display: none; }
.cf-items[hidden] { display: none; }
.cf-it { position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px; height: 56px; border-radius: 16px; background: var(--surface); font-size: var(--t-sm); }
.cf-it b { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cf-it > svg { flex: none; width: 20px; height: 20px; color: var(--ink2); margin-left: 12px; }
.cf-ph { width: 56px; overflow: hidden; }
.cf-ph img { width: 100%; height: 100%; object-fit: cover; transition: opacity var(--m-step) ease; }
.cf-ph.is-wait img { opacity: .55; }
.cf-x { flex: none; width: 30px; height: 30px; margin-right: 6px; display: grid; place-items: center; border-radius: 50%; color: var(--ink2); }
.cf-x svg { width: 15px; height: 15px; }
.cf-ph .cf-x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; margin: 0; background: rgba(0, 0, 0, .5); color: #fff; }
.cf-ph .cf-x svg { width: 12px; height: 12px; }
.cf-ct { background: var(--tint); }
.cf-rec { padding: 0 6px 0 14px; color: var(--bad); }
.cf-rec b { color: var(--ink); font-variant-numeric: tabular-nums; }
.cf-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--bad); animation: dd-wait 1100ms ease-in-out infinite; }
.cf-stop { height: 34px; padding: 0 12px; border-radius: 11px; background: var(--ink); color: var(--on-ink); font-size: var(--t-sm); font-weight: 600; }
.cf-vo { padding: 0 0 0 12px; min-width: 220px; }
.cf-vo .vn { flex: 1; }
@media (max-width: 360px) {
  .cf-items, .cf-about, .cf-typing, .cf-listen { padding-left: 0; margin-left: 0; }
  .cf-spk span { display: none; }
  .cf-ask, .cf-send { padding: 0 12px; }
}

/* ---------- 2. The round + sheet ---------- */
/* A round icon with its word under it; the sheet's ✕ at the top right as on every sheet (the title is empty). */
.cf-sheet .sh-head { justify-content: flex-end; margin-bottom: 0; }
.cf-sheet .sh-head h2:empty { display: none; }
.cf-g { margin: 0 2px 10px; font-size: var(--t-xs); font-weight: 600; color: var(--ink3); }
.cf-g + .cf-grid + .cf-g { margin-top: 20px; }
.cf-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px 0; padding-bottom: 4px; }
.cf-grid.is-six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cf-grid.is-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cf-pick { min-width: 0; padding: 2px 0; display: flex; flex-direction: column; align-items: center; gap: 7px; background: none;
  font-size: var(--t-xs); font-weight: 500; line-height: 1.2; color: var(--ink); transition: transform var(--m-press) var(--ease-out); }
.cf-pick i { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); transition: background var(--m-press) ease; }
.cf-pick span { white-space: nowrap; }
.cf-pick svg { width: 22px; height: 22px; color: var(--ink); }
.cf-pick:active { transform: scale(0.94); }
/* The examples of Ask AI: words that fill the field on a tap (pink: words to the AI). */
.cf-ex { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding-bottom: 6px; }
.cf-exb { max-width: 100%; padding: 9px 14px; border-radius: 16px; background: var(--tint-team); color: var(--ink); font-size: var(--t-s); line-height: 1.35; text-align: left;
  transition: transform var(--m-press) var(--ease-out); }
.cf-exb:active { transform: scale(0.98); }
@media (max-width: 360px) { .cf-pick i { width: 46px; height: 46px; } .cf-pick { font-size: 11px; letter-spacing: -0.01em; } }
/* The patient's round + (zone P's tray): Photo, Camera and File right above the field. */
.cf-tray { display: flex; gap: 20px; padding: 6px 0 4px 52px; }
.cf-tray .cf-pick { width: 64px; }
.cf-tray .cf-pick i { background: var(--surface); }
@media (max-width: 360px) { .cf-tray { gap: 14px; } }

/* ---------- 4. The small menu, the menu ···, a held message, Patient's view, Search ---------- */
.cm-more { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 12px; color: var(--ink); }
.cm-more svg { width: 22px; height: 22px; }
.cm-pop { position: fixed; z-index: 80; min-width: 168px; max-width: 280px; padding: 6px; border-radius: 16px; background: var(--surface); box-shadow: 0 10px 30px -8px var(--shadow), 0 0 0 1px var(--line);
  opacity: 0; transform: translateY(-4px) scale(.97); transform-origin: top right; transition: opacity 160ms ease, transform 200ms var(--ease-out); }
.cm-pop.on { opacity: 1; transform: none; }
.cm-pop button { display: block; width: 100%; min-height: 42px; padding: 0 14px; border-radius: 11px; text-align: left; font-size: var(--t-s); font-weight: 500; color: var(--ink); }
.cm-pop button.has-sub { padding: 8px 14px; }
.cm-pop button small { display: block; margin-top: 1px; font-size: var(--t-xs); font-weight: 400; color: var(--ink3); }
.cm-pop button:hover, .cm-pop button:focus-visible { background: var(--soft); }
.rc-list > [data-mid] { position: relative; }
.ch-more { position: absolute; top: 50%; width: 30px; height: 30px; margin-top: -15px; display: grid; place-items: center; border-radius: 50%; background: var(--surface); color: var(--ink2);
  box-shadow: 0 1px 0 var(--line); animation: dd-fade 160ms ease both; }
.ch-more svg { width: 18px; height: 18px; }
.ch-more[hidden] { display: none; }
.rc-list > .is-held { transform: scale(0.985); transition: transform var(--m-press) var(--ease-out); }
/* Patient's view and Search: a layer over the whole page under a pink bar. */
.pv { position: absolute; inset: 0; z-index: 30; display: flex; flex-direction: column; background: var(--bg); transform: translateY(100%);
  transition: transform var(--m-sheet) var(--ease-drawer); }
.pv.on { transform: none; }
.pv-bar { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(10px + var(--top, 0px)) var(--gut) 10px; background: var(--tint-team); }
.pv-bar b { font-size: var(--t-s); font-weight: 600; color: var(--care-d); }
.pv-x { flex: none; height: 34px; padding: 0 12px; border-radius: 11px; font-size: var(--t-s); font-weight: 600; color: var(--care-d); }
.pv-body { flex: 1; min-height: 0; overflow-y: auto; scrollbar-width: none; }
.pv-body::-webkit-scrollbar { display: none; }
.cs-in { flex: 1; min-width: 0; height: 40px; padding: 0 14px; border: 0; outline: 0; border-radius: 14px; background: var(--surface); font: inherit; font-size: var(--t-m); color: var(--ink); }
.cs-body { padding: 8px var(--gut) 40px; }
.cs-word { margin: 18px 4px; font-size: var(--t-s); color: var(--ink3); }
.cs-word[hidden] { display: none; }
.cs-r { display: block; width: 100%; padding: 12px 4px; text-align: left; border-bottom: 1px solid var(--line); transition: background var(--m-press) ease; }
.cs-r:active { background: var(--soft); }
.cs-r span { display: block; font-size: var(--t-s); line-height: 1.45; color: var(--ink); overflow-wrap: anywhere; }
.cs-r mark { background: var(--try-bg); color: var(--ink); border-radius: 3px; padding: 0 1px; }
.cs-r small { display: block; margin-top: 3px; font-size: var(--t-xs); color: var(--ink3); }

@media (prefers-reduced-motion: reduce) {
  .cf-plus, .cf-plus svg, .cf-ans, .pv, .cm-pop, .cf-dot, .cf-spk.live svg { transition: none; animation: none; }
}

/* ---------- 5. Messages of one side a few minutes apart (js/convo/convo-group.js): the name and time once ---------- */
.rc-m.is-cont > .rc-by { display: none; }
.rc-m.is-cont { margin-top: 3px; }

/* ---------- 7. Ask AI with a photo or a file (W2-M10): the file stands in pink with the words, care team only ---------- */
.rc-m.tm .mg-f.doc { background: var(--tint-team); color: var(--ink); }
.rc-m.tm .mg-f.doc svg { color: var(--care-d); }
.rc-m.tm .mg-f:not(.doc) { box-shadow: 0 0 0 3px var(--tint-team); }
.rc-m.tm .mg-files { margin: 3px 3px 6px; }

/* ---------- 8. The "@" list of measures and actions (W2 m5): one name per line, never touching the edge ---------- */
.at-list:has(.at-g) { flex-direction: column; flex-wrap: nowrap; align-items: stretch; gap: 1px; width: max-content; min-width: 200px; padding: 6px 6px 8px; }
.at-list:has(.at-g) .at-i { white-space: normal; text-align: left; min-height: 38px; padding: 7px 12px; line-height: 1.3; overflow-wrap: anywhere; }
.at-list:has(.at-g) .at-g { margin: 6px 12px 2px; }

/* ---------- 9. A typed voice note on its way (field-voice.js `pending`) ---------- */
/* It stands at the end of the chat at once, "Making…" in place of the player, until the stored message arrives. */
.cf-pend { margin-top: 14px; }
.cf-pend .rq-len { color: color-mix(in srgb, var(--on-ink) 78%, transparent); }
