/* Daily Life Doc: the one chat (round 6; round 9, zone U; round 10, zone P: docs/build/r10/PLAN.md section 3.2, the
   page "One chat", Part 1). Three parts, drawn by the files under js/req/ and js/convo/:
     1. the rows at the top of Today: one soft tint, the words cut after two lines ("App" before the app's own
        question), the answer buttons, the call rows; Clear behind a row (a swipe) and the ✕ on a computer; the
        character's host under the rows (req-row.js, req-top.js, req-swipe.js, js/today/today-char.js)
     2. the page `chat` and Patient's view (req-chat*.js, convo-msg.js, convo-keyed.js, convo-view.js): the frame with
        its columns, the day dividers, "Reading…", "Not sent · Try again", "App", the Call me card (css/chat.css)
     3. photos and files inside a message (js/msg/msg-files.js)
   Tokens and the type scale of base.css only. Pink (--care, --tint-team) is only what the care team alone sees; the
   patient reads white and ink. */

/* ---------- 1. The rows at the top of Today ---------- */
/* One soft tint holds the rows from the care team. No heading and no "Care team:": every row comes from the care team
   or the app. */
.rq-top { padding: 4px 0; border-radius: 22px; background: var(--tint); overflow: hidden; }
/* A row that leaves by itself (answered elsewhere, a call time passed) fades out after the drawing: once the last row
   is gone the empty tint must not stay as a strip at the top of Today. */
.rq-top[hidden], .rq-top:empty { display: none; }

/* The character's host under the rows: the middle character takes its own room; the corner one is fixed (char.css). */

/* One row: the item holds the button Clear behind the row; the row slides over it. */
.rq-item { position: relative; overflow: hidden; }
.rq-item[hidden] { display: none; }
/* DF1 (design review finding 1): two or more voice notes stand folded in one row "Voice notes · N" until tapped. */
.rq-vfold { position: relative; display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 10px 18px; border: 0; background: var(--tint);
  font: inherit; font-size: var(--t-m); color: var(--ink); text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rq-item + .rq-vfold::before, .rq-vfold + .rq-item .rq-row::before { content: ''; position: absolute; top: 0; left: 52px; right: 18px; height: 1px; background: color-mix(in srgb, var(--line) 70%, transparent); pointer-events: none; }
.rq-vfold:active { background: color-mix(in srgb, var(--tint) 80%, var(--soft)); }
.rq-vfold-i { flex: none; width: 22px; height: 22px; display: grid; place-items: center; color: var(--ink2); }
.rq-vfold-i svg { width: 16px; height: 16px; }
.rq-vfold i { margin-left: auto; display: grid; place-items: center; color: var(--ink3); font-style: normal; }
.rq-vfold i svg { width: 16px; height: 16px; }
/* Round 12, DF1 (DESIGN-1 findings 1 and 13): a row that opens in place points down; the older rows behind "N more". */
.rq-vfold i.is-down svg { transform: rotate(90deg); }
.rq-more .rq-vfold-i::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--ink3); }
.rq-more { color: var(--ink2); }
.rq-top > .is-more { display: none; }
/* The hairline between two rows belongs to the lower row, so it slides with the row and never runs across Clear. */
.rq-item + .rq-item .rq-row::before { content: ''; position: absolute; top: 0; left: 52px; right: 18px; height: 1px; background: color-mix(in srgb, var(--line) 70%, transparent); pointer-events: none; }
/* Clear has the shape and the type of Remove in a measurement's history (css/atlas.css .ms-rm): one swipe, one look;
   the colour says what happens (Clear only takes the row off Today, in ink; Remove erases a value, in red), as the
   page draws the two. */
.rq-clr { position: absolute; top: 0; right: 0; bottom: 0; width: 96px; display: grid; place-items: center; background: var(--ink); color: var(--on-ink);
  font-size: var(--t-s); font-weight: 600; opacity: 0; transition: opacity 160ms ease; }
.rq-item.is-open .rq-clr, .rq-item:has(.rq-row[style*="translate"]) .rq-clr { opacity: 1; }
.rq-row { position: relative; display: flex; align-items: flex-start; gap: 12px; min-height: 48px; padding: 10px 18px; background: var(--tint);
  cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: pan-y; transition: background-color var(--m-press) ease; }
.rq-row:active { background: color-mix(in srgb, var(--tint) 80%, var(--soft)); }
/* The circle: open for a question, a small dot for something to read, a phone for a call row. */
.rq-o { flex: none; width: 22px; height: 22px; margin-top: 3px; border-radius: 50%; display: grid; place-items: center; color: transparent;
  box-shadow: inset 0 0 0 1.75px color-mix(in srgb, var(--ink3) 70%, transparent); transition: background-color var(--m-step) ease, box-shadow var(--m-step) ease, color var(--m-step) ease; }
