/* Yamama Super Office — plus layer: scrollbars, RTL inputs, responsive dialogs, context menu, AI prominence, smart tools */
:root{--sb-thumb:#c7bff3;--sb-thumb-h:#8f84e6;--sb-track:transparent;--ai1:#3b2a99;--ai2:#7c5cf0}
/* ---------- scrollbars: thin, purple-tinted, everywhere ---------- */
*{scrollbar-width:thin;scrollbar-color:var(--sb-thumb) var(--sb-track)}
::-webkit-scrollbar{width:10px;height:10px;background:transparent}
::-webkit-scrollbar-track{background:transparent}
::-webkit-scrollbar-thumb{background:var(--sb-thumb);border-radius:10px;border:3px solid transparent;background-clip:content-box;min-height:36px}
::-webkit-scrollbar-thumb:hover{background:var(--sb-thumb-h);border:2px solid transparent;background-clip:content-box}
::-webkit-scrollbar-corner{background:transparent}
:root.dark{--sb-thumb:#5d55a0;--sb-thumb-h:#8f84e6}
/* ---------- Arabic UI: inputs, hints and placeholders start from the right ---------- */
html[dir=rtl] input:not([type=color]):not([type=range]):not([type=checkbox]):not([type=radio]),html[dir=rtl] textarea,html[dir=rtl] select,html[dir=rtl] [contenteditable=true]:not(.ProseMirror){direction:rtl;text-align:right}
html[dir=rtl] input::placeholder,html[dir=rtl] textarea::placeholder{direction:rtl;text-align:right}
html[dir=rtl] input[type=email],html[dir=rtl] input[type=url],html[dir=rtl] input[type=password],html[dir=rtl] input[type=tel],html[dir=rtl] input[type=number]{unicode-bidi:plaintext;text-align:right}
html[dir=rtl] input[type=email]:placeholder-shown,html[dir=rtl] input[type=url]:placeholder-shown,html[dir=rtl] input[type=password]:placeholder-shown,html[dir=rtl] input[type=tel]:placeholder-shown{direction:rtl}
html[dir=rtl] #editor .ProseMirror p.is-editor-empty:first-child,html[dir=rtl] #editor .ProseMirror .is-empty{direction:rtl;text-align:right}
html[dir=rtl] #editor .ProseMirror p.is-editor-empty:first-child::before{float:right}
html[dir=ltr] #editor .ProseMirror p.is-editor-empty:first-child::before{float:left}
.yo-hint{color:#5d5a80;pointer-events:none}
/* ---------- dialogs responsive at every width ---------- */
.mback{padding:max(12px,env(safe-area-inset-top)) 12px 12px}
.modal{max-width:calc(100vw - 24px);max-height:calc(100dvh - 24px);min-width:0}
.modal .mhead{flex-shrink:0;min-width:0}.modal .mhead h2{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0}
.modal .mbody{min-height:0;min-width:0;overflow-x:hidden}
.modal .mbody *{max-width:100%}
.modal .mbody table{display:block;overflow-x:auto}
.modal .mbody input,.modal .mbody select,.modal .mbody textarea{max-width:100%;box-sizing:border-box}
.modal .mfoot{flex-shrink:0}
@media (max-width:760px){
 .mback{padding:0}
 .mback:not(.sheet){place-items:end stretch}
 .mback .modal,.mback .modal.wide{width:100%!important;max-width:100%!important;max-height:92dvh;border-radius:18px 18px 0 0}
 .modal .mbody [style*="grid-template-columns"]{grid-template-columns:1fr!important}
 .modal .mbody .row,.modal .mbody .frow,.modal .mbody .grid2,.modal .mbody .grid3{flex-wrap:wrap}
 .modal .mfoot{position:sticky;bottom:0;background:var(--card)}
 .modal .mfoot .btn{flex:1 1 auto;min-height:44px}
}
@media (min-width:761px) and (max-width:1100px){.modal.wide{width:min(720px,calc(100vw - 32px))}}
/* ---------- context menu ---------- */
.cx{position:fixed;z-index:400;min-width:232px;max-width:min(320px,calc(100vw - 16px));max-height:calc(100dvh - 16px);overflow:auto;background:var(--card,#fff);border:1px solid #e3dff6;border-radius:12px;box-shadow:0 12px 36px rgba(37,27,110,.18),0 2px 6px rgba(37,27,110,.08);padding:5px;font-size:13.5px;animation:rise .12s ease}
.cx button{display:flex;align-items:center;gap:10px;width:100%;border:0;background:none;padding:7px 10px;border-radius:8px;color:inherit;font:inherit;text-align:start;cursor:pointer;min-height:32px}
.cx button:hover,.cx button:focus-visible{background:#f1eefd;outline:none}
.cx button[disabled]{opacity:.42;cursor:default;background:none}
.cx button .ic{width:16px;height:16px;flex-shrink:0;color:#5a4fc4}
.cx button .lb{flex:1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cx button .kb{color:var(--muted,#5d5a80);font-size:11.5px;direction:ltr;unicode-bidi:isolate}
.cx button .ar{color:#9c97bd;font-size:12px}
.cx .sep{height:1px;background:#eceaf7;margin:4px 6px}
.cx .hd{font-size:11px;color:#8a85ad;padding:6px 10px 2px;font-weight:600;letter-spacing:.02em}
.cx button.aiit .ic{color:#7c5cf0}
.cx button.aiit{background:linear-gradient(90deg,rgba(124,92,240,.07),transparent)}
.cx button.danger{color:#b4234a}.cx button.danger .ic{color:#b4234a}
.cx .bar{display:flex;gap:2px;padding:2px 2px 4px}
.cx .bar button{justify-content:center;flex:1;padding:6px 0;min-height:34px}
.cx .bar button .ic{margin:0}
.cx-back{display:none}
@media (pointer:coarse){.cx button{min-height:42px;font-size:15px}.cx{min-width:260px}}
@media (max-width:760px){.cx.sheetcx{left:0!important;right:0!important;top:auto!important;bottom:0!important;max-width:none;width:100%;border-radius:18px 18px 0 0;max-height:72dvh;padding:8px 8px calc(8px + env(safe-area-inset-bottom))}.cx-back{display:block;position:fixed;inset:0;z-index:399;background:rgba(22,19,52,.32)}}
/* ---------- AI prominence ---------- */
.ai-fab{position:fixed;z-index:120;inset-inline-end:22px;bottom:44px;display:flex;align-items:center;gap:8px;border:0;border-radius:999px;padding:11px 18px 11px 16px;background:linear-gradient(135deg,var(--ai1),var(--ai2));color:#fff;font:600 14px/1 inherit;font-family:inherit;box-shadow:0 10px 26px rgba(76,52,200,.38),0 0 0 4px rgba(124,92,240,.14);cursor:pointer;transition:transform .15s}
.ai-fab:hover{transform:translateY(-2px)}.ai-fab .ic{width:18px;height:18px}
.ai-fab .tag{background:rgba(255,255,255,.22);border-radius:6px;padding:2px 6px;font-size:11px;letter-spacing:.04em}
body.side-open .ai-fab,body.yo-focus .ai-fab,body.is-home .ai-fab{display:none}
@media (max-width:760px){.ai-fab{bottom:calc(66px + env(safe-area-inset-bottom));inset-inline-end:14px;padding:12px 15px}.ai-fab .txt{display:none}}
.ai-pill{display:inline-flex!important;align-items:center;gap:6px;background:linear-gradient(135deg,var(--ai1),var(--ai2))!important;color:#fff!important;border-radius:999px!important;padding:6px 12px!important;font-weight:600;box-shadow:0 4px 12px rgba(76,52,200,.28)}
.ai-pill .ic{color:#fff!important}
.rtab[data-tab=ai]{color:#5b3fd9!important;font-weight:700}
.aibar{position:fixed;z-index:300;width:min(560px,calc(100vw - 20px));background:#fff;border:1.5px solid #cfc6fb;border-radius:14px;box-shadow:0 16px 40px rgba(59,42,153,.22);padding:8px}
.aibar .row1{display:flex;gap:8px;align-items:center}
.aibar .row1 .ic{color:#7c5cf0;width:20px;height:20px;flex-shrink:0}
.aibar input{flex:1;border:0;outline:none;font:inherit;font-size:15px;padding:8px 4px;background:transparent;min-width:0}
.aibar .go{border:0;border-radius:10px;background:linear-gradient(135deg,var(--ai1),var(--ai2));color:#fff;padding:8px 14px;font:inherit;font-weight:600;cursor:pointer}
.aibar .chips{display:flex;flex-wrap:wrap;gap:6px;padding:8px 2px 2px}
.aibar .chips button{border:1px solid #e1dcfa;background:#f7f5ff;color:#3b2a99;border-radius:999px;padding:5px 11px;font:inherit;font-size:12.5px;cursor:pointer}
.aibar .chips button:hover{background:#ece7ff}
.aibar .note{font-size:12px;color:#7d789f;padding:6px 4px 0}
/* slash palette */
.slash{position:fixed;z-index:300;width:290px;max-height:330px;overflow:auto;background:#fff;border:1px solid #e3dff6;border-radius:12px;box-shadow:0 12px 32px rgba(37,27,110,.18);padding:5px}
.slash button{display:flex;gap:10px;align-items:center;width:100%;border:0;background:none;padding:7px 9px;border-radius:8px;font:inherit;text-align:start;cursor:pointer;color:inherit}
.slash button.on,.slash button:hover{background:#f1eefd}
.slash button .ic{width:18px;height:18px;color:#5a4fc4;flex-shrink:0}
.slash button small{display:block;color:#8a85ad;font-size:11.5px}
.slash .hd{font-size:11px;color:#8a85ad;padding:6px 9px 2px;font-weight:600}
.slash .empty{padding:10px;color:#8a85ad;font-size:13px}
/* status extras */
.yo-stats{display:inline-flex;gap:10px;align-items:center;color:#6c6990;font-size:12px;white-space:nowrap}
.yo-stats button{border:0;background:none;color:inherit;font:inherit;cursor:pointer;padding:2px 6px;border-radius:6px;display:inline-flex;gap:4px;align-items:center}
.yo-stats button:hover{background:#efecfb}
.yo-stats .ic{width:14px;height:14px}
.yo-mic.on{background:#ffe8ee!important;color:#b4234a!important;animation:pulse 1.2s infinite}
@keyframes pulse{50%{opacity:.6}}
.yo-dict{position:fixed;z-index:310;bottom:90px;left:50%;transform:translateX(-50%);background:#2b2366;color:#fff;border-radius:999px;padding:9px 16px;font-size:13.5px;box-shadow:0 10px 26px rgba(0,0,0,.25);display:flex;gap:10px;align-items:center;max-width:calc(100vw - 24px)}
.yo-dict button{border:0;background:rgba(255,255,255,.18);color:#fff;border-radius:999px;padding:4px 10px;font:inherit;cursor:pointer}
/* tools dialogs */
.kv{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:8px;margin:6px 0 12px}
.kv div{background:#f7f5ff;border:1px solid #ebe7fb;border-radius:12px;padding:10px 12px}
.kv b{display:block;font-size:20px;color:#2e2585}.kv span{font-size:12px;color:#6c6990}
.meter{height:10px;border-radius:9px;background:#eeeaf9;overflow:hidden;margin:6px 0 4px}.meter i{display:block;height:100%;background:linear-gradient(90deg,#7c5cf0,#3b2a99);border-radius:9px}
.prf{list-style:none;padding:0;margin:6px 0}.prf li{display:flex;gap:8px;align-items:center;justify-content:space-between;border:1px solid #ebe7fb;border-radius:10px;padding:8px 10px;margin-bottom:6px;flex-wrap:wrap}
.prf li .w{font-weight:600}.prf li .s{color:#15803d}.prf li .why{font-size:12px;color:#7d789f;flex-basis:100%}
.prf li button{border:1px solid #d9d3fa;background:#f7f5ff;color:#3b2a99;border-radius:8px;padding:4px 10px;font:inherit;font-size:12.5px;cursor:pointer}
.tplgrid{display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:10px}
.tplgrid button{border:1px solid #e3dff6;background:#fff;border-radius:12px;padding:14px 12px;text-align:start;font:inherit;cursor:pointer;display:flex;flex-direction:column;gap:6px}
.tplgrid button:hover{border-color:#a99cf2;background:#faf9ff}
.tplgrid button .ic{width:22px;height:22px;color:#5a4fc4}.tplgrid button b{font-size:14px}.tplgrid button small{color:#7d789f;font-size:12px}
.ff{display:grid;grid-template-columns:repeat(auto-fit,minmax(200px,1fr));gap:8px 12px}
.ff label{display:flex;flex-direction:column;gap:4px;font-size:12.5px;color:#57537a}
.ff input,.ff textarea,.ff select{border:1px solid #dcd7f2;border-radius:9px;padding:8px 10px;font:inherit;font-size:14px;background:#fff}
#editor tr.yo-pgap-row td{border:0!important;background:transparent!important}

#status:has(#yoStats) #stWords{display:none}
.findbar .fr{display:flex;align-items:center;gap:4px;flex-wrap:wrap}
.findbar .fr input{flex:1 1 140px;min-width:120px}
@media (max-width:760px){.findbar{inset-inline:8px!important;width:auto!important;max-width:none!important}.yo-stats #yoStatTxt{font-size:11px}.yo-stats #yoTools span{display:none}}
#toasts{pointer-events:none}#toasts .toast,#toasts button{pointer-events:auto}
@media (max-width:760px){#toasts{bottom:calc(130px + env(safe-area-inset-bottom))!important}}
.yo-doc .yo-neutral,.yo-doc p.yo-neutral{unicode-bidi:isolate!important}

/* ---- visual gallery menus (thumbnails) ---- */
.pop.vpop{padding:8px;max-height:min(78vh,560px);overflow:auto;overscroll-behavior:contain;animation:vpopIn .2s cubic-bezier(.2,.8,.2,1)}
@keyframes vpopIn{from{opacity:0;transform:translateY(-6px) scale(.97)}to{opacity:1;transform:none}}
.vmenu .vgrid{display:grid;gap:6px;padding:2px 0 4px}
.vmenu .mhd{padding:6px 6px 4px;font-size:12px;font-weight:700;color:#6b6890}
.vmenu .sep{height:1px;background:#ece9fa;margin:6px 2px}
.vmenu .vt{display:flex;flex-direction:column;align-items:center;justify-content:flex-start;gap:4px;min-height:84px;padding:8px 4px 6px;border:1.5px solid transparent;border-radius:12px;background:#faf9ff;cursor:pointer;color:#2b2754;font:inherit;transition:transform .15s ease-out,border-color .15s,background .15s,box-shadow .15s;animation:vtIn .24s ease-out both}
.vmenu .vgrid .vt:nth-child(2){animation-delay:.02s}.vmenu .vgrid .vt:nth-child(3){animation-delay:.04s}.vmenu .vgrid .vt:nth-child(4){animation-delay:.06s}.vmenu .vgrid .vt:nth-child(5){animation-delay:.08s}.vmenu .vgrid .vt:nth-child(n+6){animation-delay:.1s}
@keyframes vtIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.vmenu .vt:hover{background:#f1effd;border-color:#d9d4fb;transform:translateY(-1px);box-shadow:0 4px 12px rgba(75,63,176,.12)}
.vmenu .vt:active{transform:scale(.96)}
.vmenu .vt:focus-visible{outline:2px solid #6a5cf0;outline-offset:1px}
.vmenu .vt.on{border-color:#6a5cf0;background:#efedfb;box-shadow:0 0 0 3px rgba(106,92,240,.14)}
.vmenu .vt[disabled]{opacity:.45;cursor:default}
.vmenu .vth{display:flex;align-items:center;justify-content:center;min-height:48px;pointer-events:none}
.vmenu .vth svg{display:block;filter:drop-shadow(0 1px 1.5px rgba(75,63,176,.10))}
.vmenu .vtl{font-size:11.5px;line-height:1.25;text-align:center;max-width:100%;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.vmenu .vts{font-size:10px;color:#77739a;direction:ltr;unicode-bidi:isolate}
.vmenu .vcase{display:inline-flex;align-items:center;justify-content:center;min-width:56px;height:40px;padding:0 8px;border-radius:8px;background:#fff;border:1px solid #e2def5;color:#4b3fb0;font-weight:700;font-size:15px;white-space:nowrap}
.vmenu .vrow{display:flex;align-items:center;gap:10px;width:100%;min-height:40px;padding:8px 10px;border:0;border-radius:10px;background:none;color:#2b2754;font:inherit;text-align:start;cursor:pointer;transition:background .15s}
.vmenu .vrow:hover,.vmenu .vrow:focus-visible{background:#f1effd;outline:none}
.vmenu .vrow[disabled]{color:#8a87a8;cursor:default;background:none;font-size:12px;min-height:30px}
.vmenu .vrow kbd{margin-inline-start:auto;font-size:11px;color:#77739a}
@media (prefers-reduced-motion:reduce){.pop.vpop,.vmenu .vt{animation:none}.vmenu .vt{transition:none}}

/* @mentions */
.mention-pop{position:fixed;z-index:9999;background:#fff;border:1px solid #e2def5;border-radius:12px;box-shadow:0 12px 32px rgba(43,39,84,.18);padding:6px;animation:vpopIn .18s ease-out}
.mention-pop .mp-h{font-size:11.5px;color:#6b6890;font-weight:700;padding:4px 8px}
.mention-pop .mp-e{font-size:12px;color:#77739a;padding:6px 8px}
.mention-pop button{display:flex;align-items:center;gap:8px;width:100%;min-height:40px;padding:6px 8px;border:0;border-radius:9px;background:none;font:inherit;color:#2b2754;text-align:start;cursor:pointer}
.mention-pop button.on,.mention-pop button:hover{background:#f1effd}
.mention-pop .mp-av{width:26px;height:26px;border-radius:50%;display:grid;place-items:center;background:linear-gradient(135deg,#4b3fb0,#8b7cf6);color:#fff;font-size:12px;font-weight:700;flex:none}
.thread .mention{display:inline-block;padding:0 6px;border-radius:999px;background:#efedfb;color:#4b3fb0;font-weight:600;animation:vtIn .25s ease-out}
.thread .mention-mail{display:inline-flex;align-items:center;gap:6px;margin-top:4px;padding:4px 10px;min-height:32px;border-radius:999px;background:#f6f5fe;border:1px solid #e2def5;color:#4b3fb0;font-size:12px;text-decoration:none;transition:background .15s}
.thread .mention-mail:hover{background:#efedfb}
.thread .mention-mail .ic{width:14px;height:14px}

body.dark-page .yo-hint{color:#a49fca}
