/* Daily Life Doc, round 13 (zone F1): a client's Chat (js/chat/chat-view.js, chat-msg.js, chat-field.js,
   chat-files.js), drawn as the page "Expert Plans" draws the expert's Chat: the client's grey bubbles on the left,
   the AI's white outlined bubbles and the expert's deep green ones (--mine) on the right, each with its small label
   ("Text", "AI · Text", "You · Telegram"), the day and time dividers in the middle, the plan line's chip under an AI
   message in the line kind's colour, "Not delivered · <why>" in red, and the field at the foot. */

.cm-chat { position: relative; }
.cm-scroll { padding: 14px 18px 10px; }
.cm-list { display: flex; flex-direction: column; min-height: 100%; }
.cm-list > .emp { flex: 1; }
.cm-k { display: flex; flex-direction: column; }
.cm-k:first-child { margin-top: auto; }

/* ---------- A message ---------- */
.cm { display: flex; flex-direction: column; max-width: min(72%, 560px); margin-top: 10px; animation: cm-in var(--m-add) var(--ease-out); }
.cm-in { align-self: flex-start; align-items: flex-start; }
.cm-ai, .cm-me { align-self: flex-end; align-items: flex-end; }
.cm-l { padding: 0 6px 3px; font-size: var(--t-2xs); font-weight: 500; color: var(--ink3); white-space: nowrap; }
/* The time and a routine text's plan line join the label on hover, on focus, or after a tap (.open). */
.cm-more { display: none; }
.cm-more i { font-style: normal; opacity: .75; }
.cm:hover .cm-more, .cm.open .cm-more, .cm:focus-within .cm-more { display: inline; }
.cm-body { position: relative; display: flex; flex-direction: column; align-items: inherit; max-width: 100%; }
.cm-b { padding: 8px 14px; border-radius: 16px; font-size: var(--t-s); line-height: 1.42; overflow-wrap: anywhere; }
.cm-in .cm-b { background: var(--bubble); color: var(--ink); border-bottom-left-radius: 6px; }
.cm-ai .cm-b { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--cardline); border-bottom-right-radius: 6px; }
.cm-me .cm-b { background: var(--mine); color: var(--on-mine); border-bottom-right-radius: 6px; }
.cm-me .cm-b a { color: inherit; }
.cm-t { white-space: pre-wrap; }
.cm-tr { display: block; font-size: var(--t-2xs); font-weight: 600; color: var(--ink3); }
.cm-files + .cm-b { margin-top: 4px; }
.cm-k[data-local] .cm-b { opacity: .7; }
@keyframes cm-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* A link the message carries: its title and its address, as a card inside the bubble. */
.cm-link { display: flex; flex-direction: column; gap: 1px; margin-top: 2px; text-decoration: none; color: inherit; }
.cm-t + .cm-link { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--cardline); }
.cm-link b { font-size: var(--t-s); font-weight: 600; }
.cm-link span { font-size: var(--t-xs); color: var(--ink3); overflow-wrap: anywhere; }
.cm-me .cm-link span { color: color-mix(in srgb, var(--on-mine) 75%, transparent); }

/* Under a message: Reading…, Add to plan, the buttons it carried, its delivery. */
.cm-u { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 4px 0; }
.cm-u .qw { font-size: var(--t-xs); }
/* Add to plan: under the newest client message; beside the bubble of the others on hover or a tap, keeping no room. */
.cm-body > .cm-add { position: absolute; left: 100%; bottom: 2px; margin-left: 8px; white-space: nowrap; opacity: 0; pointer-events: none;
  transition: opacity var(--m-step) ease; }
.cm:hover .cm-body > .cm-add, .cm.open .cm-body > .cm-add, .cm-body > .cm-add:focus-visible { opacity: 1; pointer-events: auto; }
.cm-btns { display: inline-flex; gap: 4px; }
.cm-btns span { padding: 2px 10px; border-radius: 999px; background: var(--soft); color: var(--ink2); font-size: var(--t-xs); font-weight: 600; }
.cm-dl { font-size: var(--t-xs); font-weight: 500; color: var(--ink3); }
.cm-dl.bad { color: var(--bad-d); }
.cm-dl button { font: inherit; color: inherit; text-decoration: underline; text-underline-offset: 2px; }

/* The plan line's chip under an AI message, in the middle, in the kind's colour. */
.cm-mid { display: flex; justify-content: center; margin-top: 8px; }
.cm-chip { padding: 4px 12px; border-radius: 999px; font-size: var(--t-xs); font-weight: 500; text-align: center; }
.cm-chip.k-sch { background: var(--atlas-bg); color: var(--atlas-d); }
.cm-chip.k-when { background: var(--try-bg); color: var(--try-d); }
.cm-chip.k-ask { background: var(--good-bg); color: var(--good-d); }
.cm-chip.k-rep { background: var(--soft); color: var(--ink2); }
.cm-chip.k-apr { background: var(--care); color: var(--care-d); }