.rq-o svg { width: 13px; height: 13px; }
.rq-o.is-dot { box-shadow: none; }
.rq-o.is-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--ink2); }
.rq-o.is-dot svg { display: none; }
.rq-o.is-call { box-shadow: none; background: var(--surface); color: var(--ink2); }
.rq-o.is-call svg { width: 13px; height: 13px; }
.rq-row.is-done .rq-o, .rc-ct.is-done .rq-o { background: var(--done); box-shadow: none; color: var(--surface); }
.rq-row.is-done .rq-o.is-dot::before { display: none; }
.rq-m { flex: 1; min-width: 0; }
/* The words and what follows them: beside the words when the words are short, under them when the words fill the
   line (a wrapping flex row). The words are cut after two lines with "…". */
.rq-t { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px; font-size: var(--t-m); line-height: 26px; }
.rq-w { min-width: 0; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; }
.rq-who { font-weight: 600; color: var(--ink2); }
.rq-row.is-done .rq-w { color: var(--ink2); }
.rq-row .cc { margin-left: 0; flex: none; }
.rq-row .cc .x { color: var(--ink3); font-weight: 400; }
.rq-row .cc .v { color: var(--ink); font-weight: 600; }
.rq-row .cc.yn > * + * { margin-left: 14px; }
/* A quiet word after the words: Document, the day of a question for another day, the time of a call. */
.rq-k { flex: none; font-size: var(--t-xs); font-weight: 500; color: var(--ink3); white-space: nowrap; }
.rq-n { font-size: var(--t-sm); line-height: 1.45; color: var(--ink3); display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
/* The answers of a call time: Yes and Another time, words that take a tap. */
.ct2 { flex: none; display: inline-flex; gap: 16px; white-space: nowrap; }
.ct2 > * { position: relative; color: var(--ink3); }
.ct2.live > button { color: var(--ink); font-weight: 500; }
.ct2.live > button::after { content: ''; position: absolute; inset: -8px -8px; }
.ct2.live > button:active { opacity: .55; }
.ct2.is-set b { color: var(--ink); font-weight: 600; }
/* An answered row shows its answer for a moment, then folds away. */
.rq-row.is-leaving { cursor: default; animation: rq-set 360ms var(--ease-out) both; }
@keyframes rq-set { from { background: color-mix(in srgb, var(--done) 22%, var(--tint)); } }
/* A voice note plays in the row; its words stand under the player. */
.rq-voice { margin: 4px 0 2px; max-width: 250px; min-height: 34px; display: flex; align-items: center; }
.rq-top .vn-b { background: var(--surface); }
.rq-top .vn.on .vn-b { background: var(--ink); color: var(--on-ink); }
.rq-len { font-size: var(--t-xs); color: var(--ink2); }
.rq-said { color: var(--ink2); -webkit-line-clamp: 5; } /* DF1 (finding 10): a voice note's words in full at 340 px */
/* A photo or a file in a row: small, under the words. */
.rq-files .mg-files { max-width: none; margin: 6px 0 2px; }
.rq-files .mg-f, .rq-files .mg-files.one .mg-f { width: 56px; height: 56px; border-radius: 12px; }
.rq-files .mg-f.doc { height: 44px; min-width: 0; max-width: 220px; border-radius: 12px; }
/* The ✕ for a pointer that rests on the row (a computer); a finger swipes instead. */
.rq-xc { flex: none; display: none; width: 28px; height: 28px; margin: 0 -6px 0 0; border-radius: 50%; place-items: center; color: var(--ink3); transition: background-color var(--m-press) ease, color var(--m-press) ease; }
.rq-xc svg { width: 14px; height: 14px; }
@media (hover: hover) and (pointer: fine) {
  .rq-xc { display: grid; opacity: 0; }
  .rq-row:hover .rq-xc, .rq-xc:focus-visible { opacity: 1; }
  .rq-xc:hover { background: var(--soft); color: var(--ink); }
}
/* Today with no experiment, as the patient reads Today (js/today/none.js): the quiet links under the rows. */

/* ---------- 2. The conversation page, and Patient's view ---------- */
/* The body is a column that does not scroll: the messages (only they scroll), then the field. */
.pg-body.rc { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.rc-scroll { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; padding: 8px var(--gut) 12px;
  scrollbar-width: none; overscroll-behavior: contain; animation: dd-fade 240ms ease both; }
.rc-scroll::-webkit-scrollbar { display: none; }
/* Few messages rest at the bottom, next to the field. */
.rc-list { margin-top: auto; display: flex; flex-direction: column; }
.rc-tail:empty { display: none; }
/* The item a chat opened at (a row of Today, the character, Versions' Chat): a soft tint that holds, then fades. */
.rc-here { animation: rc-here 4.2s ease-out 1; }
@keyframes rc-here { 0%, 60% { box-shadow: 0 0 0 4px var(--pc-bg), 0 0 0 6px color-mix(in srgb, var(--pc) 55%, transparent); } 100% { box-shadow: 0 0 0 4px transparent, 0 0 0 6px transparent; } }
.rc-foot { flex: none; padding: 6px 12px calc(14px + env(safe-area-inset-bottom, 0px)); }

/* One message: who and when, then the bubble. The reader's own messages stand at the right, in ink. */
.rc-m { display: flex; flex-direction: column; align-items: flex-start; }
.rc-m.me { align-items: flex-end; }
.rc-by { margin: 12px 12px 4px; font-size: var(--t-xs); font-weight: 600; line-height: 1.4; color: var(--ink2); }
.rc-by small { margin-left: 6px; font-size: var(--t-2xs); font-weight: 400; color: var(--ink3); }
.rc-b { max-width: 84%; padding: 10px 14px 11px; border-radius: 20px; border-bottom-left-radius: 7px; background: var(--surface); font-size: 15.5px; line-height: 1.45; }
.rc-b p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.rc-b p + p, .rc-b .rq-voice + p { margin-top: 4px; }
.rc-b a { color: inherit; text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; overflow-wrap: anywhere; }
.rc-m.me .rc-b { background: var(--ink); color: var(--on-ink); border-bottom-left-radius: 20px; border-bottom-right-radius: 7px; }
.rc-m.sending .rc-b, .rc-m.sending .mg-files { opacity: .6; }
.rc-m.fresh, .rc-line.fresh { animation: rc-in 360ms var(--ease-out) both; transform-origin: 0 100%; }
.rc-m.me.fresh { transform-origin: 100% 100%; }
@keyframes rc-in { from { opacity: 0; transform: translateY(14px) scale(.94); } }
/* Deleted: the message keeps its place, both sides read the word. */
/* A deleted message: a quiet grey word in its place, for the care team only (the patient's chat leaves it out). */
.rc-del { margin: 0; font-size: var(--t-xs); color: var(--ink3); }
.rc-m.is-del.me .rc-del { text-align: right; }
/* A voice note in a bubble. */
.rc-b .rq-voice { min-width: 210px; margin: 0 0 6px; }
.rc-m.me .rc-b .vn { color: var(--on-ink); }
.rc-m.me .rc-b .vn-b { background: var(--on-ink); color: var(--ink); }
.rc-m.me .rc-b .vn-w { background: repeating-linear-gradient(90deg, var(--on-ink) 0 2px, transparent 2px 6px); }
.rc-m.me .rc-b .vn-w i { background: repeating-linear-gradient(90deg, var(--on-ink) 0 2px, var(--ink) 2px 6px); }
.rc-m.me .rc-b .vn small { color: color-mix(in srgb, var(--on-ink) 78%, transparent); }
/* A document card from the care team: the title and the word Document; a tap opens the document page. */
.rc-card { max-width: 84%; min-width: 220px; display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 20px; border-bottom-left-radius: 7px;
  background: var(--surface); text-align: left; color: var(--ink); transition: transform var(--m-press) var(--ease-out); }
.rc-card:active { transform: scale(0.985); }
.rc-card > i:first-child { flex: none; width: 36px; height: 36px; border-radius: 12px; display: grid; place-items: center; background: var(--soft); color: var(--ink2); }
.rc-card > i:first-child svg { width: 18px; height: 18px; }
.rc-card span { flex: 1; min-width: 0; }
.rc-card b { display: block; font-size: var(--t-s); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.rc-card small { display: block; margin-top: 1px; font-size: var(--t-xs); color: var(--ink3); }
.rc-card.is-still { cursor: default; }
/* The answer part of a question, under a hairline: the circle and the control of a line of Today. */
.rc-ct { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: var(--t-m); line-height: 28px; }
.rc-ct .rq-o { margin-top: 0; }
.rc-ct .cc { margin-left: 0; }
.rc-ct .cc .x { color: var(--ink3); font-weight: 400; }
.rc-ct .cc .v { color: var(--ink); font-weight: 600; }
.rc-ct .cc.yn > * + * { margin-left: 14px; }
.rc-m.me .rc-ct { border-top-color: color-mix(in srgb, var(--on-ink) 22%, transparent); }
/* On the care team's own ink bubble the patient's answer reads in the bubble's own light ink ("✓ Yes", "✓ 7",
   "✓ Another time"), in light and dark; the buttons not taken stay quiet. */
.rc-m.me .rc-ct .cc .v, .rc-m.me .rc-ct .ct2.is-set b { color: var(--on-ink); }
.rc-m.me .rc-ct .cc .x, .rc-m.me .rc-ct .ct2 > * { color: color-mix(in srgb, var(--on-ink) 62%, transparent); }
.rc-m.me .rc-ct .rq-o { box-shadow: inset 0 0 0 1.75px color-mix(in srgb, var(--on-ink) 50%, transparent); }
.rc-m.me .rc-ct.is-done .rq-o { box-shadow: none; }
/* A question that no longer stands on the patient's Today: its buttons read only, quieter; "Time passed" after a
   call time whose moment passed (the care team). */
.rc-ct.is-ended .cc, .rc-ct.is-ended .ct2 { opacity: .55; }
.rc-ct.is-ended .rq-o { opacity: .5; }
/* "Time passed" on a line of its own under the faded buttons (walk 3, minor 4). */
.rc-tp { flex: 0 0 100%; margin: -4px 0 0; font-size: var(--t-xs); font-weight: 600; line-height: 1.4; }
.rc-m.me .rc-tp { color: color-mix(in srgb, var(--on-ink) 78%, transparent); }
/* A grey line with no name, centred: what an approved proposal changed. With a chevron it opens what it names. */
.rc-line { align-self: center; max-width: 92%; margin-top: 12px; padding: 5px 12px 6px; border-radius: 13px; background: var(--soft); font-size: var(--t-sm); line-height: 1.45; color: var(--ink2); text-align: center; }
.rc-last { white-space: nowrap; }
.rc-line .rq-chev { width: 6px; height: 6px; margin: 0 2px 1px 4px; }
button.rc-line { transition: transform var(--m-press) var(--ease-out); }
button.rc-line:active { transform: scale(0.97); }
/* What only the care team sees, in pink: the words to the AI, a line ("Dropped: …"), what allowed a message. */
.rc-m.tm .rc-b { background: var(--tint-team); color: var(--ink); border-bottom-right-radius: 7px; border-bottom-left-radius: 20px; }
.rc-by.tm { color: var(--care-d); }
.rc-kind { font-weight: 600; color: var(--care-d); }
.rc-line.tm { background: var(--tint-team); color: var(--care-d); }
.rc-why { margin: 12px 12px -6px; font-size: var(--t-2xs); font-weight: 600; line-height: 1.4; color: var(--care-d); }
/* Patient's view: the patient's conversation under zone F's pink bar, read only. */
.cv { display: flex; flex-direction: column; padding: 4px var(--gut) 24px; }
.cv-title { margin: 6px 2px 4px; font-size: var(--t-l); font-weight: 600; line-height: 1.3; text-wrap: balance; overflow-wrap: anywhere; }
.cv .rc-list { margin-top: 0; }
.cv .cc, .cv .ct2 > * { cursor: default; }

/* ---------- 3. Photos and documents in a message (js/msg/msg-files.js) ---------- */
/* Every attachment has its size before its file is
   read, so the chat never moves when a picture arrives. */
.mg-files { max-width: 84%; display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 3px; }
.rc-m.me .mg-files { justify-content: flex-end; }
.mg-f { flex: none; width: 104px; height: 104px; border-radius: 16px; overflow: hidden; background: var(--soft); color: var(--ink); text-align: left; transition: transform 140ms var(--ease-out); }
.mg-f:active { transform: scale(0.97); }
.mg-files.one .mg-f { width: 216px; height: 162px; border-radius: 20px; }
.mg-f img { display: block; width: 100%; height: 100%; object-fit: cover; }
.mg-f.in img, .mg-f.in svg, .mg-f.in .mg-fn { animation: dd-fade 260ms ease both; }
.mg-f.doc, .mg-files.one .mg-f.doc { width: auto; max-width: 100%; min-width: 150px; height: 56px; padding: 0 16px 0 12px; display: inline-flex; align-items: center; gap: 10px; border-radius: 18px; background: var(--surface); }
.mg-f.doc svg { flex: none; width: 22px; height: 22px; color: var(--ink2); }
.mg-fn { min-width: 0; display: grid; gap: 1px; }
.mg-fn b { font-size: var(--t-s); font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mg-fn small { font-size: var(--t-xs); line-height: 1.3; color: var(--ink2); }
.mg-big { max-height: 68vh; object-fit: contain; background: var(--soft); }
.mg-open { color: var(--ink); text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  .rc-m.fresh, .rc-line.fresh, .rc-scroll, .rq-row.is-leaving { animation: none; }
  .rq-row, .rq-wb .rq-chev { transition: none; }
}
/* A call that took place or was missed: zone C's centred line, with no name (js/req/req-chat-call.js). */
.rc-call { align-self: stretch; display: flex; flex-direction: column; align-items: center; }
.rc-call.fresh { animation: rc-in 360ms var(--ease-out) both; }
@media (prefers-reduced-motion: reduce) { .rc-call.fresh { animation: none; } }
