:root { --ink:#16231f; --muted:#74817d; --green:#147a5b; --green-dark:#0d5e47; --mint:#e7f4ee; --line:#e5ebe8; --paper:#fff; --canvas:#f6f9f7; }
*{box-sizing:border-box} html,body{margin:0;min-height:100%;background:var(--canvas);color:var(--ink);font-family:"Segoe UI",Tahoma,Arial,sans-serif} button,input{font:inherit} button{cursor:pointer}
.app-shell{height:100vh;min-height:640px;display:flex;direction:ltr;background:var(--paper);overflow:hidden}.sidebar{width:310px;flex:0 0 310px;border-right:1px solid var(--line);padding:27px 20px 18px;display:flex;flex-direction:column;direction:rtl;background:#fbfdfc}.brand{display:flex;align-items:center;gap:12px;padding:0 8px;margin-bottom:28px}.brand-mark,.mobile-logo{display:grid;place-items:center;width:42px;height:42px;border-radius:13px;background:var(--green);color:white;font-size:27px;font-weight:800;transform:rotate(-45deg);box-shadow:0 8px 18px #147a5b2b}.brand div{display:flex;flex-direction:column}.brand strong{font-size:24px;line-height:1}.brand small{font-size:12px;color:var(--muted);margin-top:5px}.new-chat{border:0;border-radius:12px;background:var(--green);color:white;height:48px;font-weight:700;font-size:15px;box-shadow:0 6px 16px #147a5b1f}.new-chat span{font-size:20px;margin-left:7px}.section-label{display:flex;justify-content:space-between;align-items:center;color:#8a9692;font-size:12px;font-weight:700;padding:26px 8px 10px}.section-label button{border:0;background:transparent;color:var(--green);font-size:20px}.device{width:100%;border:0;background:transparent;border-radius:12px;padding:12px;display:flex;align-items:center;text-align:right;gap:11px;color:var(--ink);margin:2px 0}.device.active{background:var(--mint)}.device-icon{display:grid;place-items:center;width:39px;height:39px;border-radius:11px;background:white;color:var(--green);font-size:20px;border:1px solid #dce9e3}.device>span:nth-child(2){display:flex;flex-direction:column;flex:1}.device strong{font-size:14px}.device small{color:var(--muted);font-size:11px;margin-top:4px}.device small i{display:inline-block;width:7px;height:7px;border-radius:50%;background:#2bb57b;margin-left:4px}.device>b{font-size:24px;color:var(--green);transform:rotate(180deg)}.sidebar-spacer{flex:1}.storage{padding:17px 12px;border-top:1px solid var(--line);font-size:11px;color:var(--muted)}.storage>div:first-child{display:flex;justify-content:space-between;margin-bottom:9px}.storage b{color:var(--green)}.bar{height:5px;background:#e4ebe8;border-radius:5px;margin-bottom:7px;overflow:hidden}.bar i{display:block;width:38%;height:100%;background:var(--green);border-radius:5px}.profile{border:0;border-radius:13px;background:#f3f7f5;padding:11px;display:flex;align-items:center;gap:10px;text-align:right}.avatar{display:grid;place-items:center;width:38px;height:38px;border-radius:50%;background:#d5eadf;color:var(--green);font-weight:800}.profile>span:nth-child(2){display:flex;flex-direction:column;flex:1}.profile strong{font-size:13px}.profile small{font-size:10px;color:var(--muted);margin-top:3px}.profile b{color:#8a9692;font-size:19px}
.chat{flex:1;min-width:0;display:flex;flex-direction:column;direction:rtl;background:var(--canvas)}.chat-header{height:84px;flex:0 0 84px;display:flex;align-items:center;padding:0 34px;background:rgba(255,255,255,.94);border-bottom:1px solid var(--line);box-shadow:0 2px 12px #1a46360a;z-index:2}.phone-avatar{position:relative;display:grid;place-items:center;width:44px;height:44px;border-radius:50%;background:#e2f1ea;color:var(--green);font-size:25px;margin-left:12px}.phone-avatar i{position:absolute;bottom:1px;left:1px;width:10px;height:10px;background:#20ae72;border:2px solid white;border-radius:50%}.chat-header h1{margin:0;font-size:17px}.chat-header p{margin:5px 0 0;color:var(--muted);font-size:11px}.header-actions{margin-right:auto;display:flex;gap:7px}.header-actions button{width:40px;height:40px;border:0;border-radius:10px;background:transparent;color:#66736f;font-size:22px}.header-actions button:hover{background:#eff5f2}.mobile-logo{display:none}.messages{flex:1;overflow-y:auto;padding:23px clamp(22px,6vw,90px) 30px;background-color:#f7faf8;background-image:radial-gradient(#bfd3c9 0.7px,transparent .7px);background-size:19px 19px}.privacy-note{margin:0 auto 24px;padding:10px 18px;max-width:400px;border:1px solid #dcebe4;background:#f0f7f3;border-radius:12px;display:flex;align-items:center;justify-content:center;gap:10px;color:#65746f;text-align:right}.privacy-note span{color:var(--green);font-size:21px}.privacy-note p{font-size:10px;line-height:1.6;margin:0}.privacy-note strong{color:#4e5e58}.day{display:flex;align-items:center;gap:13px;margin:15px 0 25px;color:#89948f;font-size:10px}.day:before,.day:after{content:"";height:1px;background:#e2e8e5;flex:1}.message-row{display:flex;margin:12px 0}.message-row.mine{justify-content:flex-start}.message-row.theirs{justify-content:flex-end}.bubble{position:relative;max-width:min(66%,520px);padding:11px 14px 7px;border-radius:15px;box-shadow:0 3px 10px #183d2d0d}.mine .bubble{background:var(--green);color:white;border-bottom-right-radius:4px}.theirs .bubble{background:white;border:1px solid #edf0ef;border-bottom-left-radius:4px}.bubble p{margin:0 0 5px;font-size:13px;line-height:1.75}.bubble time{display:block;text-align:left;font-size:8px;opacity:.7;direction:rtl}.bubble time span{margin-right:3px}.file-bubble{width:310px;display:grid;grid-template-columns:42px 1fr 32px;gap:10px;align-items:center;padding:10px}.file-icon{width:42px;height:42px;border-radius:9px;background:#ffffff27;display:grid;place-items:center;font-size:22px}.file-copy{display:flex;flex-direction:column;min-width:0}.file-copy strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.file-copy small{font-size:9px;opacity:.72;margin-top:5px}.file-bubble button{width:30px;height:30px;border-radius:50%;border:1px solid #ffffff55;background:transparent;color:white}.file-bubble time{grid-column:2/4;margin-top:-5px}
.composer-wrap{background:white;padding:14px clamp(24px,6vw,90px) 9px;border-top:1px solid var(--line)}.composer{height:53px;border:1px solid #dce5e1;border-radius:15px;background:#fbfdfc;display:flex;align-items:center;padding:5px;box-shadow:0 4px 15px #173b2c0a}.composer input[type=text],.composer>input:not([type]){flex:1;border:0;outline:0;background:transparent;padding:0 13px;color:var(--ink);font-size:13px}.composer input::placeholder{color:#9ba6a2}.composer button{border:0;display:grid;place-items:center}.attach{position:relative;width:38px;height:38px;background:transparent;color:#75817d;font-size:22px;transform:rotate(-15deg)}.attach span{font-size:10px;position:absolute}.send{width:40px;height:40px;border-radius:11px;background:var(--green);color:white;font-size:18px;transform:rotate(180deg)}.send:hover,.new-chat:hover{background:var(--green-dark)}.drop-hint{text-align:center;color:#a0aaa6;font-size:9px;margin:7px 0 0}
@media(max-width:760px){.app-shell{min-height:560px}.sidebar{display:none}.chat-header{padding:0 16px;height:72px;flex-basis:72px}.mobile-logo{display:grid;width:34px;height:34px;font-size:20px;margin-left:12px}.phone-avatar{width:38px;height:38px}.messages{padding:18px 14px 24px}.privacy-note{max-width:330px}.bubble{max-width:86%}.file-bubble{width:min(310px,82vw)}.composer-wrap{padding:10px 12px 7px}.drop-hint{display:none}.header-actions #share{display:none}}
@media(max-width:420px){.chat-header h1{font-size:15px}.chat-header p{font-size:9px}.header-actions{gap:0}.header-actions button{width:34px}.bubble p{font-size:12px}}
.room-card{margin:0 auto 20px;display:flex;align-items:center;gap:12px;width:max-content;max-width:100%;padding:9px 12px;border-radius:12px;background:#fff;border:1px solid var(--line);box-shadow:0 3px 10px #173b2c0b}.room-card small{color:var(--muted)}.room-card strong{direction:ltr;letter-spacing:2px;color:var(--green)}.room-card button{border:0;border-radius:8px;background:var(--mint);color:var(--green);padding:6px 9px;font-size:11px}.file-icon{text-decoration:none}.file-open{display:flex;flex-direction:column;min-width:0;color:inherit;text-decoration:none}.file-open strong{font-size:12px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.file-open small{font-size:9px;opacity:.72;margin-top:5px}.download{display:grid;place-items:center;width:30px;height:30px;border-radius:50%;border:1px solid #ffffff66;color:white;text-decoration:none;font-size:17px}.theirs .download{border-color:#c9ddd4;color:var(--green);background:var(--mint)}.upload-state{text-align:center;color:var(--green);font-size:11px;min-height:15px;margin-bottom:3px}.toast{position:fixed;bottom:85px;left:50%;transform:translate(-50%,20px);background:#172b24;color:#fff;border-radius:10px;padding:10px 18px;font-size:12px;opacity:0;pointer-events:none;transition:.2s;z-index:20}.toast.show{opacity:1;transform:translate(-50%,0)}#connection.online{color:#1b9b69}
html,body{overflow:hidden;width:100%;height:100%;overscroll-behavior:none}.app-shell{position:fixed;top:var(--app-top,0);right:0;left:0;height:var(--app-height,100dvh)}.chat,.messages{min-height:0}.composer>input:not([type]){min-width:0;width:0}.composer-wrap{position:relative;z-index:5;padding-bottom:max(9px,env(safe-area-inset-bottom))}
@media(max-width:760px){.app-shell{height:var(--app-height,100dvh);min-height:0}.chat{height:100%}.chat-header{flex-shrink:0}.messages{overscroll-behavior:contain}.composer-wrap{flex-shrink:0;padding:8px 10px max(8px,env(safe-area-inset-bottom))}.composer{width:100%;height:50px}.composer>input:not([type]){font-size:16px;padding:0 8px}.attach{width:34px;flex:0 0 34px}.send{width:40px;flex:0 0 40px}.toast{bottom:calc(72px + env(safe-area-inset-bottom))}}
.app-shell{top:0;height:100dvh}
@media(max-width:760px){.app-shell{height:100dvh;min-height:0}.chat{height:100%;padding-bottom:72px}.messages{padding-bottom:28px}.composer-wrap{position:fixed;right:0;left:0;bottom:var(--keyboard-offset,0);background:#fff;transition:bottom .08s linear;padding:8px 10px max(8px,env(safe-area-inset-bottom));box-shadow:0 -3px 14px #173b2c12}.toast{bottom:calc(var(--keyboard-offset,0px) + 72px + env(safe-area-inset-bottom))}}
.delete-message{position:absolute;top:-9px;left:-9px;width:27px;height:27px;border:1px solid #e4ebe8;border-radius:9px;display:grid;place-items:center;background:#fff;color:transparent;font-size:0;line-height:1;box-shadow:0 3px 10px #173b2c1c;opacity:.28;transition:opacity .15s,transform .15s,background .15s;z-index:2}.delete-message:before{content:"";width:9px;height:10px;border:1.7px solid #9aaaa3;border-top:0;border-radius:0 0 2px 2px;transform:translateY(2px)}.delete-message:after{content:"";position:absolute;top:7px;width:12px;height:1.7px;border-radius:2px;background:#9aaaa3;box-shadow:0 -3px 0 -0.2px #9aaaa3}.bubble:hover .delete-message,.delete-message:focus{opacity:1}.delete-message:hover,.delete-message:focus{background:#fff1f1;transform:translateY(-1px);outline:0}.delete-message:hover:before,.delete-message:focus:before{border-color:#b94747}.delete-message:hover:after,.delete-message:focus:after{background:#b94747;box-shadow:0 -3px 0 -0.2px #b94747}@media(max-width:760px){.delete-message{opacity:.82;width:29px;height:29px;top:-11px;left:-7px;border-radius:10px}.delete-message:before{width:10px;height:11px}.delete-message:after{top:7px;width:13px}}
.header-actions .clear-all{position:relative;color:transparent;font-size:0!important;background:#c74343;border:1px solid #b93636;border-radius:10px;box-shadow:0 4px 10px #b9363628}.header-actions .clear-all:before{content:"";position:absolute;left:50%;top:50%;width:10px;height:12px;border:1.8px solid #fff;border-top:0;border-radius:0 0 2px 2px;transform:translate(-50%,-38%)}.header-actions .clear-all:after{content:"";position:absolute;left:50%;top:12px;width:14px;height:1.8px;border-radius:2px;background:#fff;transform:translateX(-50%);box-shadow:0 -3.5px 0 -0.2px #fff}.header-actions .clear-all:hover{background:#aa3030;border-color:#992929}.header-actions .clear-all:hover:before{border-color:#fff}.header-actions .clear-all:hover:after{background:#fff;box-shadow:0 -3.5px 0 -0.2px #fff}.header-actions .clear-all:disabled{opacity:.4;cursor:wait}
.header-actions #pushToggle{font-size:17px;filter:grayscale(1);opacity:.6}.header-actions #pushToggle.enabled{filter:none;opacity:1;background:#e5f2ec}
/* منطقة مرفقات أوضح وأسهل للمس */
.composer{gap:7px;padding:5px 6px}
.attach{width:82px;height:40px;flex:0 0 82px;border-radius:11px!important;background:var(--mint)!important;color:var(--green)!important;display:flex!important;grid-auto-flow:column;gap:6px;align-items:center;justify-content:center;transform:none!important;font-size:13px!important;font-weight:800!important;box-shadow:inset 0 0 0 1px #cfe5da}
.attach:hover{background:#d9eee4!important}.attach .attach-icon{position:static;width:23px;height:23px;border-radius:50%;display:grid;place-items:center;background:var(--green);color:#fff;font-size:18px;line-height:1}.attach .attach-label{position:static;font-size:12px}.send{flex:0 0 40px}.upload-state:not(:empty){width:max-content;max-width:100%;margin:0 auto 7px;padding:7px 13px;border-radius:999px;background:var(--mint);border:1px solid #cfe5da;font-weight:800;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
@media(max-width:760px){.composer{gap:5px}.attach{width:44px!important;flex-basis:44px!important;height:40px!important}.attach .attach-label{display:none}.attach .attach-icon{width:28px;height:28px}.composer>input:not([type]){padding:0 5px!important}.upload-state:not(:empty){font-size:10px;max-width:90vw}}
/* الاتصال الصوتي التجريبي */
.header-actions #voiceCall{color:var(--green);background:var(--mint);font-size:19px}.header-actions #voiceCall:hover{background:#d5ecdf}.header-actions #callHistory{color:#687872;font-size:18px}.call-panel{position:fixed;inset:0;z-index:200;background:#10251db8;display:grid;place-items:center;padding:18px;backdrop-filter:blur(5px)}.call-panel[hidden]{display:none}.call-card{width:min(380px,100%);max-height:min(650px,90dvh);overflow:auto;background:#fff;border-radius:24px;padding:30px 24px 24px;text-align:center;box-shadow:0 24px 70px #0004}.call-avatar{width:78px;height:78px;margin:0 auto 18px;border-radius:50%;display:grid;place-items:center;overflow:hidden;background:var(--mint);color:var(--green);font-size:30px;font-weight:800;animation:callPulse 1.7s infinite}.call-avatar img{width:100%;height:100%;object-fit:cover}.call-card h2{margin:0 0 6px;font-size:21px}.call-person{display:block;margin-bottom:5px;color:var(--ink);font-size:14px}.call-card>p{margin:0 0 24px;color:var(--muted);font-size:13px}.call-actions{display:flex;justify-content:center;gap:10px}.call-actions button{min-width:82px;height:43px;border:0;border-radius:12px;color:#fff;font-weight:800}.call-accept{background:#16825f}.call-mute{background:#687872}.call-end{background:#c74343}.call-actions button[hidden]{display:none}.call-history{margin:4px 0 20px;text-align:right;border-top:1px solid var(--line)}.call-log{display:flex;align-items:center;gap:10px;padding:11px 3px;border-bottom:1px solid var(--line)}.call-log>span{width:34px;height:34px;border-radius:50%;display:grid;place-items:center;background:var(--mint);color:var(--green);font-weight:800;flex:0 0 34px}.call-log>div{display:flex;flex-direction:column;min-width:0;flex:1}.call-log strong{font-size:12px}.call-log small{font-size:10px;color:var(--muted);margin-top:3px}.call-log time{font-size:9px;color:#96a29d}.call-empty{text-align:center;color:var(--muted);padding:22px 0!important;margin:0!important}@keyframes callPulse{50%{box-shadow:0 0 0 14px #dcefe6;transform:scale(1.04)}}@media(max-width:760px){.call-card{border-radius:20px}.call-actions button{min-width:76px}.header-actions #voiceCall{font-size:17px}.header-actions #callHistory{display:none}}
/* خط أوضح وعريض في كامل واجهة ناقل */
.call-mode{background:#326d7a}.call-mode.enabled{background:#0f684e}.call-mode{font-size:10px;padding:0 7px}.call-talk{width:100%;min-height:92px;margin:0 0 18px;border:2px solid #cce3d8;border-radius:18px;background:#edf7f2;color:var(--green);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;touch-action:none;user-select:none;-webkit-user-select:none;transition:transform .12s,background .12s,border-color .12s}.call-talk[hidden]{display:none}.call-talk span{font-size:23px;line-height:1}.call-talk b{font-size:14px}.call-talk small{font-size:9px;color:var(--muted)}.call-talk.talking{background:#16825f;border-color:#0f684e;color:#fff;transform:scale(.98);box-shadow:0 0 0 5px #d9eee4}.call-talk.talking small{color:#d8eee6}@media(max-width:760px){.call-talk{min-height:108px}.call-talk b{font-size:15px}.call-mode{font-size:9px;min-width:88px!important}}
@media(max-width:760px){.header-actions #callHistory{display:grid;font-size:16px}.header-actions #info{display:none}}
html,body,button,input{font-weight:700}
.bubble p,.file-open strong,.room-card strong,.chat-header h1,.profile strong,.device strong{font-weight:800}
.bubble time,.file-open small,.chat-header p,.profile small,.device small,.drop-hint,.privacy-note p{font-weight:600}
.phone-avatar{border:0}.avatar img,.phone-avatar img{width:100%;height:100%;object-fit:cover;border-radius:50%}.sender-info{display:flex;align-items:center;gap:9px;margin-bottom:8px;min-width:125px}.sender-info b{font-size:11px;font-weight:700;opacity:.88;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px}.sender-avatar{width:36px;height:36px;border-radius:50%;display:grid;place-items:center;overflow:hidden;background:#dcece4;color:var(--green);font-size:14px;font-weight:700;flex:0 0 36px;border:2px solid #fff;box-shadow:0 2px 7px #183d2d20}.sender-avatar img{width:100%;height:100%;object-fit:cover}.mine .sender-avatar{background:#ffffff2e;color:#fff;border-color:#ffffff44}.file-sender{grid-column:1/4}.file-sender .sender-info{margin-bottom:3px}.profile-modal{position:fixed;inset:0;background:#10251da8;z-index:100;display:grid;place-items:center;padding:18px}.profile-modal[hidden]{display:none}.profile-card{position:relative;width:min(390px,100%);background:#fff;border-radius:20px;padding:25px;box-shadow:0 20px 60px #0003}.profile-card h2{margin:0 0 6px;font-size:20px}.profile-card>p{margin:0 0 20px;color:var(--muted);font-size:12px}.modal-close{position:absolute;top:13px;left:13px;width:32px;height:32px;border:0;border-radius:50%;background:#f0f4f2;color:#586760;font-size:20px}.avatar-picker{display:flex;flex-direction:column;align-items:center;gap:8px;color:var(--green);font-size:12px;cursor:pointer;margin-bottom:18px}.avatar-picker>span{width:86px;height:86px;border-radius:50%;display:grid;place-items:center;overflow:hidden;background:var(--mint);color:var(--green);font-size:30px;font-weight:700;border:3px solid #d5e9df}.avatar-picker img{width:100%;height:100%;object-fit:cover}.name-field{display:flex;flex-direction:column;gap:7px;font-size:12px;font-weight:700}.name-field input{height:44px;border:1px solid #d8e3de;border-radius:11px;padding:0 12px;outline:0;font-size:16px}.name-field input:focus{border-color:var(--green)}.remove-photo{display:flex;align-items:center;gap:7px;margin:13px 0;color:#8f4343;font-size:11px}.save-profile{width:100%;height:44px;border:0;border-radius:11px;background:var(--green);color:#fff;font-weight:700}.save-profile:disabled{opacity:.5}@media(max-width:760px){.sender-avatar{width:34px;height:34px;flex-basis:34px}.sender-info b{font-size:11px;max-width:120px}}
.call-avatar.speaking{animation:speakerPulse .75s infinite;border:4px solid #22ad78;box-shadow:0 0 0 8px #d9eee4}@keyframes speakerPulse{50%{transform:scale(1.08);box-shadow:0 0 0 14px #d9eee4}}
