/* mdr investment chatbot widget */
#mdrbot,#mdrbot *{box-sizing:border-box}
#mdrbot{position:fixed;z-index:99998;bottom:22px;font-family:"mdr-reg",-apple-system,"Segoe UI",Tahoma,sans-serif}
#mdrbot.mdr-left{left:22px}
#mdrbot.mdr-right{right:22px}

/* launcher */
#mdrbot-btn{width:74px;height:74px;border-radius:50%;border:0;cursor:pointer;background:#c8a35a;color:#17211F;
  box-shadow:0 10px 30px rgba(200,163,90,.5);display:flex;align-items:center;justify-content:center;
  transition:transform .2s ease,box-shadow .2s ease;padding:0}
#mdrbot-btn:hover{transform:translateY(-2px);box-shadow:0 14px 34px rgba(200,163,90,.6)}
#mdrbot-btn svg{width:34px;height:34px;display:block}
#mdrbot-badge{position:absolute;top:-4px;width:14px;height:14px;border-radius:50%;background:#17211F;border:2px solid #fff}
#mdrbot.mdr-left #mdrbot-badge{right:-2px}
#mdrbot.mdr-right #mdrbot-badge{left:-2px}
#mdrbot.mdr-open #mdrbot-btn{transform:scale(.85);opacity:.9}
#mdrbot.mdr-open #mdrbot-badge{display:none}

/* panel */
#mdrbot-panel{position:absolute;bottom:76px;width:372px;max-width:calc(100vw - 32px);height:540px;max-height:calc(100vh - 130px);
  background:#fff;border-radius:16px;overflow:hidden;display:none;flex-direction:column;
  box-shadow:0 24px 60px rgba(0,0,0,.26);border:1px solid #ececec}
#mdrbot.mdr-left #mdrbot-panel{left:0}
#mdrbot.mdr-right #mdrbot-panel{right:0}
#mdrbot.mdr-open #mdrbot-panel{display:flex;animation:mdrup .22s ease}
@keyframes mdrup{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:none}}

/* header */
#mdrbot-head{background:#c8a35a;color:#17211F;padding:14px 16px;display:flex;align-items:center;gap:10px;flex:0 0 auto}
#mdrbot-head img{height:26px;width:auto;display:block}
#mdrbot-head .mdr-t{font-family:"mdr-bold",inherit;font-size:14px;line-height:1.3;flex:1;min-width:0}
#mdrbot-head .mdr-t small{display:block;font-family:"mdr-reg",inherit;font-size:11px;opacity:.65;font-weight:400}
#mdrbot-head button{background:transparent;border:1px solid rgba(255,255,255,.28);color:#fff;border-radius:6px;
  cursor:pointer;font-size:11px;padding:4px 8px;line-height:1;font-family:inherit}
#mdrbot-head button:hover{background:rgba(255,255,255,.12)}
#mdrbot-head .mdr-x{border:0;font-size:20px;padding:0 4px;opacity:.8}

