/* غرف مرداد: room cards (home, topics, directory), the article's entry point, the new-room and invitation
   pages, and the room itself: a phone group chat, and the same conversation in a reading column on computers.
   Built on mx.css's tokens (--mx-*), so light and dark follow the site. */

body.mx-on {
  --rm-me: #113428;
  --rm-me-ink: #EFFAF2;
  --rm-me-meta: rgba(239, 250, 242, .68);
  --rm-quote: rgba(17, 52, 40, .06);
  --rm-wa: #25D366;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body.mx-on { --rm-me: #1F5A45; --rm-quote: rgba(230, 238, 232, .07); }
}
html[data-theme="dark"] body.mx-on { --rm-me: #1F5A45; --rm-quote: rgba(230, 238, 232, .07); }

body.mx-rooms header.header, body.mx-rooms .header-mobile,
body.mx-room header.header, body.mx-room .header-mobile { display: none !important; }

/* ---------- a room in a list ---------- */
.cx-room {
  display: flex; flex-direction: column; gap: 6px; min-width: 0; padding: 16px 18px;
  border-radius: var(--mx-r-card); background: var(--mx-surface); box-shadow: var(--mx-shadow);
  color: var(--mx-text) !important; text-decoration: none !important;
  transition: transform .16s var(--mx-ease);
}
.cx-room:active { transform: scale(.985); }
.cx-room__top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--mx-text-3); }
.cx-room__where { font-weight: 700; color: var(--mx-accent-text); }
.cx-room__tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding-inline: 8px; border-radius: 999px; background: var(--mx-surface-2); font-weight: 700; color: var(--mx-text-2); }
.cx-room__tag .ic { width: 13px !important; height: 13px !important; }
.cx-room__title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 17px; font-weight: 700; line-height: 1.45; }
.cx-room__last { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 14px; line-height: 1.6; color: var(--mx-text-2); }
.cx-room__last b { color: var(--mx-text); }
.cx-room__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding-top: 2px; font-size: 12.5px; color: var(--mx-text-3); }
.cx-room__unread { display: inline-flex; align-items: center; height: 22px; padding-inline: 9px; border-radius: 999px; background: var(--mx-emerald); color: #04210E; font-weight: 700; }

.cx-rooms-row { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(250px, 84%); gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; padding-bottom: 6px; }
.cx-rooms-row::-webkit-scrollbar { display: none; }
.cx-rooms-row > .cx-room { scroll-snap-align: start; }
@media (min-width: 768px) {
  .cx-rooms-row { grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); overflow: visible; }
}
.cx-rooms-intro { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; padding: 16px 18px; border-radius: var(--mx-r-card); background: var(--mx-surface); box-shadow: inset 0 0 0 1px var(--mx-line); }
.cx-rooms-intro p { flex: 1 1 220px; margin: 0; font-size: 15px; line-height: 1.7; color: var(--mx-text-2); }
.cx-sec-h .cx-more { margin-inline-start: auto; }

/* ---------- the end of an article: «افتح غرفة نقاش» / «انضمّ إلى النقاش» ---------- */
.cx-roomcta { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 16px; margin: 28px 0 8px; padding: 18px; border-radius: var(--mx-r-card); background: var(--mx-surface); box-shadow: inset 0 0 0 1px var(--mx-line); text-align: start; }
.cx-roomcta__ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; flex: none; background: rgba(43, 182, 90, .14); color: var(--mx-accent-text); }
.cx-roomcta__ic .ic { width: 24px; height: 24px; }
.cx-roomcta__txt { flex: 1 1 200px; min-width: 0; }
.cx-roomcta__txt h3 { margin: 0 0 2px; font-family: var(--mx-font-ui); font-size: 17px; font-weight: 700; color: var(--mx-text); }
.cx-roomcta__txt p { margin: 0; font-size: 14px; line-height: 1.6; color: var(--mx-text-2); }
.cx-roomcta__acts { display: flex; flex-wrap: wrap; gap: 10px; width: 100%; }
.cx-roomcta__acts .cx-btn { flex: 1 1 auto; }
@media (min-width: 768px) { .cx-roomcta__acts { width: auto; } .cx-roomcta__acts .cx-btn { flex: none; } }

