/* «الشات زي واتساب» · phases 3–5 (loaded after wa.css): the list's pinned / muted / archived marks, media viewer and
   albums, poll / location / contact / meeting cards, the info screen, and the meeting room. Tokens only. */

/* ================================================================== phase 3: the list */
.cx-ci { position: relative; }
.cx-rowmark { display: inline-flex; color: var(--muted-2); flex: none; }
.cx-rowmark .ic { width: 14px; height: 14px; }
.cx-unread.dot { min-width: 12px; width: 12px; height: 12px; padding: 0; }
.cx-row-chev { position: absolute; inset-block-start: 8px; inset-inline-end: 8px; width: 24px; height: 22px; display: none; place-items: center; border-radius: 6px; background: var(--surface-3); color: var(--muted); font-size: 16px; line-height: 1; cursor: pointer; }
@media (hover: hover) { .cx-ci:hover .cx-row-chev { display: grid; } .cx-ci:hover .cx-t { visibility: hidden; } }
.cx-pinblock { display: flex; flex-direction: column; border-block-end: 6px solid var(--surface-2); }

/* phase 3: media */
.cx-vidbox { display: grid; place-items: center; align-content: center; gap: 6px; width: min(300px, 100%); aspect-ratio: 16 / 9; border: 0; border-radius: 8px; cursor: pointer; background: var(--brand-bg); color: var(--on-brand); padding: 10px; }
.cx-vid-play { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--on-brand) 18%, transparent); }
.cx-vid-play .ic { width: 26px; height: 26px; fill: currentColor; }
.cx-vid-name { font-size: 12.5px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-vid-size { font-size: 11px; opacity: .75; }
.cx-tx.cap { margin-block-start: 4px; }

.mv, .sp { position: fixed; inset: 0; z-index: 95; display: flex; flex-direction: column; background: var(--brand-bg); color: var(--on-brand); padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px); }
.mv-top, .sp-top { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; min-height: 56px; }
.mv-who { display: flex; flex-direction: column; font-size: 13px; line-height: 1.4; min-width: 0; }
.mv-who .num { font-size: 11px; opacity: .7; }
.mv-count { font-size: 12px; opacity: .8; }
.mv-btn, .mv-nav { width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%; background: color-mix(in srgb, var(--on-brand) 12%, transparent); color: inherit; cursor: pointer; flex: none; }
.mv-btn:hover, .mv-nav:hover { background: color-mix(in srgb, var(--on-brand) 24%, transparent); }
.mv-mid { flex: 1; min-height: 0; display: flex; align-items: center; gap: 8px; padding: 0 10px; }
.mv-nav[hidden] { display: grid; visibility: hidden; }
[dir="rtl"] .mv-nav .ic { transform: scaleX(-1); }
.mv-stage { flex: 1; min-width: 0; height: 100%; display: grid; place-items: center; overflow: hidden; touch-action: none; }
.mv-img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-in; transition: transform .15s; user-select: none; }
.mv-img.zoomed { cursor: grab; transition: none; }
.mv-video { max-width: 100%; max-height: 100%; background: var(--brand-bg); }
.mv-wait { display: flex; align-items: center; gap: 10px; font-size: 14px; opacity: .85; text-align: center; padding: 20px; }
.mv-cap { flex: none; text-align: center; padding: 10px 18px 16px; font-size: 14px; line-height: 1.6; max-height: 22vh; overflow-y: auto; }
.mv-cap[hidden] { display: none; }
.sp-stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 8px 16px; }
.sp-img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; }
.sp-file { display: grid; justify-items: center; gap: 8px; text-align: center; }
.sp-file .ic { width: 64px; height: 64px; }
.sp-strip { flex: none; display: flex; gap: 8px; justify-content: center; padding: 8px 14px; overflow-x: auto; }
.sp-strip[hidden] { display: none; }
.sp-thumb { position: relative; width: 54px; height: 54px; flex: none; border: 2px solid transparent; border-radius: 8px; overflow: hidden; background: color-mix(in srgb, var(--on-brand) 12%, transparent); color: inherit; cursor: pointer; display: grid; place-items: center; padding: 0; }
.sp-thumb.on { border-color: var(--accent); }
.sp-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sp-x { position: absolute; inset-block-start: 1px; inset-inline-end: 1px; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-size: 10px; background: var(--brand-bg); color: var(--on-brand); }
.sp-bar { flex: none; display: flex; align-items: flex-end; gap: 10px; padding: 10px 14px 14px; max-width: 760px; width: 100%; margin-inline: auto; }
.sp-cap { flex: 1; min-width: 0; border: 0; outline: 0; resize: none; border-radius: 22px; padding: 11px 16px; font-size: 15px; line-height: 1.5; background: var(--surface); color: var(--text); max-height: 120px; }
.sp-go { position: relative; }
.sp-go[data-n]:not([data-n=""])::after { content: attr(data-n); position: absolute; inset-block-start: -6px; inset-inline-end: -4px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--surface); color: var(--heading); font: 700 11px/18px var(--font-fig); text-align: center; }

