/* The comment thread: one stylesheet for every task and note thread (drawer, notes, framed editor,
   board modal, phone). Painted by JS/components/comment-thread.js; the list root is `.cmt-thread`.
   Colours come from CSS/tokens.css, so both themes follow the reader's choice. Geometry (radii,
   the mono face) is declared once on `.cmt-thread` with the Suite's values as fallbacks. The
   stylesheet does not depend on `.alt-app`, because the phone loads no Suite sheet. */

.cmt-thread{
  --cmt-r:9px;
  --cmt-r-pill:999px;
  --cmt-body:var(--app-font, system-ui, -apple-system, sans-serif);
  /* No canonical gold exists; this is the Suite's emphasis colour for "mentioned you", value for
     value. Gold is emphasis, never status. The light values sit in the theme block below. */
  --cmt-gold:#f5a623;
  --cmt-gold-soft:rgba(245,166,35,.16);
  display:flex; flex-direction:column; gap:8px; min-width:0;
}
:root.theme-light .cmt-thread, body.theme-light .cmt-thread{
  --cmt-gold:#b06d05;
  --cmt-gold-soft:rgba(176,109,5,.14);
}

/* ---------- empty and loading: the three states, in the thread's own words ---------- */
.cmt-thread > .a-empty{
  display:flex; flex-direction:column; align-items:center; justify-content:center; gap:10px;
  margin:auto 0; padding:24px 16px; text-align:center;
}
.cmt-thread > .a-empty > .a-empty-h{ font-size:var(--a-fs-14); font-weight:600; color:var(--text-dim); }
.cmt-thread > .a-empty > .a-empty-p{ font-size:var(--a-fs-12); line-height:var(--a-lh-body); color:var(--text-faint); max-width:46ch; margin:0; }
.cmt-thread > .a-load{
  display:flex; align-items:center; justify-content:center; gap:10px; margin:auto 0; padding:34px 16px;
  font-size:var(--a-fs-12); color:var(--text-faint);
}

/* ---------- one day from the next ----------
   Drawn through the label so the boundary is unmistakable. */
.cmt-thread .a-conv-day{
  display:flex; align-items:center; gap:8px; margin:8px 0 0;
  font-size:var(--a-fs-11); font-weight:700; letter-spacing:.09em; text-transform:uppercase;
  color:var(--text-dim);
}
.cmt-thread .a-conv-day::before,
.cmt-thread .a-conv-day::after{ content:''; flex:1 1 auto; height:1px; background:var(--border-soft); }
.cmt-thread > .a-conv-day:first-child{ margin-top:0; }

/* ---------- avatar ----------
   The disc a thread row carries. Declared here so a host that loads no Suite sheet still draws it;
   the background is the author's colour, set inline by the painter. */
.cmt-thread .a-av{
  width:24px; height:24px; border-radius:50%; flex:0 0 auto;
  display:inline-flex; align-items:center; justify-content:center;
  font-size:var(--a-fs-11); font-weight:700; letter-spacing:.02em;
  background:var(--accent-fill); color:var(--a-on-fill); overflow:hidden;
}
.cmt-thread .a-av.more{ background:var(--panel-2); color:var(--text-dim); font-weight:700; }

/* ---------- system rows: a quiet event line, not a person's remark (D2) ----------
   No card, no edge, no flag, no actions. The line says what happened and when, in faint text. */
.cmt-thread .a-event{
  display:flex; align-items:baseline; gap:6px; flex-wrap:wrap;
  padding:2px 11px; font-size:var(--a-fs-12); line-height:var(--a-lh-ui); color:var(--text-faint);
}
.cmt-thread .a-event-ic{ flex:0 0 auto; }
.cmt-thread .a-event-t{ flex:0 1 auto; min-width:0; overflow-wrap:anywhere; }
.cmt-thread .a-event-w{
  flex:0 0 auto; margin-left:auto; font:500 var(--a-fs-11)/var(--a-lh-ctl) var(--a-body, var(--cmt-body)); font-variant-numeric:tabular-nums;
}

/* ---------- a message ----------
   The avatar is a column spanning all three grid rows, so it stays beside the top of the body
   however long it runs. */