/* ---------- the pages around rooms: directory, new room, invitation, reports ---------- */
.rmx { max-width: 820px; margin: 0 auto; padding: 0 max(16px, env(safe-area-inset-right)) calc(120px + env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left)); }
.rmx-bar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 6px; height: calc(58px + env(safe-area-inset-top)); margin: 0 calc(-1 * max(16px, env(safe-area-inset-left))); padding: env(safe-area-inset-top) 8px 0; background: var(--mx-glass); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); box-shadow: 0 1px 0 var(--mx-line); }
.rmx-bar__title { flex: 1; min-width: 0; margin: 0; font-family: var(--mx-font-ui); font-size: 17px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--mx-text); }
.rmx-bar .cx-btn { margin-inline-end: 6px; }
@media (min-width: 1024px) {
  body.mx-rooms .cx-topnav, body.mx-room .cx-topnav { margin-bottom: 0; color: var(--mx-text); background: var(--mx-glass); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); box-shadow: 0 1px 0 var(--mx-line); }
  .rmx-bar { display: none; }
  .rmx { padding-top: 28px; }
}
.rmx-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; margin: 22px 0 6px; }
.rmx-head h1 { margin: 0; font-family: var(--mx-font-display); font-weight: 400; font-size: 30px; line-height: 1.2; color: var(--mx-text); }
.rmx-head p { flex-basis: 100%; margin: 4px 0 0; font-size: 15px; line-height: 1.7; color: var(--mx-text-2); }
.rmx-tabs { display: flex; gap: 6px; margin: 18px 0 12px; padding: 5px; border-radius: 16px; background: var(--mx-surface-2); }
.rmx-tabs a { flex: 1; display: grid; place-items: center; height: 44px; border-radius: 12px; font-size: 15.5px; font-weight: 700; color: var(--mx-text-2) !important; text-decoration: none !important; }
.rmx-tabs a[aria-current="page"] { background: var(--mx-surface); color: var(--mx-text) !important; box-shadow: var(--mx-shadow); }
.rmx .cx-chips { margin: 4px 0 14px; }
.rmx-list { display: grid; gap: 12px; }
@media (min-width: 768px) { .rmx-list { grid-template-columns: 1fr 1fr; } }
/* a drawn dot between facts: the «·» character reads like the Arabic zero «٠» beside Arabic digits */
.rm-sep { display: inline-block; flex: none; width: 3px; height: 3px; margin-inline: 6px; border-radius: 50%; background: currentColor; opacity: .55; vertical-align: middle; }
.cx-room__meta .rm-sep, .rm-head__title small .rm-sep { margin-inline: 0; }
.rmx-more { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.rmx-head__new { display: none !important; }
@media (min-width: 1024px) { .rmx-head__new { display: inline-flex !important; } }
.rmx-empty { margin: 28px 0; padding: 28px 22px; border-radius: var(--mx-r-card); background: var(--mx-surface); text-align: center; box-shadow: inset 0 0 0 1px var(--mx-line); }
.rmx-empty .ic { width: 34px !important; height: 34px !important; color: var(--mx-accent-text); }
.rmx-empty h2 { margin: 10px 0 6px; font-family: var(--mx-font-ui); font-size: 19px; font-weight: 700; color: var(--mx-text); }
.rmx-empty p { margin: 0 auto 16px; max-width: 34em; font-size: 15px; line-height: 1.7; color: var(--mx-text-2); }
.rmx-empty .cx-btn + .cx-btn { margin-inline-start: 8px; }

/* the new-room form */
.rmx-form { display: grid; gap: 20px; margin-top: 18px; }
.rmx-fld { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.rmx-fld > label, .rmx-fld > legend, .rmx-fld__label { padding: 0; font-size: 15px; font-weight: 700; color: var(--mx-text); }
.rmx-fld small, .rmx-hint { font-size: 13px; line-height: 1.6; color: var(--mx-text-3); }
.rmx-fld input[type="text"], .rmx-fld textarea, .rmx-fld select {
  width: 100%; min-height: 50px; padding: 12px 14px; border: 0; border-radius: var(--mx-r-input);
  background: var(--mx-surface); box-shadow: inset 0 0 0 1px var(--mx-line-2); color: var(--mx-text);
  font: 16px/1.6 var(--mx-font-ui); unicode-bidi: plaintext;
}
.rmx-fld textarea { min-height: 96px; resize: vertical; }
.rmx-fld input:focus, .rmx-fld textarea:focus, .rmx-fld select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--mx-emerald); }
.rmx-source { display: flex; gap: 12px; align-items: center; padding: 14px 16px; border-radius: var(--mx-r-input); background: var(--mx-surface-2); }
.rmx-source .ic { color: var(--mx-accent-text); }
.rmx-source b { display: block; font-size: 16px; line-height: 1.5; color: var(--mx-text); }
.rmx-source small { display: block; }
.rm-choice { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--mx-r-input); background: var(--mx-surface); box-shadow: inset 0 0 0 1px var(--mx-line-2); cursor: pointer; }
.rm-choice input { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--mx-emerald); }
.rm-choice span { font-size: 15px; line-height: 1.6; color: var(--mx-text); }
.rm-choice span small { display: block; }
.rm-choice:has(input:checked) { box-shadow: inset 0 0 0 2px var(--mx-emerald); }
.rm-choice:has(input:disabled) { opacity: .55; cursor: not-allowed; }
.rmx-choices { display: grid; gap: 10px; }
.rmx-note { margin: 0; padding: 12px 14px; border-radius: var(--mx-r-input); background: rgba(43, 182, 90, .1); font-size: 14px; line-height: 1.7; color: var(--mx-text); }
.rmx-note a { font-weight: 700; color: var(--mx-accent-text) !important; }
.rmx-submit { display: grid; gap: 10px; }
.rmx-submit .cx-btn { width: 100%; }
@media (min-width: 768px) { .rmx-submit .cx-btn { width: auto; justify-self: start; min-width: 220px; } }

