/* Domaselo admin — Chat (WP6). Prefix .ch- only; colours only from the § 1.4 tokens (literals only inside
   color-mix() with a token). The one allowed exception: the media viewer and the press-and-hold overlay's
   scrim stay dark in both themes, through their own --viewer-* literals below. */

/* ================= layout ================= */
.ch { position: absolute; inset: 0; display: flex; }
.ch-side {
  position: relative; flex: none; width: var(--ch-list, 260px); height: 100%; display: flex; flex-direction: column;
  background: var(--bar-solid); box-shadow: inset -1px 0 0 0 var(--line);
}
.ch-side.full { width: 100%; box-shadow: none; }
.ch-side-hdr {
  height: 76px; flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 0 16px;
  box-shadow: inset 0 -1px 0 0 var(--edge);
}
.ch-side-title { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: 0.2px; }
.ch-side-hdr .round.md { width: 32px; height: 32px; border-radius: 16px; }
.ch-side-hdr .round.md svg { width: 14px; height: 14px; }
.ch-list { flex: 1; min-height: 0; overflow: auto; padding: 8px 8px 16px; }
.ch-resize { position: relative; flex: none; width: 0; z-index: 4; }
.ch-resize::before { content: ""; position: absolute; top: 0; bottom: 0; left: -4px; width: 8px; cursor: col-resize; }
.ch-resize::after { content: ""; position: absolute; top: 0; bottom: 0; left: -1px; width: 2px; background: transparent; transition: background 200ms ease; pointer-events: none; }
.ch-resize:hover::after, .ch-resize.drag::after, .ch-resize:focus-visible::after { background: color-mix(in srgb, var(--accent) 60%, transparent); }
.ch-resize:focus-visible { outline: none; }
.ch-main { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; }
.ch-main.drop::after {
  content: ""; position: absolute; inset: 8px; border-radius: 18px; pointer-events: none; z-index: 6;
  box-shadow: inset 0 0 0 2px var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent);
}

