/* 💬 المحادثة — بادئة rc- كي لا تتأثر بأنماط البرامج الثلاثة ولا تؤثر فيها */
:root {
  --rc-brand: #78782E;
  --rc-brand-d: #5f5f24;
  --rc-mine: #eef0d6;
  --rc-bg: #f4f5f0;
  --rc-card: #ffffff;
  --rc-ink: #16202a;
  --rc-muted: #66727e;
  --rc-line: #e1e5e0;
  --rc-bot: #eef3f9;
  --rc-danger: #b91c1c;
  --rc-ok: #15803d;
}
html.rc-lock, html.rc-lock body { overflow: hidden; }

.rc-overlay {
  position: fixed; inset: 0; z-index: 9000; background: var(--rc-bg); color: var(--rc-ink);
  display: flex; flex-direction: column; height: 100dvh; direction: rtl;
}
.rc-overlay > .rc-thread, .rc-overlay > .rc-mgr { flex: 1; min-height: 0; }

.rc-thread { display: flex; flex-direction: column; height: 100%; min-height: 0; background: var(--rc-bg); color: var(--rc-ink); direction: rtl; }
.rc-head {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  background: #231F20; color: #fff; flex: none;
}
.rc-back { background: none; border: 0; color: inherit; font-size: 20px; min-width: 40px; min-height: 40px; cursor: pointer; }
.rc-title { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.rc-title b { font-size: 16px; }
.rc-sub { font-size: 12px; opacity: .8; min-height: 0; }
.rc-sub:empty { display: none; }

.rc-body { position: relative; flex: 1; min-height: 0; display: flex; }
.rc-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.rc-more { align-self: center; background: var(--rc-card); border: 1px solid var(--rc-line); border-radius: 16px; padding: 6px 14px; font: inherit; font-size: 13px; color: var(--rc-muted); cursor: pointer; }
.rc-more[hidden], .rc-jump[hidden] { display: none; }
.rc-jump { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); background: var(--rc-brand); color: #fff; border: 0; border-radius: 16px; padding: 7px 14px; font: inherit; font-size: 13px; box-shadow: 0 2px 8px rgba(0,0,0,.2); cursor: pointer; }
.rc-empty { color: var(--rc-muted); text-align: center; margin: auto; padding: 24px; font-size: 14px; }
.rc-day { text-align: center; margin: 8px 0 4px; }
.rc-day span { background: #e6e8df; color: #4c5560; font-size: 12px; border-radius: 10px; padding: 3px 11px; }

.rc-row { display: flex; }
.rc-mine { justify-content: flex-start; }
.rc-theirs { justify-content: flex-end; }
.rc-bubble {
  max-width: min(82%, 520px); background: var(--rc-card); border: 1px solid var(--rc-line); border-radius: 14px;
  padding: 7px 11px; font-size: 15px; line-height: 1.65; overflow-wrap: anywhere; box-shadow: 0 1px 1px rgba(0,0,0,.04);
}
.rc-mine .rc-bubble { background: var(--rc-mine); border-color: #dfe2bd; }
.rc-bubble.rc-bot { background: var(--rc-bot); border-color: #d6e2ef; }
.rc-bubble.rc-card { width: min(88%, 460px); max-width: none; }
.rc-who { font-size: 12px; font-weight: 700; color: var(--rc-brand-d); margin-bottom: 1px; }
.rc-text { white-space: pre-wrap; }
.rc-quote { font-size: 12.5px; line-height: 1.5; color: var(--rc-muted); border-inline-start: 3px solid var(--rc-brand); padding-inline-start: 7px; margin-bottom: 4px; }
.rc-meta { display: flex; gap: 5px; justify-content: flex-end; align-items: center; font-size: 11px; color: var(--rc-muted); margin-top: 2px; flex-wrap: wrap; }
.rc-tick { letter-spacing: -2px; margin-inline-start: 3px; }
.rc-tick.rc-seen { color: #1d6fd6; font-weight: 700; }
.rc-wait { opacity: .78; }
.rc-failed { opacity: 1; }
.rc-failed .rc-pending { color: var(--rc-danger); }
.rc-retry { background: none; border: 0; color: var(--rc-brand-d); text-decoration: underline; font: inherit; cursor: pointer; padding: 4px; }
.rc-imgbtn { display: block; padding: 0; border: 0; background: none; cursor: zoom-in; margin-bottom: 3px; }
.rc-imgbtn img, .rc-preview { display: block; max-width: 100%; width: 260px; max-height: 300px; object-fit: cover; border-radius: 9px; -webkit-touch-callout: none; }

.rc-composer {
  display: flex; align-items: flex-end; gap: 7px; padding: 8px; padding-bottom: calc(8px + env(safe-area-inset-bottom));
  background: var(--rc-card); border-top: 1px solid var(--rc-line); flex: none;
}
.rc-composer[hidden] { display: none; }
.rc-input {
  flex: 1; min-width: 0; width: 100%; box-sizing: border-box; border: 1px solid var(--rc-line); border-radius: 12px; padding: 9px 12px;
  font: inherit; font-size: 16px; line-height: 1.45; background: #fff; color: var(--rc-ink); resize: none; max-height: 120px;
}
.rc-input:focus { outline: 2px solid var(--rc-brand); outline-offset: -1px; }
/* أنماط البرامج تعطي textarea ارتفاعاً وهامشاً — خانة الكتابة سطرٌ واحد يكبر مع النص */
.rc-composer .rc-input { min-height: 42px; height: 42px; margin: 0; }
.rc-form .rc-input, .rc-blast .rc-input { margin: 0; min-height: 42px; }
.rc-form textarea.rc-input, .rc-blast textarea.rc-input { min-height: 64px; }
.rc-attach { background: none; border: 0; font-size: 22px; min-width: 42px; min-height: 42px; cursor: pointer; }
.rc-send, .rc-primary { background: var(--rc-brand); color: #fff; border: 0; border-radius: 12px; padding: 0 16px; min-height: 42px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.rc-send:hover, .rc-primary:hover { background: var(--rc-brand-d); }
.rc-primary { width: 100%; margin-top: 7px; }
.rc-primary[disabled] { opacity: .55; cursor: default; }

.rc-cardbox { margin-top: 6px; }
.rc-state { font-size: 13px; color: var(--rc-muted); }
.rc-state.rc-ok { color: var(--rc-ok); font-weight: 700; }
.rc-err { color: var(--rc-danger); font-size: 13px; margin-top: 5px; }
.rc-err[hidden] { display: none; }
.rc-form { display: flex; flex-direction: column; gap: 6px; }
.rc-form [hidden] { display: none; }
.rc-lbl { font-size: 13px; font-weight: 700; margin-top: 7px; margin-bottom: 4px; }
.rc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rc-chip { background: #fff; border: 1px solid #cfd3c6; color: var(--rc-ink); border-radius: 16px; padding: 7px 12px; min-height: 36px; font: inherit; font-size: 13px; cursor: pointer; }
.rc-chip[aria-pressed="true"] { background: var(--rc-brand); border-color: var(--rc-brand); color: #fff; }
.rc-addname { display: flex; gap: 6px; margin-top: 6px; }
.rc-note { font-size: 15px; margin-top: 6px; }

.rc-light { position: fixed; inset: 0; z-index: 9500; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; }
.rc-light img { max-width: 100%; max-height: 100%; object-fit: contain; -webkit-touch-callout: none; }
.rc-light-x { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 10px; background: rgba(255,255,255,.18); color: #fff; border: 0; border-radius: 50%; width: 40px; height: 40px; font-size: 18px; cursor: pointer; }

/* شاشة الإدارة */
.rc-mgr { display: grid; grid-template-columns: 330px 1fr; height: calc(100dvh - 40px); min-height: 420px; background: var(--rc-card); border: 1px solid var(--rc-line); border-radius: 12px; overflow: hidden; direction: rtl; color: var(--rc-ink); }
.rc-overlay .rc-mgr { height: 100%; border: 0; border-radius: 0; }
.rc-side { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--rc-line); }
.rc-sidehead { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--rc-line); flex: none; }
.rc-overlay .rc-sidehead { padding-top: calc(10px + env(safe-area-inset-top)); background: #231F20; color: #fff; }
.rc-sidehead b { flex: 1; }
.rc-blast { padding: 10px; border-bottom: 1px solid var(--rc-line); background: #fafaf5; flex: none; }
.rc-blast[hidden], .rc-flash[hidden] { display: none; }
.rc-flash { padding: 8px 12px; background: #e8f5ec; color: var(--rc-ok); font-size: 13px; flex: none; }
.rc-sidescroll { flex: 1; min-height: 0; overflow-y: auto; }
.rc-queue { padding: 10px; background: #fff8e6; border-bottom: 1px solid #eadfb8; display: flex; flex-direction: column; gap: 8px; }
.rc-queue[hidden] { display: none; }
.rc-qhead { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 14px; }
.rc-qrow { background: #fff; border: 1px solid #eadfb8; border-radius: 10px; padding: 8px; display: flex; flex-direction: column; gap: 6px; font-size: 14px; line-height: 1.6; }
.rc-qrow textarea.rc-input { margin: 0; min-height: 72px; max-height: 160px; font-size: 15px; }
.rc-chip.rc-go { background: var(--rc-brand); border-color: var(--rc-brand); color: #fff; font-weight: 700; }
.rc-chip[disabled] { opacity: .55; cursor: default; }
.rc-threads { min-height: 0; }
.rc-trow { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; background: none; border: 0; border-bottom: 1px solid #f0f1ec; text-align: right; font: inherit; color: inherit; cursor: pointer; }
.rc-trow:hover { background: #f8f9f3; }
.rc-trow.rc-active { background: var(--rc-mine); }
.rc-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--rc-brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 17px; }
.rc-tmain { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rc-tname { font-weight: 700; font-size: 14px; }
.rc-tprev { color: var(--rc-muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-tside { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; color: var(--rc-muted); font-size: 11px; }
.rc-badge { background: #dc2626; color: #fff; border-radius: 10px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.rc-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--rc-bg); }
.rc-pane > .rc-empty { margin: auto; }

@media (min-width: 761px) { .rc-mgr .rc-thread .rc-back { display: none; } }
@media (max-width: 760px) {
  .rc-mgr { grid-template-columns: 1fr; height: calc(100dvh - 90px); }
  .rc-overlay .rc-mgr { height: 100%; }
  .rc-mgr .rc-pane { display: none; }
  .rc-mgr.rc-open .rc-side { display: none; }
  .rc-mgr.rc-open .rc-pane { display: flex; }
}