/* the invitation and other single-card pages */
.rmx-card { max-width: 520px; margin: 32px auto; padding: 26px 22px; border-radius: 26px; background: var(--mx-surface); box-shadow: var(--mx-shadow); text-align: center; }
.rmx-card > .ic { width: 40px !important; height: 40px !important; color: var(--mx-accent-text); }
.rmx-card h1 { margin: 12px 0 8px; font-family: var(--mx-font-display); font-weight: 400; font-size: 26px; line-height: 1.3; color: var(--mx-text); }
.rmx-card p { margin: 0 0 14px; font-size: 15.5px; line-height: 1.75; color: var(--mx-text-2); }
.rmx-card .rmx-card__room { margin: 14px 0; padding: 14px 16px; border-radius: 16px; background: var(--mx-surface-2); font-size: 17px; font-weight: 700; color: var(--mx-text); }
.rmx-card__acts { display: grid; gap: 10px; margin-top: 8px; }
@media (min-width: 576px) { .rmx-card__acts { display: flex; justify-content: center; } }

/* moderators' reports */
.rm-rep { display: grid; gap: 8px; padding: 16px 18px; border-radius: var(--mx-r-card); background: var(--mx-surface); box-shadow: inset 0 0 0 1px var(--mx-line); }
.rm-rep.is-done { opacity: .55; }
.rm-rep__meta { font-size: 13px; color: var(--mx-text-3); }
.rm-rep__t { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; font-size: 15.5px; line-height: 1.65; color: var(--mx-text); }
.rm-rep__acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rm-rep__state { font-size: 13.5px; font-weight: 700; color: var(--mx-accent-text); }