/* ================= the chats list ================= */
.ch-sec-hdr { display: flex; align-items: center; margin-top: 10px; border-radius: 9px; transition: background 160ms; }
.ch-sec-hdr:first-child { margin-top: 2px; }
.ch-sec-hdr.drop { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ch-sec-b { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; font-size: 12px; font-weight: 600; color: var(--label-2); text-align: left; border-radius: 9px; }
.ch-sec-b:hover { color: var(--label); }
.ch-sec-b .ch-sec-chev { width: 10px; height: 10px; }
.ch-sec-tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-sec-more { width: 26px; height: 26px; border-radius: 13px; display: grid; place-items: center; color: var(--label-2); opacity: 0; flex: none; }
.ch-sec-more svg { width: 14px; height: 14px; }
.ch-sec-hdr:hover .ch-sec-more, .ch-sec-more:focus-visible { opacity: 1; }
.ch-row { position: relative; display: flex; align-items: center; border-radius: 9px; transition: background 180ms; }
.ch-row:hover { background: var(--hover-subtle); }
.ch-row.on { background: var(--fill); }
.ch-row-b { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 8px 0 8px; font-size: 14px; color: var(--label-2); text-align: left; border-radius: 9px; }
.ch-row.unread .ch-row-b, .ch-row.on .ch-row-b { color: var(--label); }
.ch-row.unread .ch-row-name { font-weight: 600; }
.ch-row.muted .ch-row-b { opacity: 0.55; }
.ch-row-name { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-row-pin { display: grid; place-items: center; color: var(--label-2); flex: none; }
.ch-row-pin svg { width: 11px; height: 11px; }
.ch-row-badge { margin-left: auto; flex: none; display: flex; align-items: center; }
.ch-row .badge { min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; border-radius: 9px; }
.ch-row .badge.dot { min-width: 0; width: 8px; height: 8px; padding: 0; border-radius: 4px; }
.ch-row-more { display: none; place-items: center; width: 26px; height: 26px; margin-right: 4px; border-radius: 13px; color: var(--label-2); flex: none; }
.ch-row-more svg { width: 14px; height: 14px; }
.ch-row:hover .ch-row-more, .ch-row-more:focus-visible { display: grid; }
.ch-row:hover .ch-row-badge { display: none; }
.ch-row-more:hover { background: var(--hover); color: var(--label); }
.ch-addrow { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 8px; font-size: 14px; color: var(--label-2); border-radius: 9px; text-align: left; }
.ch-addrow:hover { background: var(--hover-subtle); color: var(--label); }
.ch-addrow svg { width: 14px; height: 14px; margin: 0 7px; }
.ch-hint { padding: 4px 12px 8px 46px; font-size: 12px; color: var(--label-2); }
.ch-flag { display: inline-grid; place-items: center; color: var(--label-2); flex: none; }
.ch-flag svg { width: 13px; height: 13px; }

/* leads: channel tile, group stack (avatars come from the kit) */
.ch-tile { display: grid; place-items: center; border-radius: 22%; background: var(--fill); color: var(--label-2); flex: none; font-weight: 600; }
.ch-tile svg { width: 53%; height: 53%; }
.ch-tile-20 { width: 20px; height: 20px; }
.ch-tile-28 { width: 28px; height: 28px; }
.ch-tile-36 { width: 36px; height: 36px; }
.ch-tile-50 { width: 50px; height: 50px; }
.ch-stack { position: relative; flex: none; }
.ch-stack-28 { width: 28px; height: 28px; }
.ch-stack-36 { width: 36px; height: 36px; }
.ch-stack-50 { width: 50px; height: 50px; }
.ch-stack .av { position: absolute; }
.ch-stack .av:first-child { left: 0; top: 0; }
.ch-stack .av:nth-child(2) { right: 0; bottom: 0; box-shadow: 0 0 0 2px var(--bar-solid); }
.ch-stack-50 .av { width: 32px; height: 32px; border-radius: 8px; font-size: 12px; }

/* ================= the conversation header ================= */
.ch-hdr { gap: 10px; }
.ch-title { display: flex; flex-direction: column; justify-content: center; min-width: 0; }
.ch-title-b { display: flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%; font-size: 20px; font-weight: 700; text-align: left; border-radius: 8px; color: var(--label); }
.ch-title-b > svg { width: 12px; height: 12px; opacity: 0.6; }
.ch-title-b:hover .ch-title-t { text-decoration: underline; text-decoration-color: var(--label-3); text-underline-offset: 3px; }
.ch-title-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-hdr-g { display: grid; place-items: center; color: var(--label-2); }
.ch-hdr-g svg { width: 15px; height: 15px; }
.ch-title-s { font-size: 13px; color: var(--label-2); margin-top: 2px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-back { display: inline-flex; align-items: center; gap: 2px; height: 34px; padding: 0 10px 0 4px; border-radius: 17px; color: var(--accent-text); font-size: 15px; font-weight: 600; flex: none; }
.ch-back svg { width: 15px; height: 15px; }
.ch-back:hover { background: var(--hover-subtle); }
.ch-acts { height: 40px; border-radius: 20px; display: flex; align-items: center; gap: 2px; padding: 0 3px; flex: none; }
.ch-acts button { position: relative; z-index: 1; width: 34px; height: 34px; border-radius: 17px; display: grid; place-items: center; color: var(--icon); }
.ch-acts svg { width: 17px; height: 17px; }
.ch-pinbar {
  position: absolute; top: 84px; left: 16px; right: 16px; z-index: 3; min-height: 48px; border-radius: 16px;
  display: flex; align-items: center; gap: 6px; padding: 0 8px 0 4px;
}
.ch-pinbar > * { position: relative; z-index: 1; }
.ch-pinbar-b { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 6px 8px; text-align: left; border-radius: 12px; }
.ch-pinbar-ic { width: 15px; height: 15px; color: var(--accent-text); }
.ch-pinbar-tx { min-width: 0; display: flex; flex-direction: column; }
.ch-pinbar-t { font-size: 12px; font-weight: 600; color: var(--accent-text); }
.ch-pinbar-s { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= the transcript ================= */
.ch-msgs { flex: 1; min-height: 0; overflow: auto; padding: 92px 24px 8px; display: flex; flex-direction: column; scroll-padding-top: 96px; }
.ch-main.pins > .ch-msgs { padding-top: 148px; scroll-padding-top: 152px; }
.ch-fill { flex: 1; }
.ch-older { text-align: center; padding: 10px; font-size: 13px; color: var(--label-2); display: flex; align-items: center; justify-content: center; gap: 8px; }
.ch-begin { padding: 20px 0 6px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.ch-begin-t { font-size: 20px; font-weight: 700; margin-top: 4px; }
.ch-begin-s { font-size: 13px; color: var(--label-2); }
.ch-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0 4px; color: var(--label); font-size: 12px; font-weight: 600; }
.ch-divider::before, .ch-divider::after { content: ""; flex: 1; height: 1px; background: var(--sep); }
.ch-divider span { padding: 4px 11px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--sep); }
.ch-new { display: flex; align-items: center; gap: 10px; margin: 14px 0 0; color: var(--accent-text); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; }
.ch-new::before { content: ""; flex: 1; height: 1px; background: var(--accent); }

.ch-msg { position: relative; display: flex; flex-wrap: wrap; column-gap: 12px; margin: 14px -8px 0; padding: 3px 8px; border-radius: 10px; transition: background 160ms; }
.ch-msg.grouped { margin-top: 0; }
.ch-msg:hover, .ch-msg:focus-within { background: var(--hover-subtle); }
.ch-msg:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.ch-msg.enter { animation: chMsgIn 520ms var(--spring-pop) both; }
.ch-msg.pending { opacity: 0.6; }
.ch-msg.ch-flash { animation: chFlash 1600ms var(--ease-out); }
.ch-gutter { width: 36px; flex: none; display: flex; justify-content: center; }
.ch-gtime { font-size: 10px; line-height: 20px; color: var(--label-2); opacity: 0; white-space: nowrap; }
.ch-msg:hover .ch-gtime, .ch-msg:focus-within .ch-gtime { opacity: 1; }
.ch-body { flex: 1; min-width: 0; }
.ch-nl { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.ch-name { font-size: 15px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-time { font-size: 12px; color: var(--label-2); flex: none; }
.ch-pinned-tag { display: inline-grid; place-items: center; color: var(--accent-text); align-self: center; }
.ch-pinned-tag svg { width: 11px; height: 11px; }
.ch-tx { font-size: 15px; line-height: 20px; margin-top: 2px; max-width: 760px; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.ch-tx a { color: var(--accent-text); text-decoration: underline; text-underline-offset: 2px; }
.ch-at { font-weight: 600; }
.ch-at-me { color: var(--accent-text); background: var(--mention-wash); border-radius: 5px; padding: 0 3px; }
.ch-fwd { font-size: 13px; font-style: italic; color: var(--label-2); margin-top: 2px; }
.ch-tomb { font-size: 15px; font-style: italic; color: var(--label-2); margin-top: 2px; }
.ch-sending { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--label-2); }
.ch-failed { margin-top: 4px; font-size: 12px; font-weight: 600; color: var(--red); }
.ch-failed .link { color: var(--red); font-size: 12px; }
.ch-spin { display: inline-block; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--fill-strong); border-top-color: var(--label-2); animation: chSpin 800ms linear infinite; flex: none; }

/* Discord-style reply quote: a curved connector, a 16 px avatar, the name, the snippet */
.ch-quote { position: relative; flex-basis: 100%; display: flex; align-items: center; gap: 6px; min-width: 0; height: 22px; margin: 0 0 1px 17px; padding-left: 30px; font-size: 13px; color: var(--label-2); text-align: left; }
.ch-quote-line { position: absolute; left: 0; top: 11px; width: 24px; height: 12px; border-left: 2px solid var(--label-4); border-top: 2px solid var(--label-4); border-top-left-radius: 8px; }
.ch-quote-who { font-weight: 600; flex: none; }
.ch-quote-tx { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-quote:hover .ch-quote-tx, .ch-quote:hover .ch-quote-who { color: var(--label); }

/* reactions (the demo's chips, on tokens) */
.ch-reacts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.ch-react {
  height: 26px; padding: 0 9px 0 8px; border-radius: 9px; display: inline-flex; align-items: center; gap: 5px; font-size: 13px;
  background: var(--fill-subtle); box-shadow: inset 0 0 0 1px var(--glass-line); transition: transform 380ms var(--spring-pop), background 200ms;
}
.ch-react b { font-size: 12px; color: var(--label-2); font-weight: 600; }
.ch-react:hover { background: var(--fill); }
.ch-react.me { background: var(--mention-wash); box-shadow: inset 0 0 0 1px var(--accent); }
.ch-react.me b { color: var(--accent-text); }
.ch-react:active { transform: scale(0.88); }
.ch-react.add { padding: 0 8px; color: var(--label-2); opacity: 0; }
.ch-react.add svg { width: 15px; height: 15px; }
.ch-msg:hover .ch-react.add, .ch-msg:focus-within .ch-react.add, .ch-reacts .ch-react.add:focus-visible { opacity: 1; }
.ch-thread-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; padding: 3px 8px 3px 4px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--accent-text); }
.ch-thread-link:hover { background: var(--fill-subtle); }
.ch-tl-av { display: flex; gap: 2px; }
.ch-tl-last { color: var(--label-2); font-weight: 500; }
.ch-bell { display: inline-flex; align-items: center; gap: 4px; margin-top: 6px; padding: 3px 9px; border-radius: 8px; font-size: 12px; font-weight: 600; color: var(--label-2); background: var(--fill-subtle); }
.ch-bell:hover { background: var(--fill); color: var(--label); }

/* hover toolbar (top-right of a hovered / focused message) */
.ch-tools {
  position: absolute; top: -14px; right: 12px; z-index: 2; height: 32px; border-radius: 16px; display: flex; align-items: center; padding: 0 1px;
  opacity: 0; pointer-events: none; transition: opacity 150ms ease;
}
.ch-tools button { position: relative; z-index: 1; width: 30px; height: 30px; border-radius: 15px; display: grid; place-items: center; color: var(--icon); }
.ch-tools button:hover { background: var(--hover); }
.ch-tools svg { width: 15px; height: 15px; }
.ch-msg:hover > .ch-tools, .ch-msg:focus-within > .ch-tools { opacity: 1; pointer-events: auto; }

/* attachments */
.ch-media { display: grid; gap: 4px; margin-top: 6px; max-width: 484px; grid-template-columns: repeat(2, minmax(0, 240px)); }
.ch-media.n1 { grid-template-columns: minmax(0, 240px); }
.ch-img, .ch-video, .ch-media-ph { position: relative; display: block; width: 100%; max-width: 240px; border-radius: 12px; overflow: hidden; background: var(--fill-subtle); }
.ch-img[data-ar="wide"], .ch-video[data-ar="wide"], .ch-media-ph[data-ar="wide"] { aspect-ratio: 4 / 3; }
.ch-img[data-ar="square"], .ch-video[data-ar="square"], .ch-media-ph[data-ar="square"] { aspect-ratio: 1 / 1; }
.ch-img[data-ar="tall"], .ch-video[data-ar="tall"], .ch-media-ph[data-ar="tall"] { aspect-ratio: 3 / 4; }
.ch-img img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 420ms var(--spring); }
.ch-img:hover img { transform: scale(1.02); }
.ch-video { object-fit: cover; }
.ch-media-more { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 700; color: var(--on-accent); background: color-mix(in srgb, var(--bg) 55%, transparent); }
.ch-media-ph.sm { width: 220px; height: 40px; aspect-ratio: auto; }
.ch-voice { display: flex; align-items: center; gap: 10px; margin-top: 6px; }
.ch-voice audio { height: 36px; max-width: 280px; }
.ch-voice-d { font-size: 12px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.ch-file-row { display: flex; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: var(--fill-subtle); max-width: 360px; }
.ch-file-ic { width: 22px; height: 22px; color: var(--label-2); }
.ch-file-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-file-name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-file-size { font-size: 12px; color: var(--label-2); }
.ch-file-row .mini { display: inline-flex; align-items: center; text-decoration: none; color: var(--label); }

/* ================= the composer ================= */
.ch-foot { position: relative; flex: none; display: flex; flex-direction: column; gap: 6px; padding: 0 24px 18px; z-index: 2; }
.ch-typing { height: 18px; display: flex; align-items: center; gap: 6px; padding-left: 4px; font-size: 12px; color: var(--label-2); opacity: 0; transition: opacity 200ms ease; }
.ch-typing.on { opacity: 1; }
.ch-dots { display: inline-flex; gap: 3px; }
.ch-dots i { width: 5px; height: 5px; border-radius: 3px; background: var(--label-2); animation: chDot 1.2s ease-in-out infinite; }
.ch-dots i:nth-child(2) { animation-delay: 0.15s; }
.ch-dots i:nth-child(3) { animation-delay: 0.3s; }
.ch-schedbar { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 12px; border-radius: 15px; font-size: 13px; font-weight: 600; background: var(--fill); color: var(--label); }
.ch-schedbar svg { width: 13px; height: 13px; color: var(--label-2); }
.ch-replybar, .ch-fwd-quote, .ch-qr-quote { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 16px; background: var(--fill-subtle); }
.ch-rb-bar { width: 3px; align-self: stretch; border-radius: 2px; background: var(--accent); flex: none; }
.ch-rb-tx { flex: 1; min-width: 0; }
.ch-rb-who { font-size: 13px; font-weight: 600; color: var(--accent-text); }
.ch-rb-snip { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-replybar .round.xs { background: var(--fill); }
.ch-tray { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-att-chip { position: relative; display: flex; align-items: center; gap: 8px; height: 64px; min-width: 64px; max-width: 220px; padding: 0 32px 0 12px; border-radius: 12px; background: var(--fill); overflow: hidden; }
.ch-att-chip.img { width: 64px; padding: 0; }
.ch-att-chip img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ch-att-ic svg { width: 20px; height: 20px; color: var(--label-2); }
.ch-att-name { font-size: 13px; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-att-x { position: absolute; top: 4px; right: 4px; width: 20px; height: 20px; border-radius: 10px; display: grid; place-items: center; background: var(--bar-solid); color: var(--label); box-shadow: 0 0 0 1px var(--line); }
.ch-att-x svg { width: 9px; height: 9px; }
.ch-mention { position: relative; height: 0; }
.ch-mlist { position: absolute; left: 0; right: 0; bottom: 4px; z-index: 5; border-radius: 16px; padding: 6px; background: var(--pop-fill); box-shadow: var(--glass-rim), var(--pop-shadow); }
.ch-mitem { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border-radius: 10px; font-size: 14px; text-align: left; }
.ch-mitem.on, .ch-mitem:hover { background: var(--hover); }
.ch-mname { font-weight: 600; flex: none; }
.ch-msub { margin-left: auto; font-size: 12px; color: var(--label-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-composer { min-height: 52px; border-radius: 26px; display: flex; align-items: flex-end; gap: 10px; padding: 6px; }
.ch-composer:focus-within { box-shadow: var(--glass-rim), 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
.ch-cbtn { position: relative; z-index: 1; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; flex: none; background: var(--fill); color: var(--icon); }
.ch-cbtn svg { width: 17px; height: 17px; }
.ch-send { color: var(--label-2); transition: background 260ms ease, color 260ms ease, transform 420ms var(--spring); }
.ch-send.ready { background: var(--accent); color: var(--on-accent); }
.ch-input {
  position: relative; z-index: 1; flex: 1; min-width: 0; align-self: center; resize: none; border: 0; outline: none; background: none;
  font-size: 15px; line-height: 20px; padding: 8px 0; height: 36px; max-height: 140px; color: var(--label); overflow-y: auto;
}
.ch-input::placeholder { color: var(--label-2); }
.ch-input:focus-visible { box-shadow: none; }
.ch-countrow:empty { display: none; }
.ch-count { font-size: 12px; color: var(--label-2); text-align: right; padding-right: 8px; }
.ch-count.over { color: var(--red); }
.ch-readonly { padding: 14px 18px; border-radius: 18px; background: var(--fill-subtle); color: var(--label-2); font-size: 14px; text-align: center; }

/* ================= the thread panel ================= */
.ch-thread { position: relative; flex: none; width: 340px; height: 100%; display: flex; flex-direction: column; background: var(--bg); box-shadow: inset 1px 0 0 0 var(--edge); }
.ch-thread.main { width: auto; flex: 1; min-width: 0; box-shadow: none; }
.ch-thread .ch-msgs { padding: 88px 16px 8px; }
.ch-thread .ch-foot { padding: 0 16px 16px; }
.ch-thread-t { font-size: 17px; font-weight: 700; }
.ch-thread-parent { padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.ch-thread-parent .ch-msg { margin-top: 0; }
.ch-thread-count { margin: 12px 0 2px; font-size: 12px; font-weight: 600; color: var(--label-2); }

/* ================= pops (scheduled, custom time, emoji, info, contact, quick reply) ================= */
.ch-pop-title { padding: 2px 4px 10px; font-size: 15px; font-weight: 600; }
.ch-pop-acts { display: flex; gap: 8px; justify-content: flex-end; margin-top: 4px; }
.ch-form { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.ch-sched-item { padding: 10px 4px; border-top: 1px solid var(--line); }
.ch-sched-when { font-size: 12px; font-weight: 600; color: var(--label-2); }
.ch-sched-text { margin-top: 3px; font-size: 14px; line-height: 19px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ch-sched-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ch-danger, .mini.ch-danger { color: var(--red); }
.ch-emoji { max-height: 320px; overflow: auto; }
.ch-emoji-cat { padding: 8px 4px 4px; font-size: 12px; font-weight: 600; color: var(--label-2); }
.ch-emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.ch-emoji-b { height: 36px; border-radius: 8px; font-size: 22px; transition: transform 300ms var(--spring-pop), background 160ms; }
.ch-emoji-b:hover, .ch-emoji-b:focus-visible { background: var(--hover); transform: scale(1.15); }
.ch-prev-hdr { display: flex; align-items: center; gap: 10px; padding: 2px 4px 10px; }
.ch-prev-tt { min-width: 0; }
.ch-prev-t { font-size: 15px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-prev-s { font-size: 12px; color: var(--label-2); }
.ch-prev-msgs { display: flex; flex-direction: column; gap: 6px; width: 100%; max-height: 260px; overflow: hidden; padding: 10px 12px; border-radius: 14px; background: var(--fill-subtle); text-align: left; font-size: 13px; line-height: 18px; }
.ch-prev-msgs:hover { background: var(--fill); }
.ch-prev-m { display: block; overflow-wrap: anywhere; }
.ch-prev-m b { font-weight: 600; }
.ch-prev-m.at-me { margin: 0 -6px; padding: 2px 6px; border-radius: 8px; background: var(--mention-wash); }
.ch-prev-empty { color: var(--label-2); }
.ch-prev-opts { margin-top: 8px; }
.ch-info-hdr, .ch-card { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 4px 14px; text-align: center; }
.ch-info-t { margin-top: 6px; font-size: 17px; font-weight: 700; overflow-wrap: anywhere; }
.ch-info-topic { font-size: 13px; color: var(--label-2); overflow-wrap: anywhere; }
.ch-info-rule { font-size: 12px; color: var(--label-2); }
.ch-card-n { margin-top: 8px; font-size: 20px; font-weight: 700; }
.ch-card-r { font-size: 14px; color: var(--label-2); }
.ch-card-p { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--label-2); }
.ch-card-p i { width: 8px; height: 8px; border-radius: 4px; background: var(--green); }
.ch-card-btn { width: 100%; justify-content: center; margin-bottom: 12px; }
.ch-card-btn svg { width: 16px; height: 16px; }
.ch-kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 14px; margin: 0; padding: 0 4px 4px; font-size: 13px; }
.ch-kv dt { color: var(--label-2); }
.ch-kv dd { margin: 0; overflow-wrap: anywhere; }
.ch-qr-hdr { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ch-qr-hdr .ch-pop-title { padding-bottom: 6px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-qr-quote { margin-bottom: 10px; }
.ch-qr-snip { font-size: 15px; color: var(--label-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ch-qr-row { display: flex; align-items: flex-end; gap: 8px; }
.ch-qr-in { flex: 1; min-width: 0; height: 40px; max-height: 110px; resize: none; border: 0; border-radius: 20px; padding: 10px 14px; font-size: 15px; line-height: 20px; background: var(--fill); color: var(--label); }
.ch-qr-in::placeholder { color: var(--label-2); }
.ch-qr-send { width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; flex: none; color: var(--label-2); }
.ch-qr-send svg { width: 17px; height: 17px; position: relative; z-index: 1; }
.ch-qr-send.ready { background: color-mix(in srgb, var(--accent) 85%, transparent); color: var(--on-accent); }
.ch-qr-send:disabled { opacity: 0.45; }

/* grouped rows in pops and sheets */
.ch-group { border-radius: 14px; background: var(--card); overflow: hidden; margin-bottom: 12px; }
.ch-srow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 14px; font-size: 15px; text-align: left; color: var(--label); }
.ch-srow + .ch-srow, .ch-prow + .ch-prow, .ch-mrow + .ch-mrow { box-shadow: inset 0 1px 0 0 var(--sep); }
.ch-srow-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-srow-sub { font-size: 13px; color: var(--label-2); overflow-wrap: anywhere; }
.ch-srow-val { color: var(--label-2); }
.ch-srow .seg { flex: 1; }
.ch-srow .seg button { flex: 1; }
.ch-srow > .chev-i { color: var(--label-3); }
.ch-link-row:hover, .ch-prow:hover { background: var(--hover-subtle); }
.ch-danger-row { justify-content: center; color: var(--red); font-weight: 500; }
.ch-danger-row:hover { background: color-mix(in srgb, var(--red) 8%, transparent); }
.ch-select { user-select: text; }
.ch-muted { color: var(--label-2); }

/* ================= sheets ================= */
.ch-to { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.ch-to-l { font-size: 15px; color: var(--label-2); flex: none; }
.ch-search { flex: 1; display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; margin-bottom: 12px; border-radius: 12px; background: var(--fill); }
.ch-to .ch-search { margin-bottom: 0; }
.ch-search:focus-within { box-shadow: inset 0 0 0 2px var(--accent); }
.ch-search svg { width: 14px; height: 14px; color: var(--label-2); }
.ch-search-in { flex: 1; min-width: 0; border: 0; outline: none; background: none; font-size: 15px; color: var(--label); -webkit-appearance: none; appearance: none; }
.ch-search-in::placeholder { color: var(--label-2); }
.ch-search-in:focus-visible { box-shadow: none; }
.ch-sec-lbl { padding: 10px 4px 6px; font-size: 12px; font-weight: 600; color: var(--label-2); text-transform: uppercase; letter-spacing: 0.4px; }
.ch-prow, .ch-mrow { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 54px; padding: 8px 14px; text-align: left; color: var(--label); }
.ch-prow-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ch-prow-name { font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-prow-sub { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-you { color: var(--label-2); font-weight: 400; }
.ch-check { width: 22px; height: 22px; border-radius: 11px; display: grid; place-items: center; flex: none; color: transparent; box-shadow: inset 0 0 0 1.5px var(--label-3); transition: background 200ms ease, box-shadow 200ms ease; }
.ch-check svg { width: 12px; height: 12px; }
.ch-check.on { background: var(--accent); color: var(--on-accent); box-shadow: none; }
.ch-admin-badge { flex: none; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; color: var(--accent-text); background: color-mix(in srgb, var(--accent) 16%, transparent); }
.ch-addpeople { display: flex; align-items: center; gap: 10px; width: 100%; height: 46px; padding: 0 14px; margin-bottom: 4px; border-radius: 14px; background: var(--card); color: var(--accent-text); font-size: 15px; font-weight: 600; text-align: left; }
.ch-addpeople svg { width: 18px; height: 18px; }
.ch-addpeople:hover { filter: brightness(1.08); }
.ch-none { padding: 16px; text-align: center; font-size: 14px; color: var(--label-2); }
.ch-note { padding: 4px 4px 8px; font-size: 13px; color: var(--label-2); }
.ch-foot-note { margin-top: -6px; padding: 0 4px 12px; font-size: 12px; color: var(--label-2); }
.ch-sheet-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0 12px; }
.ch-sheet-foot .pill { height: 40px; border-radius: 20px; }
.ch-hashfield { position: relative; display: block; }
.ch-hash { position: absolute; left: 12px; top: 50%; translate: 0 -50%; font-size: 15px; font-weight: 600; color: var(--label-2); pointer-events: none; }
.ch-hashfield .field-input { padding-left: 26px; }
.ch-fwd-quote { margin-bottom: 12px; }
.ch-fwd-ic { width: 14px; height: 14px; color: var(--label-2); }

/* ================= the press-and-hold overlay (scrim dark in both themes) ================= */
.pop.panel.ch-ovp, .pop.panel.ch-viewp {
  left: 0 !important; top: 0 !important; width: 100% !important; height: 100%; max-height: none; padding: 0; border-radius: 0; overflow: visible;
  background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; animation: none;
}
.ch-ov {
  --viewer-scrim: rgba(0, 0, 0, 0.5);
  position: absolute; inset: 0;
}
.ch-ov-scrim { position: absolute; inset: 0; background: var(--viewer-scrim); animation: fadeIn 220ms ease both; }
.ch-ov-stack { position: absolute; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ch-ov-reacts { display: flex; align-items: center; gap: 4px; max-width: 100%; height: 52px; padding: 0 6px; border-radius: 26px; background: var(--pop-fill); animation: chOvIn 380ms var(--spring-pop) both; transform-origin: 20% 100%; }
.ch-ov-rscroll { position: relative; z-index: 1; flex: 1; min-width: 0; display: flex; align-items: center; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.ch-ov-rscroll::-webkit-scrollbar { display: none; }
.ch-ov-e { flex: none; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; font-size: 24px; transition: transform 300ms var(--spring-pop), background 160ms; }
.ch-ov-e:hover, .ch-ov-e:focus-visible { transform: scale(1.2); }
.ch-ov-e.on { background: var(--mention-wash); }
.ch-ov-sep { flex: none; width: 1px; height: 24px; margin: 0 6px; background: var(--glass-line); }
.ch-ov-plus { position: relative; z-index: 1; flex: none; width: 40px; height: 40px; border-radius: 20px; display: grid; place-items: center; background: var(--fill); color: var(--icon); }
.ch-ov-plus svg { width: 16px; height: 16px; }
.ch-ov-msg { width: 100%; max-height: 40vh; overflow: hidden; padding: 6px 14px 10px; border-radius: 16px; background: var(--bar-solid); box-shadow: var(--pop-shadow); animation: chLift 380ms var(--spring) both; transform: scale(1.02); }
.ch-ov-msg .ch-msg { margin: 0; background: none; }
.ch-ov-menu { width: 260px; padding: 6px; border-radius: 16px; background: var(--pop-fill); box-shadow: var(--glass-rim), var(--pop-shadow); animation: chOvIn 380ms var(--spring-pop) both; transform-origin: 20% 0%; }
.ch-ov-it { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border-radius: 10px; font-size: 14px; text-align: left; color: var(--label); }
.ch-ov-it:hover, .ch-ov-it:focus-visible { background: var(--hover); outline: none; }
.ch-ov-it.danger { color: var(--red); }
.ch-ov-it-tx { flex: 1; min-width: 0; }
.ch-ov-ic { display: grid; place-items: center; }
.ch-ov-ic svg { width: 16px; height: 16px; }
.ch-ov-more { width: 11px; height: 11px; color: var(--label-2); }

/* ================= the media viewer (dark in both themes) ================= */
.ch-viewer {
  --viewer-bg: rgba(0, 0, 0, 0.92); --viewer-fg: #FFFFFF; --viewer-fg-2: rgba(255, 255, 255, 0.72); --viewer-btn: rgba(255, 255, 255, 0.14); --viewer-btn-hover: rgba(255, 255, 255, 0.24);
  position: absolute; inset: 0; display: grid; place-items: center; color: var(--viewer-fg);
}
.ch-viewer-scrim { position: absolute; inset: 0; background: var(--viewer-bg); animation: fadeIn 200ms ease both; }
.ch-viewer-img { position: relative; max-width: calc(100% - 160px); max-height: calc(100% - 140px); border-radius: 8px; object-fit: contain; animation: chLift 380ms var(--spring) both; }
.ch-viewer-wait { position: relative; color: var(--viewer-fg-2); font-size: 15px; }
.ch-viewer-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 1; height: 64px; display: flex; align-items: center; gap: 10px; padding: 0 16px 0 24px; }
.ch-viewer-t { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; color: var(--viewer-fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-viewer-dl { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 18px; font-size: 13px; font-weight: 600; color: var(--viewer-fg); background: var(--viewer-btn); text-decoration: none; }
.ch-viewer-dl svg { width: 15px; height: 15px; }
.ch-viewer-x, .ch-viewer-nav { display: grid; place-items: center; color: var(--viewer-fg); background: var(--viewer-btn); }
.ch-viewer-x { width: 36px; height: 36px; border-radius: 18px; }
.ch-viewer-x svg { width: 13px; height: 13px; }
.ch-viewer-nav { position: absolute; top: 50%; z-index: 1; width: 48px; height: 48px; border-radius: 24px; translate: 0 -50%; }
.ch-viewer-nav svg { width: 16px; height: 16px; }
.ch-viewer-nav.prev { left: 24px; }
.ch-viewer-nav.next { right: 24px; }
.ch-viewer-nav:disabled { opacity: 0.3; }
.ch-viewer-dl:hover, .ch-viewer-x:hover, .ch-viewer-nav:not(:disabled):hover { background: var(--viewer-btn-hover); }

/* ================= the reminder banner (top centre) ================= */
.ch-banner-host { position: absolute; top: 0; left: 0; right: 0; z-index: 70; display: flex; justify-content: center; pointer-events: none; }
.ch-banner {
  display: flex; align-items: center; gap: 6px; max-width: min(560px, calc(100% - 48px)); margin-top: 14px; padding: 6px 8px 6px 6px; border-radius: 22px; pointer-events: auto;
  background: var(--pop-fill); box-shadow: var(--glass-rim), var(--pop-shadow); animation: toastIn 560ms var(--spring-pop) both;
}
.ch-banner > * { position: relative; z-index: 1; }
.ch-banner-b { display: flex; align-items: center; gap: 10px; min-width: 0; padding: 4px 8px; border-radius: 16px; text-align: left; }
.ch-banner-ic { font-size: 18px; flex: none; }
.ch-banner-tx { min-width: 0; display: flex; flex-direction: column; }
.ch-banner-t { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ch-banner-s { font-size: 13px; color: var(--label-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ================= narrow and compact panes ================= */
.pane.narrow .ch-msgs { padding-left: 16px; padding-right: 16px; }
.pane.narrow .ch-foot { padding: 0 16px 16px; }
.pane.narrow .ch-pinbar { left: 12px; right: 12px; }
.pane.cmp .ch-title-b { font-size: 17px; }
.pane.cmp .ch-foot { padding: 0 12px 12px; }
.pane.cmp .ch-msgs { padding-left: 12px; padding-right: 12px; }
.pane.cmp .ch-media { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ================= motion ================= */
@keyframes chSpin { to { transform: rotate(360deg); } }
@keyframes chDot { 0%, 80%, 100% { opacity: 0.3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
@keyframes chMsgIn { from { opacity: 0; transform: translateY(14px) scale(0.98); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes chFlash { 0%, 35% { background: var(--mention-wash); } 100% { background: transparent; } }
@keyframes chOvIn { from { opacity: 0; transform: scale(0.86); filter: blur(8px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes chLift { from { transform: scale(1); box-shadow: none; } to { transform: scale(1.02); } }
@media (prefers-reduced-motion: reduce) {
  .ch-msg.enter, .ch-ov-reacts, .ch-ov-menu, .ch-ov-msg, .ch-viewer-img, .ch-banner { animation: none; }
  .ch-spin, .ch-dots i { animation: none; }
}