.cx-album { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; width: min(330px, 78%); margin-block-start: 8px; }
.cx-album.out { align-self: flex-end; } .cx-album.in { align-self: flex-start; }
.cx-album > .cx-msg { max-width: none; margin: 0; display: block; position: relative; }
.cx-album > .cx-msg > .cx-av, .cx-album .cx-who, .cx-album .cx-doc-sub, .cx-album .cx-bubble::before { display: none; }
.cx-album .cx-bubble { padding: 3px; border-radius: 8px !important; }
.cx-album .cx-imgbox { aspect-ratio: 1; width: 100%; display: block; overflow: hidden; }
.cx-album .cx-img { width: 100%; height: 100%; object-fit: cover; }
.cx-album .cx-meta { position: absolute; inset-block-end: 6px; inset-inline-end: 8px; margin: 0; float: none; color: var(--on-brand); text-shadow: 0 0 4px var(--brand-bg); }
.cx-album > .cx-msg:nth-child(n+5) { display: none; }
.cx-album[data-more] > .cx-msg:nth-child(4)::after { content: attr(data-more); position: absolute; inset: 3px; border-radius: 6px; display: grid; place-items: center; background: color-mix(in srgb, var(--brand-bg) 62%, transparent); color: var(--on-brand); font: 700 24px/1 var(--font-fig); pointer-events: none; }

/* ================================================================== phase 4: cards and the info screen */
.cx-poll { display: flex; flex-direction: column; gap: 6px; min-width: min(260px, 64vw); padding-block: 2px 4px; }
.cx-poll-q { font-weight: 700; font-size: 14.5px; }
.cx-poll-hint, .cx-poll-foot { font-size: 11.5px; color: var(--muted); }
.cx-poll-opt { display: flex; flex-direction: column; gap: 4px; border: 0; background: transparent; padding: 4px 0; cursor: pointer; color: inherit; text-align: start; }
.cx-poll-row { display: flex; align-items: center; gap: 8px; font-size: 13.5px; }
.cx-poll-check { width: 18px; height: 18px; flex: none; border-radius: 50%; border: 1.5px solid var(--muted-2); display: grid; place-items: center; }
.cx-poll-opt.on .cx-poll-check { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.cx-poll-check .ic { width: 12px; height: 12px; }
.cx-poll-tx { flex: 1; min-width: 0; }
.cx-poll-bar { display: block; height: 6px; border-radius: 3px; background: color-mix(in srgb, var(--heading) 10%, transparent); margin-inline-start: 26px; overflow: hidden; }
.cx-poll-bar i { display: block; height: 100%; border-radius: 3px; background: var(--accent); transition: width .25s; }
.cx-loc, .cx-meet { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: min(250px, 62vw); padding-block: 2px 4px; }
.cx-loc-pin, .cx-meet-ic, .cx-contact-av { width: 38px; height: 38px; flex: none; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-text); }
.cx-loc-main, .cx-meet-top > div, .cx-contact-top > div { display: flex; flex-direction: column; min-width: 0; font-size: 13px; line-height: 1.45; }
.cx-loc-main { flex: 1; }
.cx-loc-open { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 700; color: var(--accent-text); text-decoration: none; padding: 6px 10px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.cx-meet-top, .cx-contact-top { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0; }
.cx-meet .btn { display: inline-flex; align-items: center; gap: 6px; }
.cx-contact { display: flex; flex-direction: column; gap: 4px; min-width: min(240px, 60vw); padding-block: 2px 4px; }
.cx-contact-row { display: flex; justify-content: space-between; gap: 12px; border: 0; border-block-start: 1px solid color-mix(in srgb, var(--heading) 10%, transparent); background: transparent; padding: 7px 0 3px; cursor: pointer; color: inherit; font-size: 13.5px; }
.pl-opts { display: flex; flex-direction: column; gap: 6px; }
.pl-multi { gap: 8px; align-items: center; font-size: 13.5px; margin-block: 6px; cursor: pointer; }
.cx-head-tap { cursor: pointer; }
.cx-locknote { text-align: center; font-size: 13px; color: var(--muted); padding: 10px 8px; }
.cx-comp.locked > .cx-comp-row, .cx-comp.locked > .cx-replybar { display: none; }
.info-people { max-height: 220px; overflow-y: auto; }
.mt-wrap { display: flex; flex-direction: column; gap: 8px; }
.mt-tabs { padding: 0; }
.mt-body { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: var(--r-1); }
.mt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 3px; padding: 3px; }
.mt-grid .mt-tile { aspect-ratio: 1; border: 0; border-radius: 4px; cursor: pointer; background: var(--surface-3) center / cover no-repeat; display: grid; place-items: center; color: var(--muted); }
.mt-vid { font-size: 22px; }
.mt-link { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px 0; border-block-end: 1px solid var(--line-2); }
.mt-link .cx-result { border: 0; padding-inline: 0; }