/* ======================= the room ======================= */
body.mx-room { padding-bottom: 0 !important; overflow: hidden; overscroll-behavior: none; }
html:has(body.mx-room) { overflow: hidden; height: 100%; }
body.mx-room::after { display: none; }
.rm { position: fixed; top: 0; right: 0; left: 0; z-index: 40; display: flex; flex-direction: column; height: 100vh; height: 100dvh; background: var(--mx-bg); will-change: transform; }
.rm-icon { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--mx-text) !important; cursor: pointer; text-decoration: none !important; }
.rm-icon:active { background: var(--mx-surface-2); }

/* header: back, title (opens the details), invite */
.rm-head { position: relative; z-index: 3; flex: none; display: flex; align-items: center; gap: 2px; min-height: 58px; padding: calc(env(safe-area-inset-top) + 4px) 6px 4px; background: var(--mx-glass); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); box-shadow: 0 1px 0 var(--mx-line); }
.rm-head__title { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 4px 8px; border: 0; border-radius: 12px; background: none; color: var(--mx-text); font: inherit; text-align: start; cursor: pointer; }
.rm-head__title:active { background: var(--mx-surface-2); }
.rm-head__title b { max-width: 100%; font-size: 16px; font-weight: 700; line-height: 1.35; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm-head__title small { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--mx-text-3); }
.rm-head__title small .ic { width: 13px !important; height: 13px !important; }
.rm-head__caret { transition: transform .2s var(--mx-ease); }
.rm-head__title[aria-expanded="true"] .rm-head__caret { transform: rotate(180deg); }
.rm-head__invite { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 40px; padding-inline: 12px 14px; border: 0; border-radius: 999px; background: var(--mx-surface-2); color: var(--mx-text); font: 700 14.5px var(--mx-font-ui); cursor: pointer; }
.rm-head__invite .ic { width: 19px !important; height: 19px !important; }

.rm-details { position: relative; z-index: 2; flex: none; max-height: 46vh; overflow: auto; padding: 12px 18px 16px; background: var(--mx-surface); box-shadow: 0 1px 0 var(--mx-line), 0 18px 30px -24px rgba(0, 0, 0, .4); }
.rm-details__list { display: grid; gap: 8px; margin: 0; }
.rm-details__list div { display: flex; gap: 12px; align-items: baseline; font-size: 14.5px; }
.rm-details__list dt { flex: none; width: 70px; font-weight: 500; color: var(--mx-text-3); }
.rm-details__list dd { margin: 0; min-width: 0; color: var(--mx-text); }
.rm-details__link { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; color: var(--mx-accent-text) !important; }
.rm-details__link .ic { width: 18px !important; height: 18px !important; }
.rm-details__people { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; }
.rm-details__acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.rm-details__acts:empty { display: none; }
.rm-danger { color: var(--mx-danger) !important; }
.rm-danger-btn { background: var(--mx-danger) !important; color: #fff !important; box-shadow: none !important; }

/* the pinned question */
.rm-pin { position: relative; z-index: 1; flex: none; display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 9px 16px; border: 0; background: var(--mx-surface); box-shadow: 0 1px 0 var(--mx-line); color: var(--mx-text); font: inherit; text-align: start; cursor: pointer; }
.rm-pin > .ic { flex: none; margin-top: 2px; width: 20px !important; height: 20px !important; color: var(--mx-accent-text); }
.rm-pin__txt { display: grid; min-width: 0; }
.rm-pin__txt small { font-size: 12px; font-weight: 700; color: var(--mx-accent-text); }
.rm-pin__txt bdi { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: 14.5px; line-height: 1.6; unicode-bidi: plaintext; }
.rm-pin[aria-expanded="true"] .rm-pin__txt bdi { -webkit-line-clamp: unset; display: block; }

/* the conversation */
.rm-scroll { position: relative; flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding: 6px 10px 14px; outline: none; }
.rm-list { display: flex; flex-direction: column; }
.rm-older { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 10px; font-size: 13px; color: var(--mx-text-3); }
.rm-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--mx-line-2); border-top-color: var(--mx-emerald); animation: rm-spin .8s linear infinite; }
@keyframes rm-spin { to { transform: rotate(360deg); } }
.rm-day { align-self: center; margin: 16px 0 6px; }
.rm-day span { display: inline-block; padding: 3px 12px; border-radius: 999px; background: var(--mx-surface-2); font-size: 12px; font-weight: 700; color: var(--mx-text-2); }

