/* «واصل» — WhatsApp-like chat UI with its own neutral identity (no third-party branding). RTL Arabic. */
@font-face{font-family:Plex;src:url(fonts/plex-ar-400.woff2) format('woff2');font-weight:400;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F,U+2010-2011,U+204F,U+2E41}
@font-face{font-family:Plex;src:url(fonts/plex-ar-500.woff2) format('woff2');font-weight:500;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F,U+2010-2011,U+204F,U+2E41}
@font-face{font-family:Plex;src:url(fonts/plex-ar-600.woff2) format('woff2');font-weight:600;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F,U+2010-2011,U+204F,U+2E41}
@font-face{font-family:Plex;src:url(fonts/plex-ar-700.woff2) format('woff2');font-weight:700;unicode-range:U+0600-06FF,U+0750-077F,U+08A0-08FF,U+FB50-FDFF,U+FE70-FEFF,U+200C-200F,U+2010-2011,U+204F,U+2E41}
@font-face{font-family:Plex;src:url(fonts/plex-la-400.woff2) format('woff2');font-weight:400;unicode-range:U+0000-00FF,U+2000-206F,U+20AC,U+2122}
@font-face{font-family:Plex;src:url(fonts/plex-la-500.woff2) format('woff2');font-weight:500;unicode-range:U+0000-00FF,U+2000-206F,U+20AC,U+2122}
@font-face{font-family:Plex;src:url(fonts/plex-la-600.woff2) format('woff2');font-weight:600;unicode-range:U+0000-00FF,U+2000-206F,U+20AC,U+2122}
@font-face{font-family:Plex;src:url(fonts/plex-la-700.woff2) format('woff2');font-weight:700;unicode-range:U+0000-00FF,U+2000-206F,U+20AC,U+2122}