/* ================================================================== phase 5: the meeting */
.mt { position: fixed; inset: 0; z-index: 96; background: var(--brand-bg); color: var(--on-brand); display: flex; flex-direction: column; padding-block: env(safe-area-inset-top, 0px) env(safe-area-inset-bottom, 0px); }
.mt[hidden] { display: none; }
.mt-ready { align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
.mt-ready-card { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; justify-content: center; max-width: 980px; width: 100%; }
.mt-prev-box { position: relative; flex: 1 1 420px; max-width: 620px; aspect-ratio: 16 / 9; border-radius: 14px; overflow: hidden; background: color-mix(in srgb, var(--on-brand) 8%, var(--brand-bg)); }
.mt-prev { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }
.mt-prev.off { visibility: hidden; }
.mt-prev-name { position: absolute; inset-block-start: 12px; inset-inline-start: 14px; font-size: 13px; font-weight: 700; text-shadow: 0 0 6px var(--brand-bg); }
.mt-prev-ctl { position: absolute; inset-block-end: 14px; inset-inline: 0; display: flex; justify-content: center; gap: 14px; }
.mt-round, .mt-ctl { width: 52px; height: 52px; border-radius: 50%; border: 1px solid color-mix(in srgb, var(--on-brand) 40%, transparent); background: color-mix(in srgb, var(--on-brand) 12%, transparent); color: var(--on-brand); display: grid; place-items: center; cursor: pointer; flex: none; }
.mt-round:hover:not(:disabled), .mt-ctl:hover:not(:disabled) { background: color-mix(in srgb, var(--on-brand) 24%, transparent); }
.mt-round.off, .mt-ctl.off { background: var(--unfav); border-color: var(--unfav); color: var(--on-brand); }
.mt-round:disabled, .mt-ctl:disabled { opacity: .45; cursor: default; }
.mt-ctl.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.mt-ctl.leave { width: 68px; border-radius: 26px; background: var(--unfav); border-color: var(--unfav); }
.mt-emoji { font-size: 22px; line-height: 1; }
.mt-ready-side { flex: 1 1 280px; max-width: 360px; display: flex; flex-direction: column; gap: 10px; text-align: center; align-items: center; }
.mt-ready-side h2 { margin: 0; font-size: 24px; color: var(--on-brand); }
.mt-who { margin: 0; font-size: 14px; opacity: .85; }
.mt-note { margin: 0; font-size: 13px; color: var(--champ); min-height: 1em; }
.mt-ready-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.mt-ready-side .xs.muted { color: color-mix(in srgb, var(--on-brand) 60%, transparent); }
.mt-top { flex: none; display: flex; align-items: center; gap: 12px; padding: 10px 16px; min-height: 52px; }
.mt-title { font-size: 15px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mt-timer { font-size: 13px; opacity: .8; }
.mt-count { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.mt-top-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid color-mix(in srgb, var(--on-brand) 35%, transparent); background: transparent; color: var(--on-brand); font-size: 12.5px; cursor: pointer; }
.mt-top-btn:hover { background: color-mix(in srgb, var(--on-brand) 14%, transparent); }
.mt-grid2 { flex: 1; min-height: 0; display: grid; gap: 8px; padding: 6px 12px; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
.mt-grid2[data-n="1"] { --cols: 1; } .mt-grid2[data-n="2"], .mt-grid2[data-n="3"], .mt-grid2[data-n="4"] { --cols: 2; }
.mt-grid2[data-n="5"], .mt-grid2[data-n="6"], .mt-grid2[data-n="7"], .mt-grid2[data-n="8"], .mt-grid2[data-n="9"] { --cols: 3; }
.mt-grid2 .mt-tile { position: relative; border-radius: 12px; overflow: hidden; background: color-mix(in srgb, var(--on-brand) 8%, var(--brand-bg)); display: grid; place-items: center; min-height: 0; border: 2px solid transparent; }
.mt-grid2 .mt-tile.talking { border-color: var(--accent); }
.mt-grid2 .mt-tile video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mt-grid2 .mt-tile video.mirror { transform: scaleX(-1); }
.mt-grid2 .mt-tile.sharing video { object-fit: contain; transform: none; }
.mt-grid2 .mt-tile.no-video video { visibility: hidden; }
.mt-av { width: clamp(56px, 22%, 120px); aspect-ratio: 1; border-radius: 50%; display: none; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: clamp(22px, 5vw, 44px); background-size: cover; background-position: center; }
.mt-tile.no-video .mt-av { display: grid; }
.mt-name { position: absolute; inset-block-end: 8px; inset-inline-start: 10px; max-width: calc(100% - 20px); display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: var(--r-pill); background: color-mix(in srgb, var(--brand-bg) 70%, transparent); font-size: 12.5px; }
.mt-mute { display: inline-flex; color: var(--champ); } .mt-mute[hidden] { display: none; } .mt-mute .ic { width: 14px; height: 14px; }
.mt-hand { position: absolute; inset-block-start: 8px; inset-inline-end: 10px; font-size: 22px; } .mt-hand[hidden] { display: none; }
.mt-tile.linking::after { content: "…"; position: absolute; inset-block-start: 8px; inset-inline-start: 12px; font-size: 20px; opacity: .8; }
.mt-tile.failed { opacity: .55; }
.mt-bar { flex: none; display: flex; justify-content: center; align-items: center; gap: 12px; padding: 12px 12px 16px; flex-wrap: wrap; }
.mt-pill { position: fixed; z-index: 70; inset-block-end: max(84px, env(safe-area-inset-bottom, 0px)); inset-inline-start: 16px; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 14px; border: 0; border-radius: var(--r-pill); background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 13px; cursor: pointer; box-shadow: var(--shadow); }
@media (max-width: 760px) {
  .mt-grid2[data-n="2"] { --cols: 1; } .mt-grid2[data-n="5"], .mt-grid2[data-n="6"], .mt-grid2[data-n="7"], .mt-grid2[data-n="8"], .mt-grid2[data-n="9"] { --cols: 2; }
  .mt-round, .mt-ctl { width: 48px; height: 48px; } .mt-bar { gap: 8px; }
  .mv-nav { display: none; } .mv-mid { padding: 0; }
  .cx-meetbtn { display: inline-grid !important; }
}
@media (prefers-reduced-motion: reduce) { .mv-img, .cx-poll-bar i { transition: none; } }

/* the list header: the title never wraps; the small buttons keep their size */
.cx-list-h h2 { flex: 0 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 19px; }
.cx-list-h .cx-count, .cx-list-h .cx-ibtn { flex: none; }
.cx-list-h .cx-count { white-space: nowrap; }
.cx.dm .cx-list-h .dm-new { border: 0; background: transparent; border-radius: 50%; }
.cx.dm .cx-list-h .dm-new:hover { background: var(--surface-3); }

/* phone: the conversation name keeps its room; search moves out of the header (the list has it), buttons sit closer */
@media (max-width: 760px) {
  .cx-head { gap: 4px; }
  .cx-head .cx-ibtn { width: 38px; }
  .cx-head .cx-ibtn:is([title^="دوّر"], [title^="Search"]) { display: none; }
  .cx-head .cx-no.big { display: none; }
  .cx-head-main { margin-inline-start: 4px; }
  .cx-comp-row { gap: 2px; }
  .cx-comp-row .cx-ibtn { width: 34px; }
  .cx-comp-row .cx-reqbtn { padding-inline: 8px; }
  .cx-box { margin-inline: 4px; }
}

/* an incoming meeting: a card at the top of the screen that stays until answered or ignored */
.mt-ring { position: fixed; z-index: 97; inset-block-start: max(14px, env(safe-area-inset-top, 0px)); inset-inline: 0; margin-inline: auto; width: min(430px, calc(100vw - 24px)); display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: var(--brand-bg); color: var(--on-brand); box-shadow: var(--shadow); border: 1px solid color-mix(in srgb, var(--on-brand) 22%, transparent); animation: mt-ring-in .25s ease-out; }
@keyframes mt-ring-in { from { opacity: 0; transform: translateY(-12px); } }
.mt-ring-av { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--on-accent); font-weight: 800; font-size: 18px; background-size: cover; background-position: center; }
.mt-ring-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; font-size: 13.5px; line-height: 1.45; }
.mt-ring-tx span { font-size: 12px; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mt-ring-btn { flex: none; height: 40px; min-width: 40px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid color-mix(in srgb, var(--on-brand) 35%, transparent); background: transparent; color: var(--on-brand); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; }
.mt-ring-btn.join { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (prefers-reduced-motion: reduce) { .mt-ring { animation: none; } }
/* the menu arrow sits in the bubble's top corner on its own ground, so it never blends into the time */
.cx-chev { width: 22px; height: 20px; border-radius: 0 0 0 8px; }
[dir="rtl"] .cx-chev { border-radius: 0 0 8px 0; }
