.chat-fab{position:fixed;right:16px;bottom:16px;height:54px;padding:0 20px;border-radius:30px;border:0;background:var(--green,#0b3d32);color:#fff;display:flex;align-items:center;gap:9px;font:inherit;font-weight:800;font-size:15px;box-shadow:0 10px 28px rgba(0,0,0,.25);z-index:35;cursor:pointer}
.chat-fab:hover{filter:brightness(1.1)}
.chat-fab-text{white-space:nowrap}
.chat-dot{position:absolute;top:-6px;right:-4px;min-width:22px;height:22px;padding:0 5px;border-radius:11px;background:#e5484d;color:#fff;font-size:12px;font-weight:800;display:grid;place-items:center}
.chat-dot.hidden,.chat-panel.hidden,.chat-foot.hidden{display:none!important}
.chat-panel{position:fixed;right:16px;bottom:86px;width:min(370px,calc(100vw - 24px));height:min(560px,calc(100vh - 110px));background:#fff;border-radius:18px;box-shadow:0 18px 60px rgba(0,0,0,.28);z-index:45;display:flex;flex-direction:column;overflow:hidden;direction:rtl;font-family:Tajawal,Arial,sans-serif}
.chat-head{background:var(--green,#0b3d32);color:#fff;padding:14px 16px;display:flex;align-items:center;justify-content:space-between;gap:10px}
.chat-title b{display:block;font-size:16px}.chat-title small{opacity:.8;font-size:12px}
.chat-x{border:0;background:rgba(255,255,255,.15);color:#fff;width:32px;height:32px;border-radius:10px;font-size:22px;line-height:1;cursor:pointer}
.chat-body{flex:1;overflow:auto;padding:14px;background:#efeae2;display:flex;flex-direction:column;gap:6px}
.chat-empty{margin:auto;text-align:center;color:#6b7772;font-size:14px;background:rgba(255,255,255,.7);padding:10px 14px;border-radius:12px}
.chat-msg{max-width:82%;padding:7px 10px 4px;border-radius:12px;box-shadow:0 1px 1px rgba(0,0,0,.12);word-break:break-word}
.chat-msg.mine{align-self:flex-start;background:#d9fdd3;border-top-right-radius:3px}
.chat-msg.theirs{align-self:flex-end;background:#fff;border-top-left-radius:3px}
.chat-who{display:block;font-size:11px;font-weight:800;color:var(--green2,#11614f);margin-bottom:2px}
.chat-text{font-size:15px;line-height:1.6;white-space:pre-wrap;color:#17231f}
.chat-meta{display:flex;gap:6px;justify-content:flex-end;align-items:center;font-size:11px;color:#667781;margin-top:1px}
.chat-tick{font-size:12px;letter-spacing:-3px}.chat-tick.read{color:#34b7f1}
.chat-foot{display:flex;gap:8px;align-items:flex-end;padding:10px;background:#f0f2f5}
.chat-input{flex:1;border:0;border-radius:20px;padding:10px 14px;resize:none;outline:0;background:#fff;font:inherit;font-size:15px;max-height:110px;line-height:1.5}
.chat-send{width:42px;height:42px;border-radius:50%;border:0;background:var(--green,#0b3d32);color:#fff;display:grid;place-items:center;cursor:pointer;flex:none}
.chat-send svg{transform:scaleX(-1)}
.chat-start{padding:18px;display:flex;flex-direction:column;gap:10px}
.chat-start p{margin:0 0 4px;color:#4b5a55;font-size:14px;line-height:1.7}
.chat-start input,.chat-start select{border:1px solid #dce3e0;border-radius:11px;padding:12px;background:#fafbfb;font:inherit;outline:0}
.chat-start input:focus,.chat-start select:focus{border-color:var(--mint,#19b98b)}
.chat-go{border:0;border-radius:12px;padding:13px;background:var(--green,#0b3d32);color:#fff;font-weight:800;font:inherit;cursor:pointer}
.chat-go:disabled{opacity:.6}
.chat-err{color:#b42318;font-size:13px;text-align:center}
@media(max-width:520px){.chat-panel{left:8px;right:8px;width:auto;bottom:84px}.chat-fab{right:12px;bottom:14px;height:50px;padding:0 16px;font-size:14px}}
.chat-icon{width:40px;height:40px;border-radius:50%;border:0;background:transparent;color:#54656f;display:grid;place-items:center;cursor:pointer;flex:none}
.chat-icon:hover{background:rgba(0,0,0,.06)}
.chat-img{display:block;max-width:100%;max-height:260px;border-radius:9px;cursor:zoom-in;background:#e4e0d8;min-width:120px;min-height:80px;object-fit:cover}
.chat-msg.pending{opacity:.65}
.chat-audio{display:flex;align-items:center;gap:8px;min-width:210px}
.chat-play{width:36px;height:36px;border-radius:50%;border:0;background:var(--green,#0b3d32);color:#fff;font-size:14px;cursor:pointer;flex:none;line-height:1}
.chat-seek{flex:1;min-width:70px;accent-color:var(--green,#0b3d32);direction:ltr}
.chat-dur{font-size:11px;color:#667781;min-width:30px;text-align:end;direction:ltr}
.chat-rec{display:flex;align-items:center;gap:10px;padding:10px;background:#f0f2f5}
.chat-rec.hidden{display:none!important}
.chat-rec-dot{width:11px;height:11px;border-radius:50%;background:#e5484d;animation:chatblink 1s infinite}
.chat-rec-time{font-weight:800;direction:ltr;min-width:36px}
.chat-rec-txt{flex:1;color:#667781;font-size:14px}
@keyframes chatblink{50%{opacity:.25}}
.chat-lightbox{position:fixed;inset:0;background:rgba(0,0,0,.88);z-index:80;display:grid;place-items:center;padding:14px;cursor:zoom-out}
.chat-lightbox img{max-width:100%;max-height:100%;border-radius:8px}
.chat-welcome{max-width:88%}
/* Phones first: the chat opens full screen (no half-hidden panel behind the keyboard), 16px fields so iOS does not zoom in,
   44px touch targets, and room for the notch / home bar. */
@media(max-width:600px){
  .chat-panel{left:0;right:0;top:0;bottom:0;width:auto;height:100vh;height:100dvh;border-radius:0;box-shadow:none}
  .chat-head{padding:12px 14px;padding-top:max(12px,env(safe-area-inset-top))}
  .chat-x{width:44px;height:44px;font-size:26px}
  .chat-body{padding:12px 10px}
  .chat-msg{max-width:88%}
  .chat-foot,.chat-rec{padding:8px 8px calc(8px + env(safe-area-inset-bottom))}
  .chat-input,.chat-start input,.chat-start select{font-size:16px}
  .chat-start input,.chat-start select{padding:14px}
  .chat-go{padding:15px;font-size:16px}
  .chat-icon{width:44px;height:44px}
  .chat-send{width:46px;height:46px}
  .chat-fab{bottom:calc(14px + env(safe-area-inset-bottom))}
}