.rm-msg { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 0 8px; margin-top: 10px; }
.rm-msg.is-cont { margin-top: 3px; }
.rm-msg.is-me { justify-content: flex-end; }
.rm-msg__av { display: grid; place-items: center; flex: none; width: 32px; height: 32px; margin-top: 2px; border-radius: 50%; overflow: hidden; background: var(--mx-surface-2); color: var(--mx-text-2) !important; text-decoration: none !important; }
.rm-msg__av img { width: 100%; height: 100%; object-fit: cover; }
.rm-msg__av--gap { visibility: hidden; height: 1px; }
.rm-msg__letter { font-size: 15px; font-weight: 700; }
.rm-bubble { position: relative; min-width: 64px; max-width: min(80%, 36em); padding: 7px 12px 6px; border-radius: 18px; background: var(--mx-surface); color: var(--mx-text); box-shadow: 0 1px 1px rgba(17, 52, 40, .06), inset 0 0 0 1px var(--mx-line); cursor: pointer; -webkit-tap-highlight-color: transparent; outline: none; }
.rm-bubble:focus-visible { box-shadow: 0 0 0 2px var(--mx-emerald); }
.rm-msg:not(.is-me).is-cont .rm-bubble { border-start-start-radius: 6px; }
.rm-msg:not(.is-me):not(.is-end) .rm-bubble { border-end-start-radius: 6px; }
.rm-msg.is-me .rm-bubble { background: var(--rm-me); color: var(--rm-me-ink); box-shadow: none; }
.rm-msg.is-me.is-cont .rm-bubble { border-start-end-radius: 6px; }
.rm-msg.is-me:not(.is-end) .rm-bubble { border-end-end-radius: 6px; }
.rm-msg__name { display: block; margin-bottom: 1px; font-size: 13px; font-weight: 700; color: var(--mx-accent-text) !important; text-decoration: none !important; }
.rm-msg__t { margin: 0; font-family: var(--mx-font-ui); font-size: 16px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; text-align: start; }
html[data-fs="lg"] .rm-msg__t { font-size: 18px; }
html[data-fs="sm"] .rm-msg__t { font-size: 15px; }
.rm-msg__meta { display: block; margin-top: 1px; font-size: 11.5px; line-height: 1.3; text-align: end; color: var(--mx-text-3); }
.rm-msg.is-me .rm-msg__meta { color: var(--rm-me-meta); }
.rm-msg.is-pending .rm-bubble { opacity: .78; }
.rm-msg.is-failed .rm-bubble { box-shadow: 0 0 0 1.5px var(--mx-danger); }
.rm-msg.is-flash .rm-bubble { animation: rm-flash 1.4s var(--mx-ease); }
@keyframes rm-flash { 0%, 30% { box-shadow: 0 0 0 3px var(--mx-emerald); } 100% { box-shadow: 0 0 0 0 transparent; } }
.rm-msg__fail { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 12px; width: 100%; margin-top: 4px; font-size: 13px; color: var(--mx-danger); }
.rm-msg__fail button { padding: 4px 2px; border: 0; background: none; font: 700 13px var(--mx-font-ui); color: var(--mx-text); text-decoration: underline; cursor: pointer; }
.rm-msg__more { align-self: center; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--mx-text-3); opacity: 0; cursor: pointer; transition: opacity .15s; }
.rm-msg__more .ic { width: 18px !important; height: 18px !important; }
.rm-msg:hover .rm-msg__more, .rm-msg__more:focus-visible { opacity: 1; }
.rm-msg.is-me .rm-msg__more { order: -1; }
.rm-quote { display: grid; gap: 1px; width: 100%; margin: 3px 0 5px; padding: 5px 10px; border: 0; border-inline-start: 3px solid var(--mx-emerald); border-radius: 10px; background: var(--rm-quote); color: inherit; font: inherit; text-align: start; cursor: pointer; }
.rm-msg.is-me .rm-quote { background: rgba(255, 255, 255, .12); border-inline-start-color: #8FE6A8; }
.rm-quote b { font-size: 12.5px; }
.rm-quote bdi { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 13.5px; line-height: 1.5; opacity: .85; unicode-bidi: plaintext; }
.rm-quote__gone { font-size: 13px; font-style: italic; opacity: .75; }

/* empty room */
.rm-empty { max-width: 440px; margin: 28px auto 8px; text-align: center; }
.rm-empty__q { padding: 20px 18px; border-radius: var(--mx-r-card); background: var(--mx-surface); box-shadow: var(--mx-shadow); }
.rm-empty__q small { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 700; color: var(--mx-accent-text); }
.rm-empty__q small .ic { width: 18px !important; height: 18px !important; }
.rm-empty__q p { margin: 8px 0 0; font-family: var(--mx-font-read); font-size: 24px; line-height: 1.5; color: var(--mx-text); unicode-bidi: plaintext; }
.rm-empty__q--plain .ic { width: 30px !important; height: 30px !important; color: var(--mx-accent-text); }
.rm-empty__q--plain p { font-family: var(--mx-font-ui); font-size: 16px; color: var(--mx-text-2); }
.rm-empty__acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }

/* sealed room */
.rm-sealed { margin: 8px 0 14px; padding: 20px 18px; border-radius: var(--mx-r-card); background: var(--mx-surface); box-shadow: var(--mx-shadow); }
.rm-sealed__kicker { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; font-weight: 700; color: var(--mx-accent-text); }
.rm-sealed__kicker .ic { width: 18px !important; height: 18px !important; }
.rm-sealed__q { margin: 8px 0 12px; font-family: var(--mx-font-read); font-weight: 600; font-size: 25px; line-height: 1.45; color: var(--mx-text); unicode-bidi: plaintext; }
.rm-sealed__progress { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; color: var(--mx-text-2); }
.rm-dots { display: inline-flex; gap: 6px; }
.rm-dots i { width: 12px; height: 12px; border-radius: 50%; box-shadow: inset 0 0 0 2px var(--mx-line-2); }
.rm-dots i.is-on { background: var(--mx-emerald); box-shadow: none; }
.rm-sealed__body { margin-top: 14px; }
.rm-sealed__lead { margin: 0 0 10px; font-size: 15px; font-weight: 700; color: var(--mx-text); }
.rm-sealed__note { margin: 10px 0; font-size: 13.5px; line-height: 1.7; color: var(--mx-text-3); }
.rm-answer textarea { width: 100%; min-height: 120px; padding: 12px 14px; border: 0; border-radius: 16px; background: var(--mx-bg); box-shadow: inset 0 0 0 1px var(--mx-line-2); color: var(--mx-text); font: 16px/1.6 var(--mx-font-ui); resize: vertical; unicode-bidi: plaintext; }
.rm-answer textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--mx-emerald); }
.rm-answer .cx-btn { width: 100%; }
.rm-answer__mine { margin: 0; padding: 12px 14px; border-radius: 16px; background: var(--mx-surface-2); white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; font-size: 15.5px; line-height: 1.65; color: var(--mx-text); }
.rm-answers { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: rmA; }
.rm-answers li { position: relative; padding: 12px 14px; border-radius: 16px; background: var(--mx-surface-2); }
.rm-answers li.is-me { box-shadow: inset 0 0 0 1.5px var(--mx-emerald); }
.rm-answers p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; unicode-bidi: plaintext; font-size: 15.5px; line-height: 1.65; color: var(--mx-text); }
.rm-answers small { display: block; margin-top: 6px; font-size: 12px; font-weight: 700; color: var(--mx-accent-text); }

/* «رسائل جديدة» */
.rm-newpill { position: absolute; z-index: 4; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px; height: 38px; padding-inline: 14px; border: 0; border-radius: 999px; background: var(--mx-text); color: var(--mx-bg); font: 700 14px var(--mx-font-ui); box-shadow: 0 12px 28px -12px rgba(0, 0, 0, .5); cursor: pointer; }
.rm-newpill .ic { width: 18px !important; height: 18px !important; }
.rm--nocompose .rm-newpill { bottom: calc(20px + env(safe-area-inset-bottom)); }