.cmt-thread .a-comment{
  display:grid; grid-template-columns:minmax(0,1fr); align-items:start;
  padding:9px 11px; border-radius:var(--cmt-r);
  background:var(--panel-2); border:1px solid var(--border-soft);
  border-left:2px solid var(--border-strong);
  transition:border-color var(--dur-quick) var(--ease-out), background-color var(--dur-quick) var(--ease-out);
}
.cmt-thread .a-comment:has(> .a-av){ grid-template-columns:auto minmax(0,1fr); column-gap:10px; }
.cmt-thread .a-comment:has(> .a-av) > .a-av{ grid-column:1; grid-row:1 / span 4; margin-top:1px; }
.cmt-thread .a-comment:has(> .a-av) > .a-comment-h{ grid-column:2; grid-row:1; }
.cmt-thread .a-comment:has(> .a-av) > .a-comment-b{ grid-column:2; grid-row:2; }
.cmt-thread .a-comment:has(> .a-av) > .a-comment-r{ grid-column:2; grid-row:3; }
.cmt-thread .a-comment:has(> .a-av) > .a-comment-a{ grid-column:2; grid-row:4; }
.cmt-thread .a-comment:hover{ border-left-color:var(--accent); }

.cmt-thread .a-comment-h{
  display:flex; align-items:baseline; gap:8px; min-width:0; flex-wrap:wrap;
}
.cmt-thread .a-comment .who{
  font:600 var(--a-fs-13)/var(--a-lh-tight) var(--a-body, var(--cmt-body)); color:var(--text);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%;
}
/* The stamp is the smallest thing in the row and sits at the far end, so a column of them lines up. */
.cmt-thread .a-comment .when{
  margin-left:auto; flex:0 0 auto;
  font:500 var(--a-fs-11)/var(--a-lh-ctl) var(--a-body, var(--cmt-body)); color:var(--text-faint); font-variant-numeric:tabular-nums;
}
.cmt-thread .a-comment-b{
  font-size:var(--a-fs-13); line-height:var(--a-lh-body); color:var(--text);
  margin:4px 0 0; overflow-wrap:anywhere; white-space:pre-wrap;
}
/* accent-text, not accent: a link is text and the fill colour is below 4.5:1 on this ground.
   Underlined, because colour is never alone. */
/* An event line's link (e.g. the merge line's task title) reads as a link in both themes, like a comment body's. */
.cmt-thread .a-comment-b a, .cmt-thread .a-event-t a{ color:var(--accent-text); text-decoration:underline; text-underline-offset:2px; }
.cmt-thread .a-comment-b a:hover, .cmt-thread .a-event-t a:hover{ text-decoration-thickness:2px; }
.cmt-thread .a-comment-b a:focus-visible, .cmt-thread .a-event-t a:focus-visible{ outline:2px solid var(--focus-ring); outline-offset:2px; border-radius:var(--a-r-sm); }

/* ---------- what a message can say about itself ----------
   Each state is a word as well as a colour ("New", "Mentioned you" in the header). */
.cmt-thread .a-comment-flag{
  flex:0 0 auto; display:inline-flex; align-items:center; height:16px; padding:0 6px;
  border-radius:var(--cmt-r-pill); font:700 var(--a-fs-11)/var(--a-lh-ctl) var(--a-body, var(--cmt-body)); letter-spacing:.07em;
  text-transform:uppercase; background:var(--accent-soft); color:var(--accent-text);
}
.cmt-thread .a-comment-flag:empty{ display:none; }
/* Mark read: the badge fades while the card's glow eases to normal (JS removes the text after). */
.cmt-thread .a-comment-flag{ transition:opacity var(--dur-quick) var(--ease-out); }
.cmt-thread .a-comment-flag.is-leaving{ opacity:0; }
.cmt-thread .a-comment.unread{ border-left-color:var(--accent); background:var(--accent-soft); }
.cmt-thread .a-comment.at-me{ border-left-color:var(--cmt-gold); }
.cmt-thread .a-comment.at-me .a-comment-flag{ background:var(--cmt-gold-soft); color:var(--cmt-gold); }
/* My own remark is QUIETER, not louder: in a thread the thing being looked for is what someone
   ELSE said, and a page of my own comments in the accent colour buries it. */
.cmt-thread .a-comment.mine{ background:var(--panel); border-left-color:var(--border-soft); }
/* Said in a word, as its own element, because `.who` truncates and a marker inside it would be the
   first thing an ellipsis ate. */