:root{
  --brand:#0f5f58; --brand-2:#14a394; --brand-3:#0b4a45; --accent:#19b3a2;
  --bg-chat:#efe9e1; --in:#ffffff; --out:#d9f6ee; --ink:#15211f; --ink-2:#5c6b69; --ink-3:#8a9795;
  --tick:#2f95e8; --sys:#fff5d9; --sys-ink:#6f5410; --danger:#e5484d; --warn:#f59f0b; --ok:#12a150;
  --stage-1:#08121f; --stage-2:#10233c;
  --radius:18px; --shadow:0 1px .5px rgba(11,20,26,.13);
}
*{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
html,body{margin:0;height:100%;font-family:Plex,system-ui,-apple-system,"Segoe UI",Tahoma,sans-serif;color:var(--ink);background:var(--stage-1)}
button{font-family:inherit;cursor:pointer;border:0;background:none;color:inherit}
input{font-family:inherit}
.hidden{display:none!important}

/* ---------------- desktop stage (phone frame centred) ---------------- */
.stage{min-height:100%;display:flex;align-items:center;justify-content:center;gap:56px;padding:28px;
  background:radial-gradient(1200px 700px at 70% 10%,#17406a55,transparent 60%),radial-gradient(900px 600px at 10% 90%,#0f5f5855,transparent 60%),linear-gradient(160deg,var(--stage-1),var(--stage-2))}
.side{width:300px;color:#dfe8f2}
.side h1{font-size:40px;margin:0 0 6px;font-weight:700;letter-spacing:-.5px}
.side h1 span{color:#5eead4}
.side p{color:#a9b8c8;line-height:1.9;font-size:15px;margin:0 0 18px}
.badge{display:inline-flex;align-items:center;gap:6px;padding:6px 12px;border-radius:999px;background:#ffffff14;border:1px solid #ffffff22;color:#cfe3f5;font-size:13px}
.qr{margin-top:22px;display:flex;gap:14px;align-items:center}
.qr img{width:112px;height:112px;background:#fff;border-radius:14px;padding:8px}
.qr div{font-size:14px;color:#b9c7d6;line-height:1.8}
.tips{list-style:none;padding:0;margin:0}
.tips li{background:#ffffff0d;border:1px solid #ffffff1a;border-radius:14px;padding:10px 14px;margin:0 0 10px;color:#dbe6f1;font-size:14.5px;line-height:1.7}
.tips li b{color:#5eead4;font-weight:600}
.side a.dash{display:inline-flex;align-items:center;gap:8px;margin-top:14px;color:#0b1220;background:#5eead4;padding:10px 16px;border-radius:12px;text-decoration:none;font-weight:600}

.phone{position:relative;width:390px;height:844px;border-radius:54px;background:#0b0f14;padding:12px;box-shadow:0 30px 80px rgba(0,0,0,.55),inset 0 0 0 2px #2a3340}
.screen{position:relative;width:100%;height:100%;border-radius:42px;overflow:hidden;background:#fff;display:flex;flex-direction:column}
.island{position:absolute;top:10px;left:50%;transform:translateX(-50%);width:120px;height:34px;border-radius:20px;background:#000;z-index:20}
.statusbar{height:46px;flex:0 0 46px;display:flex;align-items:flex-end;justify-content:space-between;padding:0 28px 6px;font-size:15px;font-weight:600;color:#fff;background:var(--brand);direction:ltr}
.statusbar .sb-icons{display:flex;gap:6px;align-items:center}
.statusbar.light{background:#f7f8fa;color:#111}

@media (max-width:900px){.side{display:none}}
@media (max-width:520px){
  .stage{padding:0;display:block;background:#fff}
  .phone{width:100%;height:100dvh;border-radius:0;padding:0;box-shadow:none;background:#fff}
  .screen{border-radius:0}
  .island,.statusbar{display:none}
}

/* ---------------- start screen ---------------- */
.start{flex:1;overflow:auto;background:linear-gradient(180deg,#e9f7f4 0%,#fff 38%);padding:26px 20px 24px;display:flex;flex-direction:column}
.brand{display:flex;flex-direction:column;align-items:center;text-align:center;margin:6px 0 22px}
.brand img{width:78px;height:78px;border-radius:50%;box-shadow:0 10px 24px rgba(15,95,88,.28)}
.brand h2{margin:12px 0 2px;font-size:30px;font-weight:700;color:var(--brand-3)}
.brand .sub{color:var(--ink-2);font-size:15px}
.pill{display:inline-flex;align-items:center;gap:6px;margin-top:10px;padding:5px 12px;border-radius:999px;background:#fff4d6;color:#7a5b00;font-size:12.5px;font-weight:500;border:1px solid #f3dfa5}
.roles{display:grid;gap:12px}
.role{display:flex;align-items:center;gap:14px;text-align:right;background:#fff;border:1px solid #e3ecea;border-radius:20px;padding:16px;box-shadow:0 6px 18px rgba(15,95,88,.08);transition:transform .15s}
.role:active{transform:scale(.98)}
.role .ic{width:54px;height:54px;border-radius:16px;display:grid;place-items:center;font-size:28px;background:#e6f6f3;flex:0 0 54px}
.role b{display:block;font-size:18px;margin-bottom:3px;color:var(--brand-3)}
.role span{font-size:13.5px;color:var(--ink-2);line-height:1.6}
.pick{margin-top:6px}
.pick h3{font-size:15px;color:var(--ink-2);margin:18px 4px 10px;font-weight:500}
.opt{width:100%;display:flex;align-items:center;justify-content:space-between;gap:10px;background:#fff;border:1px solid #e6ecea;border-radius:16px;padding:12px 14px;margin-bottom:8px;text-align:right}
.opt .l b{font-size:16px;letter-spacing:.3px}
.opt .l small{display:block;color:var(--ink-3);font-size:12.5px;margin-top:2px}
.st{font-size:12px;font-weight:600;padding:4px 10px;border-radius:999px;white-space:nowrap}
.st-out,.st-scheduled{background:#e0f2fe;color:#0369a1}
.st-preparing{background:#f1f5f9;color:#475569}
.st-delayed{background:#fff1e6;color:#c2410c}
.st-failed,.st-cancelled{background:#fdecec;color:#b42318}
.st-delivered{background:#e7f8ee;color:#12733f}
.st-returning{background:#fdecec;color:#b42318}
.rand{width:100%;padding:12px;border-radius:14px;border:1.5px dashed #b7d9d3;color:var(--brand);font-weight:600;background:#f5fbfa}
.linkrow{margin-top:auto;padding-top:18px;display:flex;justify-content:center;gap:18px}
.linkrow a,.linkrow button{color:var(--brand);font-size:14px;text-decoration:none;font-weight:500}
.back-link{color:var(--ink-2);font-size:14px;margin:6px 0 0}

/* ---------------- chat ---------------- */
.chat{flex:1;display:flex;flex-direction:column;min-height:0}
.hdr{flex:0 0 auto;display:flex;align-items:center;gap:10px;padding:8px 10px 10px;background:var(--brand);color:#fff}
.hdr .back{width:36px;height:36px;display:grid;place-items:center;border-radius:50%;font-size:22px}
.hdr img{width:40px;height:40px;border-radius:50%;background:#fff}
.hdr .who{flex:1;min-width:0}
.hdr .who b{display:flex;align-items:center;gap:6px;font-size:17px;font-weight:600}
.hdr .ai{font-size:10.5px;font-weight:700;background:#ffffff26;border:1px solid #ffffff40;padding:1px 6px;border-radius:6px;letter-spacing:.5px}
.hdr .who small{display:block;font-size:12.5px;color:#d7efe9;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.hdr .who small.typing{color:#a7f3d0}
.hdr .act{width:38px;height:38px;border-radius:50%;display:grid;place-items:center;font-size:19px;opacity:.95}
.hdr .act.off{opacity:.45}
.menu{position:absolute;top:92px;left:12px;background:#fff;border-radius:14px;box-shadow:0 12px 32px rgba(0,0,0,.22);z-index:30;min-width:210px;overflow:hidden}
.menu button{display:block;width:100%;text-align:right;padding:13px 16px;font-size:15px;border-bottom:1px solid #f0f2f2}
.menu button:last-child{border-bottom:0}

.msgs{flex:1;overflow-y:auto;padding:10px 12px 6px;background:var(--bg-chat) url(img/pattern.svg);background-size:180px;scroll-behavior:smooth}
.day{display:flex;justify-content:center;margin:6px 0 10px}
.day span,.notice span{background:#ffffffd9;color:#54656f;font-size:12.5px;padding:5px 12px;border-radius:9px;box-shadow:var(--shadow)}
.notice{display:flex;justify-content:center;margin:6px 16px 12px}
.notice span{background:var(--sys);color:var(--sys-ink);text-align:center;line-height:1.6}

.row{display:flex;margin:2px 0}
.row.bot{justify-content:flex-start}   /* RTL: start = right → incoming on the right */
.row.me{justify-content:flex-end}      /* outgoing on the left (mirrored like Arabic chat apps) */
.bubble{position:relative;max-width:82%;padding:7px 10px 18px 10px;border-radius:12px;box-shadow:var(--shadow);font-size:15.5px;line-height:1.65;white-space:pre-wrap;word-wrap:break-word;animation:pop .18s ease-out}
.row.bot .bubble{background:var(--in);border-top-right-radius:4px}
.row.me .bubble{background:var(--out);border-top-left-radius:4px}
.row.bot.cont .bubble{border-top-right-radius:12px}
.row.me.cont .bubble{border-top-left-radius:12px}
.bubble .meta{position:absolute;bottom:3px;left:9px;font-size:11px;color:#667781;display:flex;align-items:center;gap:3px;direction:ltr}
.bubble b.num,.sysrow b.num{font-weight:600;unicode-bidi:isolate;direction:ltr;white-space:nowrap}
.bubble.vb{white-space:normal}
.ticks{font-size:12px;letter-spacing:-3px;color:#8696a0;transition:color .3s}
.ticks.read{color:var(--tick)}
@keyframes pop{from{transform:scale(.96);opacity:.3}to{transform:none;opacity:1}}
.sysrow{display:flex;justify-content:center;margin:7px 10px}
.sysrow span{background:#e7f6f3;color:#0b4a45;border:1px solid #cdeae4;font-size:13px;padding:6px 12px;border-radius:10px;line-height:1.6;text-align:center;box-shadow:var(--shadow)}

.typing-b{display:inline-flex;gap:4px;align-items:center;padding:12px 14px}
.typing-b i{width:7px;height:7px;border-radius:50%;background:#9aa7a5;animation:blink 1.2s infinite}
.typing-b i:nth-child(2){animation-delay:.2s}.typing-b i:nth-child(3){animation-delay:.4s}
@keyframes blink{0%,80%,100%{opacity:.25;transform:translateY(0)}40%{opacity:1;transform:translateY(-3px)}}

/* cards */
.card{background:#fff;border-radius:14px;box-shadow:var(--shadow);width:84%;max-width:320px;overflow:hidden;margin:3px 0 6px;animation:pop .2s}
.card .ch{display:flex;justify-content:space-between;align-items:center;padding:10px 12px;border-bottom:1px solid #eef2f1}
.card .ch b{font-size:15px}
.card .cb{padding:10px 12px;font-size:13.5px;color:var(--ink-2);line-height:1.75}
.card .cb .line{color:var(--ink);font-weight:600;font-size:14px}
.steps{display:flex;align-items:center;gap:0;margin:8px 0 10px}
.steps .s{flex:1;display:flex;flex-direction:column;align-items:center;position:relative;font-size:10.5px;color:var(--ink-3);text-align:center}
.steps .s:before{content:"";position:absolute;top:6px;right:50%;width:100%;height:3px;background:#e3e9e8;z-index:0}
.steps .s:first-child:before{display:none}
.steps .s.done:before{background:var(--brand-2)}
.steps .s i{width:15px;height:15px;border-radius:50%;background:#e3e9e8;border:3px solid #fff;box-shadow:0 0 0 1px #d8e0de;z-index:1;margin-bottom:4px}
.steps .s.done i{background:var(--brand-2);box-shadow:0 0 0 1px var(--brand-2)}
.steps .s.now i{background:#fff;border:4px solid var(--brand-2);box-shadow:0 0 0 4px #14a3942a}
.steps .s.done,.steps .s.now{color:var(--brand-3);font-weight:600}
.stop{display:flex;gap:10px;padding:9px 12px;border-bottom:1px solid #f0f3f2;font-size:13.5px}
.stop:last-child{border-bottom:0}
.stop .n{width:24px;height:24px;border-radius:50%;background:var(--brand);color:#fff;display:grid;place-items:center;font-size:12px;font-weight:700;flex:0 0 24px}
.stop .n.first{background:var(--warn)}
.stop b{font-size:14px;color:var(--ink)}
.stop small{display:block;color:var(--ink-3)}
.coll{display:inline-block;margin-top:3px;font-size:11.5px;padding:2px 8px;border-radius:999px;background:#fff4d6;color:#7a5b00}
.coll.paid{background:#e7f8ee;color:#12733f}
.hub a{display:inline-flex;margin-top:6px;color:#fff;background:var(--brand);padding:6px 12px;border-radius:9px;text-decoration:none;font-size:13px}

/* voice notes */
.voice{display:flex;align-items:center;gap:10px;min-width:230px;padding-bottom:2px}
.voice .play{width:40px;height:40px;border-radius:50%;background:var(--brand-2);color:#fff;display:grid;place-items:center;flex:0 0 40px;font-size:16px}
.row.me .voice .play{background:#5d7d78}
.voice .wave{flex:1;height:30px;display:flex;align-items:center;gap:2px;direction:ltr}
.voice .wave i{flex:1;background:#b8c6c4;border-radius:2px;min-height:3px}
.voice .wave i.on{background:var(--brand-2)}
.row.me .voice .wave i.on{background:#3f6660}
.voice .dur{font-size:11.5px;color:#667781;min-width:30px;direction:ltr}
.voice .avatar{width:34px;height:34px;border-radius:50%;flex:0 0 34px;position:relative}
.voice .avatar em{position:absolute;bottom:-3px;left:-4px;font-style:normal;font-size:13px;color:var(--brand-2)}
.transcript{display:block;margin-top:6px;padding-top:6px;border-top:1px dashed #d6dedc;font-size:13.5px;color:#3b4a48;white-space:pre-wrap}
.row.me .transcript{border-top-color:#b9dcd2}
.transcript.pending{color:var(--ink-3);font-style:italic}
.photo{width:210px;height:150px;border-radius:9px;background:linear-gradient(135deg,#d9efe9,#f4f9f8);display:grid;place-items:center;font-size:54px;margin-bottom:4px}

/* quick replies + composer */
.qr-bar{flex:0 0 auto;display:flex;gap:8px;overflow-x:auto;padding:8px 10px 2px;background:#f5f2ed;scrollbar-width:none}
.qr-bar::-webkit-scrollbar{display:none}
.chip{flex:0 0 auto;padding:8px 13px;border-radius:999px;background:#fff;border:1px solid #cfe5e1;color:var(--brand);font-size:13.5px;font-weight:500;white-space:nowrap;box-shadow:0 1px 2px rgba(0,0,0,.05)}
.chip:active{background:#e6f6f3}
.chip.fb{border-color:#f3dfa5;color:#7a5b00}
.composer{flex:0 0 auto;display:flex;align-items:flex-end;gap:8px;padding:8px 10px 10px;background:#f5f2ed}
.field{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:6px;background:#fff;border-radius:24px;padding:4px 6px 4px 10px;min-height:46px;box-shadow:var(--shadow)}
.field input{flex:1 1 auto;width:100%;border:0;outline:0;font-size:16px;padding:8px 6px;background:transparent;min-width:0}
.field .attach{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;font-size:20px;color:#6b7a78}
.send{width:48px;height:48px;border-radius:50%;background:var(--brand-2);color:#fff;display:grid;place-items:center;font-size:21px;flex:0 0 48px;box-shadow:0 2px 6px rgba(20,163,148,.35)}
.send svg{width:22px;height:22px}
.recbar{flex:1 1 auto;min-width:0;display:flex;align-items:center;gap:10px;background:#fff;border-radius:24px;padding:6px 12px;min-height:46px;box-shadow:var(--shadow)}
.recbar .dot{width:10px;height:10px;border-radius:50%;background:var(--danger);animation:blink 1s infinite}
.recbar .t{font-size:14px;color:var(--ink-2);min-width:40px;direction:ltr}
.recbar canvas{flex:1;height:32px;width:100%}
.recbar .trash{font-size:20px;color:#8a9795}
.sheet{position:absolute;inset:auto 10px 70px 10px;background:#fff;border-radius:18px;box-shadow:0 14px 40px rgba(0,0,0,.25);padding:10px;z-index:25}
.sheet button{display:flex;align-items:center;gap:12px;width:100%;text-align:right;padding:12px;border-radius:12px;font-size:15px}
.sheet button:active{background:#f1f6f5}
.sheet .i{width:40px;height:40px;border-radius:50%;display:grid;place-items:center;font-size:20px;color:#fff}
.toast{position:absolute;left:50%;bottom:90px;transform:translateX(-50%);background:#1f2c2acc;color:#fff;padding:9px 14px;border-radius:12px;font-size:13.5px;z-index:40;max-width:86%;text-align:center}

/* login */
.login{flex:1;display:flex;flex-direction:column;align-items:center;justify-content:center;padding:28px;background:linear-gradient(180deg,#e9f7f4,#fff 55%)}
.login input{width:100%;max-width:260px;text-align:center;font-size:30px;letter-spacing:10px;padding:12px;border-radius:16px;border:1.5px solid #cfe5e1;outline:none;margin:22px 0 12px;direction:ltr}
.login input{-webkit-text-security:disc}   /* the code never shows on a projector/recording */
.login input:focus{border-color:var(--brand-2);box-shadow:0 0 0 4px #14a3941f}
.login button{width:100%;max-width:260px;padding:14px;border-radius:14px;background:var(--brand);color:#fff;font-size:17px;font-weight:600}
.login .err{color:var(--danger);min-height:22px;font-size:14px;margin-top:10px}