/* the composer, fixed to the bottom and above the keyboard */
.rm-compose { position: relative; z-index: 3; flex: none; padding: 8px max(10px, env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); background: var(--mx-glass); -webkit-backdrop-filter: blur(18px) saturate(160%); backdrop-filter: blur(18px) saturate(160%); box-shadow: 0 -1px 0 var(--mx-line); }
.rm--kb .rm-compose { padding-bottom: 8px; }
.rm-form { display: flex; align-items: flex-end; gap: 8px; }
.rm-form textarea { flex: 1; min-width: 0; height: 44px; min-height: 44px; max-height: 132px; padding: 10px 16px; border: 0; border-radius: 22px; background: var(--mx-surface); box-shadow: inset 0 0 0 1px var(--mx-line-2); color: var(--mx-text); font: 16px/1.5 var(--mx-font-ui); resize: none; unicode-bidi: plaintext; }
.rm-form textarea:focus { outline: none; box-shadow: inset 0 0 0 2px var(--mx-emerald); }
.rm-send { flex: none; display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: var(--mx-btn, #113428); color: var(--mx-btn-ink, #EFFAF2); cursor: pointer; transition: opacity .15s, transform .16s var(--mx-ease); }
.rm-send:active { transform: scale(.92); }
.rm-send:disabled { opacity: .4; cursor: default; }
.rm-send .ic { width: 22px !important; height: 22px !important; transform: scaleX(-1); }
.rm-replying { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 4px 10px 4px 4px; border-inline-start: 3px solid var(--mx-emerald); border-radius: 10px; background: var(--rm-quote); }
.rm-replying > .ic { flex: none; width: 18px !important; height: 18px !important; color: var(--mx-accent-text); margin-inline-start: 6px; }
.rm-replying__txt { flex: 1; min-width: 0; display: grid; }
.rm-replying__txt b { font-size: 12.5px; color: var(--mx-accent-text); }
.rm-replying__txt bdi { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--mx-text-2); }
.rm-replying .rm-icon { width: 36px; height: 36px; }
.rm-guest { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.rm-guest p { margin: 0; font-size: 14.5px; color: var(--mx-text-2); }
.rm-guest div { display: flex; gap: 8px; }
.rm-closed { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 6px; font-size: 14px; color: var(--mx-text-2); text-align: center; }
.rm-closed .ic { width: 18px !important; height: 18px !important; }
.rm-err { margin: 8px 0 0; font-size: 14px; line-height: 1.6; color: var(--mx-danger); }
.rm-err.is-ok { color: var(--mx-accent-text); }
.rm-err--compose { margin: 6px 6px 0; font-size: 13px; }

/* computers: the same conversation in a reading column under the top bar */
@media (min-width: 1024px) {
  .rm { position: relative; top: auto; right: auto; left: auto; z-index: 1; max-width: 780px; height: calc(100vh - 72px); height: calc(100dvh - 72px); margin: 0 auto; transform: none !important; box-shadow: 1px 0 0 var(--mx-line), -1px 0 0 var(--mx-line); }
  .rm-head { padding-top: 6px; }
  .rm-scroll { padding: 10px 22px 18px; }
  .rm-compose { padding: 10px 18px 14px; }
  .rm-bubble { max-width: min(72%, 36em); }
  .rm-newpill { bottom: 92px; }
}

/* ---------- sheets: invite, a message's actions, report, close ---------- */
.rm-scrim { position: fixed; inset: 0; z-index: 1090; background: rgba(4, 14, 10, .45); opacity: 0; transition: opacity .2s; }
.rm-scrim.is-open { opacity: 1; }
.rm-sheet { position: fixed; right: 0; bottom: 0; left: 0; z-index: 1091; max-height: 86vh; max-height: 86dvh; overflow-y: auto; overscroll-behavior: contain; padding: 6px max(18px, env(safe-area-inset-right)) calc(18px + env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left)); border-radius: 28px 28px 0 0; background: var(--mx-surface); color: var(--mx-text); box-shadow: 0 -20px 60px -24px rgba(0, 0, 0, .45); transform: translateY(105%); transition: transform .3s var(--mx-ease); }
.rm-sheet.is-open { transform: none; }
.rm-sheet__grip { display: block; width: 40px; height: 5px; margin: 4px auto 10px; border-radius: 999px; background: var(--mx-line-2); }
.rm-sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.rm-sheet__head h2 { margin: 0; font-family: var(--mx-font-display); font-weight: 400; font-size: 21px; line-height: 1.3; }
.rm-sheet__lead { margin: 0 0 14px; font-size: 14.5px; line-height: 1.7; color: var(--mx-text-2); }
.rm-sheet__acts { display: flex; flex-wrap: wrap; gap: 10px; }
.rm-sheet__acts .cx-btn { flex: 1 1 140px; }
.rm-sheet__minor { display: block; margin: 14px auto 0; padding: 6px; border: 0; background: none; font: 700 14px var(--mx-font-ui); color: var(--mx-danger); text-decoration: underline; cursor: pointer; }
.rm-share { display: grid; gap: 10px; }
.rm-share__btn { display: flex; align-items: center; gap: 12px; width: 100%; height: 54px; padding-inline: 16px; border: 0; border-radius: 16px; background: var(--mx-surface-2); color: var(--mx-text) !important; font: 700 16px var(--mx-font-ui); text-decoration: none !important; cursor: pointer; }
.rm-share__btn .ic { width: 24px !important; height: 24px !important; }
.rm-share__btn--wa { background: var(--rm-wa); color: #052E16 !important; }
.rm-share__url { width: 100%; height: 44px; margin-top: 12px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--mx-bg); box-shadow: inset 0 0 0 1px var(--mx-line); color: var(--mx-text-2); font: 13.5px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: left; }
.rm-sheet--menu { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
.rm-acts__quote { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin: 0 0 6px; padding: 10px 12px; border-radius: 12px; background: var(--mx-surface-2); font-size: 14px; line-height: 1.6; color: var(--mx-text-2); white-space: pre-wrap; unicode-bidi: plaintext; }
.rm-menu__i { display: flex; align-items: center; gap: 14px; width: 100%; height: 54px; padding: 0 6px; border: 0; border-top: 1px solid var(--mx-line); background: none; color: var(--mx-text); font: 500 16px var(--mx-font-ui); text-align: start; cursor: pointer; }
.rm-menu__i .ic { width: 22px !important; height: 22px !important; }
.rm-acts__quote + .rm-menu__i { border-top: 0; }
.rm-reasons { display: grid; gap: 2px; }
.rm-reasons label { display: flex; align-items: center; gap: 12px; padding: 13px 4px; border-bottom: 1px solid var(--mx-line); font-size: 15.5px; cursor: pointer; }
.rm-reasons input { width: 20px; height: 20px; margin: 0; accent-color: var(--mx-emerald); }
.rm-reasons a { color: var(--mx-accent-text) !important; font-weight: 700; }
.rm-reasons .cx-btn { margin-top: 14px; width: 100%; }
.rm-done { display: flex; align-items: center; gap: 8px; margin: 10px 0; font-size: 15.5px; font-weight: 700; color: var(--mx-accent-text); }
html.rm-sheet-open .rm-scroll { overflow: hidden; }
@media (min-width: 768px) {
  .rm-sheet { top: 50%; right: auto; bottom: auto; left: 50%; width: 440px; max-height: 80vh; padding: 18px 22px 22px; border-radius: 24px; opacity: 0; transform: translate(-50%, -46%); transition: transform .26s var(--mx-ease), opacity .2s; }
  .rm-sheet.is-open { opacity: 1; transform: translate(-50%, -50%); }
  .rm-sheet__grip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .rm-sheet, .rm-scrim, .cx-room, .rm-send { transition: none; }
  .rm-msg.is-flash .rm-bubble, .rm-spin { animation: none; }
}