.cmt-thread .a-comment-me{
  flex:0 0 auto; font:600 var(--a-fs-11)/var(--a-lh-ctl) var(--a-body, var(--cmt-body)); letter-spacing:.07em; text-transform:uppercase;
  color:var(--text-dim);
}
.cmt-thread .a-comment-me:empty{ display:none; }
/* A reply is indented and tethered. The thread comes back flat, so the relationship is drawn. */
.cmt-thread .a-comment.is-reply{ margin-left:16px; }
.cmt-thread .a-comment-re{
  flex:0 1 auto; min-width:0; font:500 var(--a-fs-11)/var(--a-lh-tight) var(--a-body, var(--cmt-body)); color:var(--text-faint);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
.cmt-thread .a-comment-re:empty{ display:none; }
/* Editing: the card says so with its edge; the body is the rich editor, which carries its own
   frame. A card with no class for this state gets no edge, and the reader cannot tell. */
.cmt-thread .a-comment.is-editing{ border-left-color:var(--accent); }
/* The comment the Message Center or a fresh post sent the reader to, said once. */
.cmt-thread .a-comment.comment-focused{ outline:2px solid var(--focus-ring); outline-offset:2px; }

/* ---------- reactions slot (CSS/comment-reactions.css fills it) ----------
   Spacing only. The chips are the reactions component's; an empty slot takes no room. */
.cmt-thread .a-comment-r{ display:flex; flex-wrap:wrap; gap:6px; margin-top:6px; }
.cmt-thread .a-comment-r:empty{ display:none; }

/* ---------- the actions on a message ----------
   Revealed on hover and focus (`:focus-within` keeps them keyboard-reachable); devices with no
   hover get them permanently. */
.cmt-thread .a-comment-a{
  display:flex; gap:5px; margin-top:6px; opacity:0;
  transition:opacity var(--dur-micro) var(--ease-out);
}
.cmt-thread .a-comment:hover .a-comment-a,
.cmt-thread .a-comment:focus-within .a-comment-a{ opacity:1; }
@media (hover:none){ .cmt-thread .a-comment-a{ opacity:1; } }
.cmt-thread .a-comment-a:empty{ display:none; }

/* ---------- narrow ----------
   Under a phone's width the avatar column is most of the row; the name is still in words. */
@media (max-width:560px){
  .cmt-thread .a-comment:has(> .a-av){ grid-template-columns:minmax(0,1fr); column-gap:0; }
  .cmt-thread .a-comment:has(> .a-av) > .a-av{ display:none; }
  .cmt-thread .a-comment:has(> .a-av) > .a-comment-h,
  .cmt-thread .a-comment:has(> .a-av) > .a-comment-b,
  .cmt-thread .a-comment:has(> .a-av) > .a-comment-r,
  .cmt-thread .a-comment:has(> .a-av) > .a-comment-a{ grid-column:1; }
  .cmt-thread .a-comment.is-reply{ margin-left:12px; }
}

@media (prefers-reduced-motion: reduce){
  .cmt-thread .a-comment, .cmt-thread .a-comment-a, .cmt-thread .a-comment-flag{ transition:none; }
}

/* ---------- the read row: "New since you last read" (comment-unread.js) ----------
   THE PHONE'S ROW ONLY (owner, 2026-11-09, D5: the phone stays as it is). The desktop hosts have no ribbon any more: their
   Mark all read / Mark unread are the ••• menu (below), and commentUnreadRender() draws this row only for `row:true`.
   Unscoped because comment-unread.js inserts it beside the list, not inside it. */
.comment-read-row{
  flex:0 0 auto; display:flex; align-items:center; flex-wrap:nowrap; gap:8px;
  margin:6px 12px 8px; padding:4px 10px; container-type:inline-size;
  background:var(--panel-2); border:1px solid var(--border-soft); border-radius:var(--cmt-r, 9px);
}
.comment-read-row > button:first-of-type{ margin-left:auto; }
/* One 44px row: the sort host's button is sized to the row's other buttons, not taller. */
.comment-read-row > span[id$="OrderHost"]{ display:inline-flex; align-items:center; }
.comment-read-row > span[id$="OrderHost"] button{ min-height:var(--a-ctl-sm); padding-block:2px; }
.comment-read-row[hidden]{ display:none; }
.comment-read-row .a-btn, .comment-read-row .btn{ flex:0 0 auto; white-space:nowrap; background:transparent; color:var(--text-dim); }
.comment-read-row .a-btn:hover{ border-color:var(--border-strong); color:var(--text); }
.comment-read-note{
  flex:1 1 auto; min-width:8ch; display:flex; align-items:center; gap:6px;
  font-size:var(--a-fs-11); color:var(--text-faint); white-space:nowrap;
}
/* The words truncate, never the buttons beside them. A flex container cannot ellipsis its
   children's text, so the ellipsis lives on this item. */
.comment-read-words{
  flex:0 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
}
/* Both copies are in the DOM (comment-unread.js); CSS picks one. Under 420px of ROW width (not viewport) the short sentence
   shows and the full one is hidden. The full sentence stays in the note's title. */
.comment-read-full{ display:inline; }
.comment-read-short{ display:none; }
@container (max-width:420px){
  .comment-read-full{ display:none; }
  .comment-read-short{ display:inline; }
}
/* Colour never carries this alone: the row says it in words beside the dot. */
.comment-read-note.unread{ color:var(--accent-text); font-weight:600; }
.comment-read-note .unread-dot{
  width:6px; height:6px; border-radius:50%; background:var(--accent); flex:0 0 auto;
}

/* Screenshot sizes and the comment block layout live in CSS/rt-shot.css. */

/* ---------- the composer fold: one row above the host's composer (comment-composer-fold.js) ----------
   Closed it is an input-shaped bar ("Add a comment…"); open it is the section header ("New comment") over the box. The
   row owns the ends too: a host with no heading mounts its sort and ••• buttons in `.cmt-fold-end`. Tokens are the
   canonical ones, so the sheet still loads without the Suite's. `[hidden]` is restated because `.a-w-fold` sets a display. */
.cmt-fold-row{
  display:flex; align-items:center; gap:6px; min-width:0; container-type:inline-size;
}
.cmt-fold-row .cmt-fold-bar{
  flex:1 1 auto; min-width:0; min-height:34px; padding:4px 10px; gap:8px;
  font-size:var(--a-fs-14); line-height:var(--a-lh-tight);   /* the size of the placeholder and the menu rows beside it, below the 11px caps heading it sits under */
  border:1px solid var(--border-soft); border-radius:var(--radius-sm, 7px); background:var(--panel);
  color:var(--text-faint); cursor:text;
}
.cmt-fold-row .cmt-fold-bar:hover{ border-color:var(--border-strong); }
.cmt-fold-row .cmt-fold-bar:focus-visible{ outline:2px solid var(--focus-ring); outline-offset:2px; border-radius:var(--radius-sm, 7px); }
/* Open, the bar is a header rather than a field: no box, the title carries it. */
.cmt-fold-row .cmt-fold-bar[aria-expanded="true"]{
  border-color:transparent; background:transparent; padding-left:2px; cursor:pointer;
  color:var(--text-dim); font-weight:500;
}
.cmt-fold-bar .cv{ flex:0 0 auto; color:var(--text-faint); }
.cmt-fold-bar .t{ flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.cmt-fold-bar .t.draft{ color:var(--text); font-weight:400; }
.cmt-fold-bar .warn{ flex:0 0 auto; margin-left:auto; font-size:var(--a-fs-12); color:var(--red-text); }
.cmt-fold-bar .t-long{ display:inline; }
.cmt-fold-bar .t-short{ display:none; }
/* The short words are for a row too narrow for the full ones (the row is the container, so a drawer of any width asks about ITSELF). */
@container (max-width:230px){
  .cmt-fold-bar .t-long{ display:none; }
  .cmt-fold-bar .t-short{ display:inline; }
}
/* A reader who may not comment gets the notice in the same slot: words, no chevron, nothing to press. */
.cmt-fold-row .cmt-fold-ro{ flex:1 1 auto; min-width:0; margin:0; padding:6px 2px; font-size:var(--a-fs-13); color:var(--text-faint); }
.cmt-fold-end{ display:inline-flex; align-items:center; gap:4px; flex:0 0 auto; }
.cmt-fold-end:empty{ display:none; }
.cmt-fold-bar[hidden], .cmt-fold-bar .warn[hidden], .cmt-fold-ro[hidden], .cmt-fold-body[hidden]{ display:none !important; }
/* Sort and ••• are 32px on every host, so the team dialog's pair is the drawer's pair. */
.cmt-fold-end .a-btn.icon{ min-width:32px; min-height:var(--a-ctl); }
@media (pointer:coarse){
  .cmt-fold-row .a-btn.icon{ min-width:32px; min-height:var(--a-ctl); }
}

/* ---------- the ••• "Conversation options" button's blue dot ----------
   The tab glow and each card's New flag say it too; the dot keeps it in view where the ribbon's sentence used to be. */
.a-btn[data-cmt-menu]{ position:relative; }
.a-btn[data-cmt-menu] .unread-dot{ position:absolute; top:3px; right:3px; background:var(--accent); }
.a-btn[data-cmt-menu] .unread-dot[hidden]{ display:none; }