/* A line by the system, and the dividers. */
.cm-sys { align-self: center; max-width: 90%; margin-top: 10px; }
.cm-sys span { display: inline-block; padding: 4px 12px; border-radius: 999px; background: var(--care); color: var(--care-d); font-size: var(--t-xs); font-weight: 500; text-align: center; }
.cm-sys.grey span { background: var(--soft); color: var(--ink2); }
.cm-day { align-self: center; margin: 16px 0 2px; font-size: var(--t-xs); font-weight: 500; color: var(--ink3); text-align: center; }
.cm-day i, .cptime i { font-style: normal; color: var(--ink3); opacity: .75; }

/* Files in a message. */
.cm-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.cm-in .cm-files { justify-content: flex-start; }
.cm-ai .cm-files, .cm-me .cm-files { justify-content: flex-end; }
.cf-ph img { display: block; width: 180px; height: 180px; object-fit: cover; border-radius: 14px; background: var(--soft); }
.cf-vid { display: block; width: 240px; max-width: 100%; border-radius: 14px; background: #000; }
.cf-voice { display: flex; flex-direction: column; gap: 4px; padding: 8px 10px; border-radius: 14px; background: var(--bubble); }
.cf-voice small { font-size: var(--t-2xs); font-weight: 600; color: var(--ink3); }
.cf-voice audio { width: 240px; max-width: 100%; height: 36px; }
.cf-file { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border-radius: 12px; background: var(--soft); color: var(--ink); font-size: var(--t-sm); text-decoration: none; }
.cf-file svg { width: 16px; height: 16px; flex: none; }
.cf-file small { color: var(--ink3); }
.cf-wait { width: 120px; height: 90px; border-radius: 14px; background: var(--soft); }

/* ---------- The quiet line while Pause AI is on, the field ---------- */
.cm-paused { flex: none; padding: 7px 16px; border-top: 1px solid var(--cardline); background: var(--try-bg); color: var(--try-d); font-size: var(--t-xs); font-weight: 500; text-align: center; }
.cm-field { align-items: flex-end; }
.cm-plus { width: 40px; height: 40px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--field); color: var(--ink2);
  transition: transform var(--m-press) var(--ease-out); }
.cm-plus:active, .csend:active { transform: scale(.92); }
.cm-plus svg { width: 18px; height: 18px; }
.cm-box { flex: 1; min-width: 0; min-height: 40px; max-height: 150px; padding: 9px 14px; border: 0; border-radius: 20px; background: var(--field); color: var(--ink);
  font: inherit; font-size: var(--t-s); line-height: 1.4; resize: none; outline: none; }
.cm-box:focus { box-shadow: inset 0 0 0 1.5px var(--sage); }
.cm-up { align-self: center; font-size: var(--t-xs); }
/* The knowledge base item picked with "@" (fixer FX-AT): one pill on its own row above the words, with ✕. */
.cm-field { flex-wrap: wrap; }
.cm-pick { flex: 1 0 100%; display: flex; align-items: center; gap: 2px; padding-left: 48px; animation: cm-pick-in var(--m-step) var(--ease-out); }
.cm-pick[hidden] { display: none; }
.cm-pick .kref { max-width: calc(100% - 32px); overflow: hidden; text-overflow: ellipsis; }
.cm-unpick { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; color: var(--ink3); }
.cm-unpick svg { width: 12px; height: 12px; }
@keyframes cm-pick-in { from { opacity: 0; transform: translateY(4px); } }
.csend { transition: opacity var(--m-step) ease, transform var(--m-press) var(--ease-out); }

@media (max-width: 880px) {
  .cm-scroll { padding: 10px 12px 8px; }
  /* No room beside a bubble on a phone: a tap shows Add to plan under the message. */
  .cm.open .cm-body > .cm-add { position: static; margin: 4px 0 0 4px; align-self: flex-start; }
  .cm { max-width: 86%; }
  .cf-ph img { width: 150px; height: 150px; }
}

/* Round 14a (zone Z5, M7): the pink "Add to plan" under a client's message (js/chat/chat-suggest.js), on the left
   under the client's bubble, as the page "Rounds 14 to 18" draws it: the suggested line in quotes, Apply and Skip. */
.cm-sug { align-self: flex-start; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; max-width: min(84%, 600px); margin-top: 6px;
  padding: 8px 8px 8px 12px; border-radius: 14px; background: var(--care); color: var(--care-d); font-size: var(--t-sm); line-height: 1.4;
  animation: cm-in var(--m-add) var(--ease-out); transition: opacity var(--m-remove) ease, transform var(--m-remove) ease; }
.cm-sug.leaving { opacity: 0; transform: translateY(-4px); }
.cm-sug-t { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.cm-sug-t b { font-weight: 600; }
.cm-sug-b { display: flex; gap: 6px; }
.cm-sug .pill:not(.dark) { background: var(--surface); color: var(--ink); }
@media (max-width: 480px) { .cm-sug { max-width: 100%; } }
/* The message's own "Add to plan" is not shown beside the pink one: the pink already offers the line. */
.cm-k:has(.cm-sug) .cm-add { display: none; }
