:root{
  --bg1:#0b1220;
  --bg2:#0a101c;
  --card: rgba(255,255,255,.06);
  --line: rgba(255,255,255,.08);
  --txt: rgba(236,243,255,.92);
  --muted: rgba(236,243,255,.62);

  --accent:#ff7a00;
  --accent2:#ff8f2b;

  --bubbleIn: rgba(255,255,255,.08);
  --bubbleOut: rgba(255,122,0,.18);
  --shadow: 0 14px 40px rgba(0,0,0,.35);

  --r: 18px;
  --fs: 12.5px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }

body{
  margin:0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial;
  background:
    radial-gradient(900px 420px at 20% -10%, rgba(255,122,0,.18), transparent 62%),
    radial-gradient(700px 380px at 92% 0%, rgba(255,122,0,.10), transparent 60%),
    linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  color:var(--txt);
}

.mRoot{
  height:100%;
  display:flex;
  flex-direction:column;
  max-width:560px;
  margin:0 auto;
  padding: env(safe-area-inset-top) 10px env(safe-area-inset-bottom);
}

.topBar{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 6px 8px;
  border-bottom:1px solid var(--line);
}

.topBar__side{
  width:54px;
  display:flex;
  align-items:center;
}
.topBar__side--left{ justify-content:flex-start; }
.topBar__side--right{ justify-content:flex-end; }

.topLogo{
  width:44px; height:44px;
  object-fit:cover;
  border-radius:14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
}

.topBar__mid{ flex:1; text-align:center; }
.brandName{
  font-size:12.5px;
  letter-spacing:.2px;
  color:rgba(236,243,255,.94);
}
.brandSub{
  margin-top:2px;
  font-size:11px;
  color:var(--muted);
}

.chatWrap{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:10px 2px 0;
  min-height:0;
}

.chat{
  flex:1;
  overflow:auto;
  padding:10px 8px;
  border:1px solid var(--line);
  border-radius: var(--r);
  background: rgba(255,255,255,.03);
  box-shadow: var(--shadow);
  min-height:0;

  /* ✅ مهم للسكرول */
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.msgRow{
  display:flex;
  margin:8px 0;
}
.msgRow.in{ justify-content:flex-end; }   /* RTL: الداخل على اليمين */
.msgRow.out{ justify-content:flex-start; }/* رد البوت على اليسار */

.bubble{
  max-width: 86%;
  padding:10px 10px;
  border-radius: 16px;
  border:1px solid rgba(255,255,255,.08);
  font-size: var(--fs);
  line-height:1.45;
  white-space:pre-wrap;
}

.msgRow.out .bubble{
  background: var(--bubbleIn);
}
.msgRow.in .bubble{
  background: var(--bubbleOut);
  border-color: rgba(255,122,0,.22);
}

.meta{
  margin-top:6px;
  font-size:10.5px;
  color: rgba(236,243,255,.52);
  text-align:left;
}

.typing{
  display:inline-flex;
  align-items:center;
  gap:6px;
}
.dots{
  display:inline-flex;
  gap:4px;
}
.dot{
  width:6px; height:6px;
  border-radius:50%;
  background: rgba(236,243,255,.55);
  animation: b 1.2s infinite ease-in-out;
}
.dot:nth-child(2){ animation-delay:.15s; }
.dot:nth-child(3){ animation-delay:.30s; }
@keyframes b{
  0%, 80%, 100%{ transform: translateY(0); opacity:.55; }
  40%{ transform: translateY(-4px); opacity:1; }
}

.composer{
  padding:10px 2px 12px;
}

.quick{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  margin:0 0 8px;
}

.qBtn{
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: rgba(236,243,255,.9);
  border-radius: 999px;
  padding:8px 10px;
  font-size:11.5px;
  cursor:pointer;
  user-select:none;
  transition: transform .08s ease, border-color .12s ease;
}
.qBtn:active{ transform: scale(.98); }
.qBtn.is-accent{
  border-color: rgba(255,122,0,.35);
  background: rgba(255,122,0,.10);
}

.composeRow{
  display:flex;
  gap:8px;
  align-items:center;
}

.msgInput{
  flex:1;
  height:42px;
  border-radius: 14px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.04);
  color: rgba(236,243,255,.92);
  padding:0 12px;
  outline:none;
  font-size:16px; /* ✅ يمنع iOS zoom */
  -webkit-text-size-adjust: 100%;
}

.msgInput::placeholder{ color: rgba(236,243,255,.45); }

.sendBtn{
  height:42px;
  padding:0 14px;
  border-radius:14px;
  border:1px solid rgba(255,122,0,.30);
  background: linear-gradient(180deg, rgba(255,122,0,.25), rgba(255,122,0,.12));
  color: rgba(255,240,230,.96);
  cursor:pointer;
  font-size:12px;
}
.sendBtn:active{ transform: scale(.99); }

.tinyNote{
  margin-top:8px;
  font-size:11px;
  color: rgba(236,243,255,.55);
  text-align:center;
}