/* body */
#mdrbot-body{flex:1 1 auto;overflow-y:auto;padding:16px;background:#fafafa}
#mdrbot-body::-webkit-scrollbar{width:6px}
#mdrbot-body::-webkit-scrollbar-thumb{background:#d8d8d8;border-radius:3px}
.mdr-msg{max-width:88%;margin-bottom:10px;padding:11px 13px;border-radius:12px;font-size:13.5px;line-height:1.75;
  white-space:pre-wrap;word-wrap:break-word;color:#333;animation:mdrin .18s ease}
@keyframes mdrin{from{opacity:0;transform:translateY(5px)}to{opacity:1;transform:none}}
.mdr-bot{background:#fff;border:1px solid #ececec;border-start-start-radius:3px}
.mdr-user{background:#c8a35a;color:#17211F;margin-inline-start:auto;border-start-end-radius:3px}
.mdr-msg a{color:#111;font-family:"mdr-bold",inherit;text-decoration:underline;text-underline-offset:3px}
.mdr-user a{color:#fff}
.mdr-src{display:inline-block;margin-top:8px;font-size:12px;background:#f2f2f2;border:1px solid #e5e5e5;
  border-radius:20px;padding:5px 12px;text-decoration:none!important;color:#111!important}
.mdr-src:hover{background:#111;color:#fff!important;border-color:#111}
.mdr-typing span{display:inline-block;width:6px;height:6px;margin:0 2px;border-radius:50%;background:#bbb;animation:mdrbl 1s infinite}
.mdr-typing span:nth-child(2){animation-delay:.15s}
.mdr-typing span:nth-child(3){animation-delay:.3s}
@keyframes mdrbl{0%,60%,100%{opacity:.3}30%{opacity:1}}

/* chips */
#mdrbot-chips{padding:0 16px 10px;display:flex;flex-wrap:wrap;gap:7px;background:#fafafa;flex:0 0 auto}
#mdrbot-chips button{background:#fff;border:1px solid #ddd;border-radius:20px;padding:6px 13px;font-size:12.5px;
  cursor:pointer;color:#333;font-family:inherit;transition:.15s}
#mdrbot-chips button:hover{background:#c8a35a;color:#17211F;border-color:#111}

/* form */
.mdr-lead{background:#fff;border:1px solid #ececec;border-radius:12px;padding:13px;margin-bottom:10px}
.mdr-lead h4{margin:0 0 9px;font-size:13px;font-family:"mdr-bold",inherit;color:#111}
.mdr-lead input,.mdr-lead textarea{width:100%;border:1px solid #e0e0e0;border-radius:8px;padding:9px 11px;
  font-size:13px;margin-bottom:7px;font-family:inherit;background:#fbfbfb;color:#333}
.mdr-lead input:focus,.mdr-lead textarea:focus{outline:0;border-color:#111;background:#fff}
.mdr-lead textarea{min-height:62px;resize:vertical}
.mdr-lead button{width:100%;background:#c8a35a;color:#17211F;border:0;border-radius:8px;padding:10px;font-size:13px;
  cursor:pointer;font-family:"mdr-bold",inherit}
.mdr-lead button:disabled{opacity:.55;cursor:default}
.mdr-lead .mdr-err{color:#b00020;font-size:12px;margin-bottom:6px;display:none}

/* input bar */
#mdrbot-foot{flex:0 0 auto;border-top:1px solid #eee;background:#fff;padding:10px;display:flex;gap:8px;align-items:center}
#mdrbot-in{flex:1;border:1px solid #e2e2e2;border-radius:22px;padding:10px 15px;font-size:13.5px;font-family:inherit;
  background:#fafafa;color:#222}
#mdrbot-in:focus{outline:0;border-color:#111;background:#fff}
#mdrbot-send{width:38px;height:38px;flex:0 0 38px;border-radius:50%;border:0;background:#c8a35a;color:#17211F;cursor:pointer;
  display:flex;align-items:center;justify-content:center;padding:0}
#mdrbot-send svg{width:16px;height:16px}
#mdrbot[dir="rtl"] #mdrbot-send svg{transform:scaleX(-1)}
#mdrbot-note{font-size:10.5px;color:#aaa;text-align:center;padding:0 10px 8px;background:#fff}

@media (max-width:480px){
  #mdrbot{bottom:16px}
  #mdrbot.mdr-left{left:16px}
  #mdrbot.mdr-right{right:16px}
  #mdrbot-panel{width:calc(100vw - 32px);height:calc(100vh - 120px)}
}
/* v1.0.1 */
#mdrbot button,#mdrbot input,#mdrbot textarea{text-transform:none;letter-spacing:normal}
#mdrbot-head img{filter:brightness(0) invert(1)}
#mdrbot[dir="ltr"] #mdrbot-in,#mdrbot[dir="ltr"] .mdr-msg,#mdrbot[dir="ltr"] .mdr-lead input,#mdrbot[dir="ltr"] .mdr-lead textarea,#mdrbot[dir="ltr"] #mdrbot-chips button,#mdrbot[dir="ltr"] .mdr-lead h4{direction:ltr;text-align:left}
#mdrbot[dir="rtl"] #mdrbot-in,#mdrbot[dir="rtl"] .mdr-msg,#mdrbot[dir="rtl"] .mdr-lead input,#mdrbot[dir="rtl"] .mdr-lead textarea,#mdrbot[dir="rtl"] #mdrbot-chips button,#mdrbot[dir="rtl"] .mdr-lead h4{direction:rtl;text-align:right}
#mdrbot .mdr-lead input[dir="ltr"]{direction:ltr;text-align:left}


/* === brand override: mdr.sa identity (black header, gold accents) — launcher stays gold === */
#mdrbot-head{background:#141414;color:#fff;}
#mdrbot-head img{filter:brightness(0) invert(1);}

#mdrbot-head{background:#141414;color:#fff;}
#mdrbot-head img{filter:brightness(0) invert(1);}
#mdrbot.mdr-open #mdrbot-panel{height:600px}
#mdrbot-end{display:none}
#mdrbot-chips .mdr-endchip{background:#141414;color:#fff;border-color:#141414;display:inline-flex;align-items:center;gap:6px}
#mdrbot-chips .mdr-endchip svg{width:13px;height:13px;display:block}
#mdrbot-mic{width:38px;height:38px;flex:0 0 38px;border-radius:50%;border:1px solid #e2e2e2;background:#fff;color:#17211F;cursor:pointer;display:flex;align-items:center;justify-content:center;padding:0}
#mdrbot-mic svg{width:17px;height:17px;display:block}
#mdrbot-mic[hidden]{display:none}

/* === v1.3.0: concierge layer (scroll wrapper, newest button, feedback, message animation) === */
#mdrbot-bodywrap{position:relative;flex:1 1 auto;display:flex;flex-direction:column;min-height:0}
#mdrbot-bodywrap #mdrbot-body{flex:1 1 auto;min-height:0}
#mdrbot-down{position:absolute;bottom:10px;left:50%;transform:translate(-50%,8px);opacity:0;pointer-events:none;background:#17211F;color:#fff;border:0;border-radius:20px;padding:6px 14px;font:inherit;font-size:12px;box-shadow:0 4px 14px rgba(0,0,0,.2);cursor:pointer;transition:opacity .2s,transform .2s;z-index:2}
#mdrbot-down.show{opacity:1;pointer-events:auto;transform:translate(-50%,0)}
.mdr-msg{animation:mdrIn .28s ease-out both}
.mdr-msg.mdr-nofx{animation:none}
@keyframes mdrIn{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.mdr-fb{display:flex;align-items:center;gap:6px;margin-top:8px;padding-top:6px;border-top:1px dashed #e6e6e6;font-size:11.5px;color:#888}
.mdr-fb button{background:none;border:1px solid #e3e3e3;border-radius:14px;padding:1px 7px;cursor:pointer;font-size:13px;line-height:1.5;transition:background .15s,border-color .15s}
.mdr-fb button:hover{background:#f2f2f2;border-color:#bbb}
.mdr-typing span{animation-duration:1s}
@media (prefers-reduced-motion: reduce){.mdr-msg{animation:none}#mdrbot-down{transition:none}}
/* MDR Cards v1.0 — host-agnostic styles (prefix .mdrc). Uses logical properties so RTL/LTR follow the container's dir. */
.mdrc{display:block;background:#fff;border:1px solid #e6e6e6;overflow:hidden;font-size:13.5px;line-height:1.6;color:#17211F;clip-path:polygon(0 18px,18px 0,100% 0,100% 100%,0 100%);margin:6px 0 2px}
[dir="rtl"] .mdrc{clip-path:polygon(0 0,calc(100% - 18px) 0,100% 18px,100% 100%,0 100%)}
.mdrc__img{position:relative;aspect-ratio:16/9;background:#ececec;overflow:hidden}
.mdrc__img img{width:100%;height:100%;object-fit:cover;display:block}
.mdrc__img--none{aspect-ratio:16/6;background:linear-gradient(135deg,#eee,#f7f7f7)}
.mdrc__body{padding:12px 14px 13px}
.mdrc__title{margin:0 0 2px;font-size:15px;font-weight:700;line-height:1.4}
.mdrc__sub{color:#6b6b6b;font-size:12.5px;margin-bottom:6px}
.mdrc__desc{margin:4px 0 8px;color:#333}
.mdrc__desc--short{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden;font-size:12.5px;color:#555}
.mdrc__meta{display:flex;flex-wrap:wrap;gap:6px;margin:4px 0 10px}
.mdrc__tag{background:#f4f4f4;border-radius:3px;padding:3px 8px;font-size:12px;color:#333}
.mdrc__tag i{font-style:normal;color:#888;margin-inline-end:5px;font-size:11px}
.mdrc__tag--st{background:#eef4ee;color:#1f5a2a}
.mdrc__actions{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.mdrc__btn{display:inline-block;border:1px solid #17211F;background:#fff;color:#17211F;padding:6px 12px;font:inherit;font-size:12.5px;line-height:1.4;cursor:pointer;text-decoration:none;border-radius:2px;transition:background .15s,color .15s}
.mdrc__btn:hover{background:#17211F;color:#fff}
.mdrc__btn--primary{background:#17211F;color:#fff}
.mdrc__btn--primary:hover{background:#c8a35a;border-color:#c8a35a;color:#17211F}
.mdrc__row{display:flex;gap:8px;align-items:flex-start;margin:3px 0}
.mdrc__row a{color:#17211F;text-decoration:underline}
/* lists */
.mdrc-list{display:flex;gap:10px;overflow-x:auto;padding:4px 2px 8px;scroll-snap-type:x mandatory;-webkit-overflow-scrolling:touch}
.mdrc-list .mdrc{flex:0 0 78%;max-width:280px;scroll-snap-align:start;margin:0}
.mdrc-list--stack{flex-direction:column;overflow:visible}
.mdrc-list--stack .mdrc{flex:none;max-width:none}
.mdrc-list::-webkit-scrollbar{height:6px}.mdrc-list::-webkit-scrollbar-thumb{background:#ddd;border-radius:3px}
/* inside the chat bubble: let the card use the full bubble width */
.mdr-msg .mdrc,.mdr-msg .mdrc-list{max-width:100%}
.mdr-msg.mdr-card{padding:8px!important;max-width:96%!important;background:transparent!important;border:0!important;box-shadow:none!important}
.mdr-msg.mdr-card .mdrc{margin:0}
/* chat host overrides (chat.css styles links inside bubbles as underlined dark text) */
.mdr-msg .mdrc__btn,.mdr-msg .mdrc__btn:hover,.mdr-msg .mdrc__actions a{text-decoration:none!important;display:inline-block!important;border-bottom:1px solid #17211F!important}
.mdr-msg .mdrc__btn{color:#17211F!important}
.mdr-msg .mdrc__btn:hover,.mdr-msg .mdrc__btn--primary{color:#fff!important}
.mdr-msg .mdrc__btn--primary:hover{color:#17211F!important;border-color:#c8a35a!important}

/* === v1.5.1: intent-based quick actions (first screen) — light hierarchy: 4 icon cards + 2 secondary pills === */
#mdrbot-chips.mdr-qa{display:grid;grid-template-columns:1fr 1fr;gap:8px;padding-top:2px}
#mdrbot-chips.mdr-qa .mdr-qa-main{display:flex;align-items:center;gap:9px;background:#fbf8f1;border:1px solid #e6d9bd;border-radius:12px;padding:10px 11px;min-height:50px;font-size:12.5px;line-height:1.35;color:#141414;font-family:"mdr-bold",inherit;text-align:start;transition:.15s}
#mdrbot-chips.mdr-qa .mdr-qa-main svg{width:18px;height:18px;flex:0 0 18px;fill:none;stroke:#c8a35a;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
#mdrbot-chips.mdr-qa .mdr-qa-main:hover{background:#c8a35a;border-color:#c8a35a;color:#17211F}
#mdrbot-chips.mdr-qa .mdr-qa-main:hover svg{stroke:#17211F}
#mdrbot-chips.mdr-qa .mdr-qa-sec{background:#fff;border:1px solid #e3e3e3;color:#555;border-radius:20px;padding:7px 12px;font-size:12px;text-align:center}
#mdrbot-chips.mdr-qa .mdr-endchip{grid-column:1/-1;justify-self:start}
#mdrbot-chips:not(.mdr-qa) .mdr-qa-main,#mdrbot-chips:not(.mdr-qa) .mdr-qa-sec{display:inline-block}

/* === v1.5.2: mode switch as plain text links «محادثة نصية | مساعد مرئي» (text chat first / default) === */
