/* Yamama Diagrams */
@font-face{font-family:Handicrafts;font-weight:400 700;font-display:swap;src:url(/fonts/handicrafts-bold.woff2) format('woff2')}
:root{--brand:#5b2a9e;--brand2:#7c3aed;--deep:#3b1366;--brand-soft:#f1eafc;--bg:#f7f5fc;--line:#e7e0f5;--line2:#d9cff0;--hover:#f2ecfc;--soft:#f8f5fe;--grad:linear-gradient(120deg,#3b1366,#6d28d9 55%,#8b5cf6);--ink:#21153d;--ink2:#4a3f66;--muted:#6f6787}
.btn.pri{background:var(--grad);border:0;box-shadow:0 2px 8px rgba(59,19,102,.22)}
.btn.pri:hover{background:linear-gradient(120deg,#33105a,#5b21b6 55%,#7c3aed)}
h1,h2,.brand b,.hero2 h1{font-family:Handicrafts,var(--ui)}
body.yd{overflow:hidden;height:100%;background:var(--bg)}
body.yd #home{height:100%;overflow:auto}
#splash{position:fixed;inset:0;display:grid;place-items:center;background:#fff;z-index:99;transition:opacity .4s}
#splash.out{opacity:0;pointer-events:none}
#splash .in{display:flex;flex-direction:column;align-items:center;gap:10px}
#splash svg{width:64px;height:70px}
#splash .wm{font-family:Handicrafts,var(--ui);font-size:22px;color:var(--deep);text-align:center}
#splash .wm small{display:block;font-family:var(--ui);font-size:11px;letter-spacing:.2em;color:var(--muted)}
/* ---------- editor layout ---------- */
#ed{position:fixed;inset:0;display:flex;flex-direction:column;background:var(--bg)}
#tb{height:52px;display:flex;align-items:center;gap:6px;padding:0 10px;background:#fff;border-bottom:1px solid var(--line);flex:none}
#tb .ttl{border:1px solid transparent;border-radius:8px;padding:6px 8px;font-weight:700;font-size:15px;min-width:80px;max-width:280px;width:28vw;background:transparent;color:var(--ink)} /* w148-diagrams-phone: a long diagram name ends with … instead of being cut mid-word in the narrow phone header */ #tb .ttl{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}
#tb .ttl:hover{border-color:var(--line)}#tb .ttl:focus{border-color:var(--brand2);outline:0;background:#fff}
.sstate{font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:200px}
.sstate.bad{color:#9a3412}
.grow{flex:1}
.tgrp{display:flex;align-items:center;gap:2px}
.zbtn{min-width:52px;height:32px;border-radius:8px;font-size:13px;font-weight:600;color:var(--ink2)}
.zbtn:hover{background:var(--hover)}
.ai-btn{background:var(--grad);color:#fff;border:0}
.ai-btn:hover{filter:brightness(1.08)}
.acct{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 10px;border-radius:999px;border:1px solid var(--line);background:#fff;font-size:13px;font-weight:600;color:var(--ink2)}
.acct .av{width:24px;height:24px;border-radius:50%;background:var(--grad);color:#fff;display:grid;place-items:center;font-size:12px}
.acct .nm{max-width:110px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
#tools{display:flex;align-items:center;gap:2px;padding:4px 8px;background:#fff;border-bottom:1px solid var(--line);flex:none;overflow-x:auto;scrollbar-width:none}
#tools::-webkit-scrollbar{display:none}
.ib.on,.ib[aria-pressed=true]{background:var(--brand-soft);color:var(--brand)}
.ib:disabled{opacity:.35;cursor:default}
.sepv{width:1px;height:24px;background:var(--line);margin:0 4px;flex:none}
.shq svg{display:block}
#main{flex:1;display:flex;min-height:0;position:relative}
#lib,#props{width:250px;flex:none;background:#fff;overflow:auto;border-inline-end:1px solid var(--line)}
#props{width:276px;border-inline-end:0;border-inline-start:1px solid var(--line)}
#lib.hide,#props.hide{display:none}
.libh{display:flex;align-items:center;justify-content:space-between;padding:12px 14px 6px;position:sticky;top:0;background:#fff;z-index:2}
.libh b{font-size:14px}
.xs-close{display:none}
.libs{padding:0 12px 8px;position:sticky;top:42px;background:#fff;z-index:2}
.libs input{width:100%;height:36px;border:1px solid var(--line2);border-radius:9px;padding:0 10px;background:var(--soft)}
.lcat{border-top:1px solid var(--line)}
.lcat summary{padding:10px 14px;font-weight:700;font-size:13px;cursor:pointer;color:var(--ink2);list-style:none;display:flex;justify-content:space-between}
.lcat summary::after{content:'+';color:var(--muted)}.lcat[open] summary::after{content:'–'}
.lgrid{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;padding:0 8px 10px}
.ltile{display:flex;flex-direction:column;align-items:center;gap:3px;padding:6px 2px;border-radius:9px;border:1px solid transparent;font-size:10.5px;color:var(--ink2);line-height:1.25;text-align:center;cursor:grab;min-height:72px;touch-action:manipulation}
.ltile:hover{background:var(--hover);border-color:var(--line)}
.ltile span{display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}
.ltile.sm{min-height:0;padding:4px}.ltile.on{border-color:var(--brand2);background:var(--brand-soft)}
#stage{flex:1;position:relative;overflow:hidden;background:#fff;touch-action:none;user-select:none;-webkit-user-select:none}
#stage.grid{background-image:linear-gradient(rgba(91,42,158,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(91,42,158,.07) 1px,transparent 1px),linear-gradient(rgba(91,42,158,.035) 1px,transparent 1px),linear-gradient(90deg,rgba(91,42,158,.035) 1px,transparent 1px)}
#stage.grid.nogrid{background-image:linear-gradient(rgba(91,42,158,.06) 1px,transparent 1px),linear-gradient(90deg,rgba(91,42,158,.06) 1px,transparent 1px)}
#cv{width:100%;height:100%;display:block;touch-action:none}
#stage.tool-hand #cv{cursor:grab}
/* w109-firstrun: an empty page is not a blank dead end; a quiet hint until the first shape lands (CSS only, no clicks caught) */
#stage:has(#world:empty)::after{content:"Blank page. Drag a shape here from the Shapes panel to start.";position:absolute;inset:auto 0 46% 0;margin:auto;width:max-content;max-width:min(420px,86%);padding:10px 16px;border-radius:12px;background:rgba(91,42,158,.06);color:#5b4a78;font:600 14px/1.5 system-ui,sans-serif;text-align:center;pointer-events:none;z-index:1}
html[lang^=ar] #stage:has(#world:empty)::after{content:"صفحة فارغة. اسحب شكلًا إلى هنا من لوحة الأشكال للبدء."}
@media (max-width:760px){#stage:has(#world:empty)::after{content:"Blank page. Tap + below to add a shape."}html[lang^=ar] #stage:has(#world:empty)::after{content:"صفحة فارغة. اضغط + في الأسفل لإضافة شكل."}}
html.dark #stage:has(#world:empty)::after{background:rgba(205,184,255,.08);color:#cdb8ff}#stage.panning #cv{cursor:grabbing}#stage.tool-cross #cv{cursor:crosshair}
.shp{cursor:move}.con{cursor:pointer}
.selr,.selb{fill:none;stroke:#7c3aed;pointer-events:none}
.selc{fill:none;stroke:#8b5cf6;stroke-opacity:.35;pointer-events:none}
.hd{fill:#fff;stroke:#7c3aed;cursor:pointer}
.hd.rs{cursor:nwse-resize}.hd.rot{fill:#7c3aed;cursor:grab}
.hd.port{fill:#fff;stroke:#7c3aed;opacity:.9;cursor:crosshair}
.hd.port:hover{fill:#7c3aed}
.hd.cend.on{fill:#7c3aed}
.rotl{stroke:#7c3aed;pointer-events:none}
.guide{stroke:#d946ef;stroke-dasharray:4 3;pointer-events:none}
.marq{fill:rgba(124,58,237,.08);stroke:#7c3aed;stroke-dasharray:4 3;pointer-events:none}
.con.ghost{opacity:.7;pointer-events:none}
#te{position:absolute;z-index:5;border:2px solid #7c3aed;border-radius:6px;background:rgba(255,255,255,.97);padding:4px 6px;resize:none;font-family:var(--ui);line-height:1.32;box-shadow:0 6px 20px rgba(59,19,102,.18);outline:0;color:var(--ink)}
#pagebar{display:flex;align-items:center;gap:4px;padding:4px 10px;background:#fff;border-top:1px solid var(--line);flex:none;overflow-x:auto;min-height:40px}
.ptab{height:30px;padding:0 14px;border-radius:8px;font-size:13px;font-weight:600;color:var(--ink2);white-space:nowrap;border:1px solid transparent}
.ptab:hover{background:var(--hover)}.ptab.on{background:var(--brand-soft);color:var(--brand);border-color:var(--line2)}
.pinfo{font-size:12px;color:var(--muted);white-space:nowrap}
#mbar{display:none}
/* ---------- format panel ---------- */
.ptabs{margin:4px 12px 6px;display:flex}.ptabs button{flex:1;justify-content:center}
.pbody{padding:4px 14px 18px}
.pbody h4{font-size:12px;font-weight:700;color:var(--muted);margin:14px 0 6px;display:flex;align-items:center;justify-content:space-between}
.swl{display:grid;grid-template-columns:repeat(9,1fr);gap:4px}
.sw{aspect-ratio:1;border-radius:6px;background:var(--c);border:1px solid rgba(33,21,61,.15);min-width:0}
.sw.on{outline:2px solid #7c3aed;outline-offset:1px}
.sw.none{background:linear-gradient(135deg,#fff 45%,#c084fc 45%,#c084fc 55%,#fff 55%)}
.sw.custom{display:grid;place-items:center;position:relative;cursor:pointer;background:#fff;color:var(--ink2)}
.sw.custom input{position:absolute;inset:0;opacity:0;cursor:pointer;width:100%;height:100%}
.sw.custom .ic{width:14px;height:14px}
.frow{display:flex;gap:8px;align-items:flex-end;margin-top:8px}.frow>*{flex:1;min-width:0}
.fld{display:flex;flex-direction:column;gap:4px;font-size:12px;color:var(--ink2);margin-top:8px}
.fld select,.fld input[type=text],.fld input[type=number],.fld textarea{height:34px;border:1px solid var(--line2);border-radius:8px;padding:0 8px;background:#fff;font-size:13px;width:100%}
.fld textarea{height:auto;padding:6px 8px;resize:vertical}
.fld.chk{flex-direction:row;align-items:center;gap:6px;min-height:34px}
.fld input[type=range]{accent-color:#7c3aed}
.fld .seg{width:100%}.fld .seg button{flex:1;justify-content:center;padding:0 6px}
.seg button.on{background:#fff;color:var(--brand);box-shadow:0 1px 2px rgba(33,21,61,.12)}
.bgrid{display:flex;flex-wrap:wrap;gap:4px}
.swapg{display:grid;grid-template-columns:repeat(6,1fr);gap:3px}
.qst{display:grid;grid-template-columns:repeat(5,1fr);gap:6px}
.qs{height:32px;border-radius:8px;border:2px solid;font-weight:700}
.themes{display:grid;grid-template-columns:repeat(2,1fr);gap:6px}
.theme{display:flex;align-items:center;gap:3px;border:1px solid var(--line);border-radius:9px;padding:6px 8px;font-size:12px}
.theme span{width:14px;height:14px;border-radius:4px;border:1px solid rgba(0,0,0,.1)}.theme em{font-style:normal;margin-inline-start:4px}
.theme:hover{background:var(--hover)}
.layers{list-style:none;margin:0;padding:0;border:1px solid var(--line);border-radius:10px;overflow:hidden}
.layers li{display:flex;align-items:center;gap:2px;padding:2px 4px;border-top:1px solid var(--line)}.layers li:first-child{border-top:0}
.layers li.on{background:var(--brand-soft)}
.lname{flex:1;text-align:start;padding:6px;font-size:13px;font-weight:600;display:flex;flex-direction:column}
.lname small{font-weight:400;color:var(--muted);font-size:11px}
.pact{margin-top:16px}
.pnote{font-size:12px;color:var(--muted);line-height:1.6;margin-top:14px}
.kbt{width:100%;border-collapse:collapse}.kbt td{padding:6px;border-bottom:1px solid var(--line);font-size:13px}
kbd{font-family:inherit;background:var(--soft);border:1px solid var(--line2);border-radius:5px;padding:1px 6px;font-size:12px}
/* ---------- AI dialog ---------- */
.aid textarea{width:100%;border:1px solid var(--line2);border-radius:10px;padding:10px;font-size:15px;resize:vertical;min-height:96px}
.aid .fl{display:block;font-weight:700;margin-bottom:6px}
.chips{display:flex;flex-wrap:wrap;gap:6px;margin:10px 0}
.chip{display:inline-flex;align-items:center;gap:5px;height:32px;padding:0 12px;border-radius:999px;border:1px solid var(--line2);font-size:13px;font-weight:600;color:var(--ink2);background:#fff}
.chip .ic{width:15px;height:15px}.chip.on{background:var(--brand-soft);border-color:#a78bfa;color:var(--brand)}
.ex{display:flex;flex-wrap:wrap;gap:6px}.exb{font-size:12px;color:var(--brand);background:var(--soft);border-radius:8px;padding:4px 8px;text-align:start}
.seg.wh{margin-top:12px;width:100%}.seg.wh button{flex:1;justify-content:center}
.cost{font-size:13px;color:var(--ink2);margin:12px 0 0;min-height:20px}
.aact{display:flex;gap:8px;flex-wrap:wrap;margin-top:12px}.aact .btn{flex:1}
.fine{font-size:12px;color:var(--muted);line-height:1.6}
.spin{width:14px;height:14px;border:2px solid rgba(255,255,255,.5);border-top-color:#fff;border-radius:50%;animation:spin .8s linear infinite;display:inline-block}
@keyframes spin{to{transform:rotate(360deg)}}
.shl{display:flex;gap:6px;margin-top:12px}.shl input{flex:1;height:38px;border:1px solid var(--line2);border-radius:9px;padding:0 10px;font-size:13px}
.seg.wide{display:flex;width:100%;margin-top:10px}.seg.wide button{flex:1;justify-content:center}
/* w141-share-people: people section of the Share dialog (same look as Docs/Sheets/Slides) */
.ppl{margin-top:16px;padding-top:14px;border-top:1px solid var(--line)}
.pplh{display:flex;align-items:center;gap:8px;font-size:15px;margin:0 0 10px}
.invrow{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.invrow input{flex:1 1 200px;min-width:0;min-height:40px;padding:0 12px;border:1px solid var(--line2);border-radius:10px;background:var(--card);color:var(--ink);font:inherit;font-size:14px}
.invrow input:focus-visible{outline:2px solid var(--brand);outline-offset:1px}
.invrow .btn,.ppl .seg button{min-height:40px}
.invmsg{min-height:20px;margin:8px 0 2px;font-size:13.5px;color:#15803d}.invmsg.bad{color:#b42318}
.ppl .tiny{font-size:12.5px;line-height:1.6;margin:4px 0 0;color:var(--muted)}
.invlist{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:6px}
.invlist li{display:flex;align-items:center;gap:10px;padding:6px 8px;padding-inline-start:12px;border:1px solid var(--line);border-radius:10px}
.invlist .iem{flex:1;min-width:0;overflow-wrap:anywhere;font-size:14px}
.invlist select.irl{min-height:40px;padding:0 8px;border:1px solid var(--line);border-radius:8px;background:transparent;font:inherit;font-size:13px;font-weight:600;color:var(--brand);cursor:pointer;width:auto;flex:none}
.invlist .ist{font-size:12.5px;color:var(--muted)}
.invlist .ib{min-width:40px;min-height:40px;display:inline-flex;align-items:center;justify-content:center;flex:none}
@media (max-width:520px){.invlist .ist{display:none}.invlist li{gap:6px}}
.vlist{list-style:none;padding:0;margin:0}.vlist li{display:flex;justify-content:space-between;align-items:center;padding:8px 0;border-bottom:1px solid var(--line);font-size:13px}
/* ---------- templates & home ---------- */
.tgal{display:grid;grid-template-columns:repeat(auto-fill,minmax(170px,1fr));gap:12px}
.tgal.row{grid-auto-flow:column;grid-auto-columns:minmax(168px,1fr);grid-template-columns:none;overflow-x:auto;padding-bottom:6px;scroll-snap-type:x mandatory}
.tcard{display:flex;flex-direction:column;gap:8px;text-align:start;border:1px solid var(--line);border-radius:14px;padding:8px;background:#fff;scroll-snap-align:start;transition:box-shadow .15s,border-color .15s}
.tcard:hover{border-color:#c4b5fd;box-shadow:0 6px 18px rgba(59,19,102,.10)}
.tcard .tth{height:120px;border-radius:10px;background:#faf8ff;display:grid;place-items:center;overflow:hidden}
.tcard .tth svg{max-width:100%;max-height:100%;width:auto;height:auto}
.tcard b{font-size:13px;padding:0 4px 4px}
.tcard.blank .tth{color:var(--brand)}.tcard.blank .tth .ic{width:34px;height:34px}
.htop{display:flex;align-items:center;gap:10px;padding:10px 18px;background:#fff;border-bottom:1px solid var(--line);position:sticky;top:0;z-index:5}
.brand{display:flex;align-items:center;gap:8px;text-decoration:none;color:var(--ink);font-size:18px}
.brand b{color:var(--deep)}
.hsearch{display:flex;align-items:center;gap:6px;background:var(--soft);border:1px solid var(--line);border-radius:10px;padding:0 10px;height:38px;flex:1;max-width:420px}
.hsearch input{border:0;background:transparent;flex:1;outline:0;height:100%;min-width:0}
.tsp{flex:1}
.pts{display:inline-flex;align-items:center;gap:5px;height:34px;padding:0 10px;border-radius:999px;background:var(--brand-soft);color:var(--brand);font-weight:700;font-size:13px}
.hm2{max-width:1180px;width:100%;min-width:0;box-sizing:border-box;margin:0 auto;padding:18px 18px 60px}.hm2>section{min-width:0;max-width:100%}.tgal.row{max-width:100%}
.hero2{background:var(--grad);border-radius:20px;padding:30px 26px;color:#fff;margin-bottom:22px}
.hero2 h1{margin:0 0 14px;font-size:30px;line-height:1.3}
.askbar{display:flex;align-items:center;gap:8px;background:#fff;border-radius:14px;padding:6px;max-width:680px;box-shadow:0 10px 30px rgba(20,6,40,.25)}
.askbar input{flex:1;border:0;outline:0;font-size:15px;padding:8px 6px;min-width:0;color:var(--ink)}
.ai-dot{width:34px;height:34px;border-radius:10px;background:var(--brand-soft);color:var(--brand);display:grid;place-items:center;flex:none}
.hhead{display:flex;align-items:center;gap:10px;margin:22px 0 10px;flex-wrap:wrap}.hhead h2{margin:0;font-size:20px;flex:1}
.lnk{color:var(--brand);font-weight:600;font-size:13px;background:none;border:0;text-decoration:underline;text-underline-offset:3px;cursor:pointer}
.dlist{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:10px}
.dcard{position:relative;display:flex;align-items:flex-start;background:#fff;border:1px solid var(--line);border-radius:12px}
.dcard:hover{border-color:#c4b5fd}
.dopen{flex:1;display:grid;grid-template-columns:auto 1fr;column-gap:10px;row-gap:2px;padding:12px;text-align:start;min-width:0}
.dopen .ic{grid-row:span 3;width:30px;height:30px;padding:6px;border-radius:9px;background:var(--brand-soft);color:var(--brand);box-sizing:content-box}
.dopen b{font-size:14px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dopen small{color:var(--muted);font-size:12px}
.dopen em{font-style:normal;font-size:12px;color:var(--ink2);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.dcard>.ib{margin:8px 4px}
.dcard .star{position:absolute;top:6px;inset-inline-end:40px;color:#d97706}.dcard .star .ic{width:14px;height:14px;fill:#fbbf24}
.empty{padding:30px;text-align:center;color:var(--muted);background:#fff;border:1px dashed var(--line2);border-radius:14px}
.empty.full{margin:15vh auto;max-width:440px;border:0;background:none}
.nvfoot{font-size:12.5px;color:var(--muted);margin-top:18px;display:flex;align-items:center;gap:6px;flex-wrap:wrap}
#printArea{display:none}
@media print{body.printing>*:not(#printArea){display:none!important}body.printing #printArea{display:block}#printArea .pp{page-break-after:always;height:100vh;display:flex;align-items:center;justify-content:center}}
/* ---------- phone ---------- */
@media (max-width:760px){
  .dk,[data-dk]{display:none!important}
  #tb{height:50px;padding:0 4px;gap:2px}
  #tb .ttl{width:auto;flex:1;min-width:40px;font-size:14px}
  .sstate{display:none}
  #tb .grow{display:none}
  .ai-btn{min-height:36px;padding:0 10px}
  #tools{display:none}
  #lib,#props{position:fixed;inset-inline:0;bottom:0;top:auto;width:auto;max-height:62vh;z-index:30;border:0;border-radius:18px 18px 0 0;box-shadow:0 -10px 40px rgba(33,21,61,.22);transform:translateY(105%);transition:transform .22s cubic-bezier(.2,.8,.3,1);display:block!important;padding-bottom:env(safe-area-inset-bottom)}
  #lib.open,#props.open{transform:none}
  #lib:not(.open),#props:not(.open){visibility:hidden;transition:transform .22s cubic-bezier(.2,.8,.3,1),visibility 0s linear .22s} /* w153-shared-chrome (task 0517c8b2): a closed Shapes / Page sheet is hidden (not just slid off-screen) once its slide-out ends, so it is out of the page, the tab order and the screen-reader tree until it is opened again */
  body.yd.editing{overflow:hidden!important;overflow:clip!important}
  html.yoc-on.yoc-phone:not(.yoc-collapsed)>body.yd.editing{overflow:hidden!important;overflow:clip!important}
  html.yoc-on.yoc-phone:not(.yoc-collapsed)>body.yd.editing #lib.open,html.yoc-on.yoc-phone:not(.yoc-collapsed)>body.yd.editing #props.open{max-height:calc(100% - 12px)}
  .xs-close{display:inline-grid}
  .lgrid{grid-template-columns:repeat(4,1fr)}
  #pagebar{min-height:36px;padding:2px 8px}
  #mbar{display:flex;align-items:center;justify-content:space-around;height:58px;background:#fff;border-top:1px solid var(--line);flex:none;padding-bottom:env(safe-area-inset-bottom)}
  #mbar .ib{width:44px;height:44px}
  #mbar .mb.add{width:48px;height:48px;border-radius:16px;background:var(--grad);color:#fff;display:grid;place-items:center;box-shadow:0 4px 14px rgba(59,19,102,.3)}
  .hd{stroke-width:2}
  .htop{padding:8px 10px;gap:6px}.hsearch{display:none}.brand span{font-size:16px}
  .hero2{padding:22px 16px;border-radius:16px}.hero2 h1{font-size:23px}
  .askbar{flex-wrap:nowrap}
  .tgal.row{grid-auto-columns:150px}
  .dlist{grid-template-columns:1fr}
  .swl{grid-template-columns:repeat(9,1fr)}
}
#ed.ro #tools,#ed.ro .ai-btn,#ed.ro [data-cmd=undo],#ed.ro [data-cmd=redo],#ed.ro #mbar .add,#ed.ro [data-cmd=ai]{display:none!important}

/* r2: phone tap targets >=36px */
@media (pointer:coarse){
 .brand{min-height:36px}
 .btn.sm{min-height:36px}
 .seg.sm button,.seg button{min-height:36px}
 button.lnk{min-height:36px;display:inline-flex;align-items:center;padding:6px 4px}
}
button.lnk{min-height:28px}

/* ---- Oct 14 parity: drawn pickers ---- */
.cbtn{display:inline-flex;align-items:center;gap:8px;min-height:40px;padding:4px 10px;border:1px solid #e1d6f5;border-radius:10px;background:#fff;color:#2a1650;font:inherit;font-size:13px;cursor:pointer;transition:transform .15s ease-out,box-shadow .2s ease-out,border-color .2s}
.cbtn:hover{border-color:#a07be0;box-shadow:0 2px 10px rgba(91,42,158,.12)}.cbtn:active{transform:scale(.97)}
.cbtn .cchip{width:22px;height:22px;border-radius:6px;background:var(--c);box-shadow:inset 0 0 0 1px rgba(42,22,80,.18);flex:none}
.cbtn .cchip.none{background:linear-gradient(135deg,transparent 45%,#7c3aed 45%,#7c3aed 55%,transparent 55%),#fff}
.cbtn .cnm{flex:1;text-align:start;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:120px}.cbtn svg.ic,.cbtn .ic{width:14px;height:14px;opacity:.6}
.swl .cbtn{grid-column:1/-1;margin-bottom:4px;width:100%}.swl .cbtn.sm{margin:4px 0 0}
.lnp{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}.lnp.hd{grid-template-columns:repeat(4,1fr)}
.lnp button{min-height:40px;display:flex;align-items:center;justify-content:center;border:1px solid #e6def5;border-radius:9px;background:#fff;color:#3b1366;cursor:pointer;transition:transform .15s ease-out,background .2s,border-color .2s}
.lnp button:hover{background:#f6f1fe;border-color:#c9b3ef}.lnp button:active{transform:scale(.95)}
.lnp button.on{background:#efe6fd;border-color:#7c3aed;color:#5b2a9e;box-shadow:0 0 0 2px rgba(124,58,237,.18)}
.lnp.hd svg{width:44px}
.fntp{display:grid;grid-template-columns:repeat(auto-fill,minmax(82px,1fr));gap:6px}
.fntp button{min-height:52px;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:2px;border:1px solid #e6def5;border-radius:10px;background:#fff;color:#2a1650;cursor:pointer;transition:transform .15s ease-out,border-color .2s,background .2s}
.fntp button b{font-size:17px;font-weight:600;line-height:1.2}.fntp button small{font-size:10.5px;color:#6c6990;font-family:'IBM Plex Sans Arabic',system-ui,sans-serif}
.fntp button.on{border-color:#7c3aed;background:#f4edff;box-shadow:0 0 0 2px rgba(124,58,237,.18)}.fntp button:active{transform:scale(.96)}
.themes.tthumbs{display:grid;grid-template-columns:repeat(auto-fill,minmax(92px,1fr));gap:8px}
.theme.tth2{display:flex;flex-direction:column;align-items:center;gap:4px;padding:6px;border:1px solid #ece4f8;border-radius:12px;background:#fff;cursor:pointer;transition:transform .18s ease-out,box-shadow .2s}
.theme.tth2:hover{transform:translateY(-2px);box-shadow:0 6px 16px rgba(91,42,158,.14)}.theme.tth2 svg{width:100%;height:auto}.theme.tth2 em{font-style:normal;font-size:12px;color:#3b1366}
[data-cmd=painter].on{background:#efe6fd;color:#5b2a9e;box-shadow:inset 0 0 0 1.5px #7c3aed}
#props .pbody>*{animation:ydIn .22s ease-out both}
@keyframes ydIn{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
.ltile{transition:transform .15s ease-out,box-shadow .2s,background .2s}.ltile:hover{transform:translateY(-1px)}.ltile:active{transform:scale(.95)}
@media (prefers-reduced-motion:reduce){#props .pbody>*{animation:none}.cbtn,.lnp button,.fntp button,.theme.tth2,.ltile{transition:none}}

/* r4b phone: editor touch targets 44px (toolbar, tool group, page bar) */
@media (max-width:760px){#tb{height:56px!important}#tb .ib,.tgrp .ib,#pagebar .ib{width:44px!important;height:44px!important;margin-block:0}#tb .ttl{min-height:44px;box-sizing:border-box}#tb .ai-btn{min-height:44px!important;min-width:44px!important}#pagebar{min-height:52px!important}.ptab{height:44px!important}}
/* d1017v5: home ask bar and segmented tabs >=44px on phones */
@media (max-width:760px){
 #hAsk input,#hAsk .btn{min-height:44px}
 .seg.sm button{min-width:44px;min-height:44px}
}

/* d1017v5b: the comments button is a secondary tool, not a second primary (only + is filled) */
#mbar .mb.add[aria-label="التعليقات"],#mbar .mb.add[aria-label="Comments"]{background:transparent!important;color:var(--ink,#1f2433)!important;box-shadow:none!important;border:1px solid var(--line,#d9dce6)}

.dvdlg .mfoot .btn{min-height:44px;min-width:88px}.dvdlg .mclose{min-width:44px;min-height:44px}

/* p1017s: strict crawl v6 — phone: status bar never wider than the screen; 40px card/menu targets */
@media (max-width:760px){
 #status{max-width:100vw;overflow:hidden;box-sizing:border-box}
 #status button{padding:0 5px;flex:0 1 auto;min-width:0}
 #status #stLang,#status #stWords{display:none}
 .dlist-grid .ib,.dlist-list .ib,.ib.mclose{width:40px;height:40px}
 .pop[role=menu] button{min-height:40px}
 a.brand{min-height:40px}
}

/* o1017q: strict crawl v6 — phone: template gallery wraps (no sideways strip), primary button contrast, 40px icons */
.btn.pri{background:#3955A3}.btn.pri:hover{background:#2e4688}
@media (max-width:760px){
 .tgal.row{grid-auto-flow:row;grid-auto-columns:auto;grid-template-columns:repeat(2,minmax(0,1fr));overflow:visible;scroll-snap-type:none}
 .tgal.row .tcard{min-width:0}
 .ib{min-width:40px;min-height:40px}
}

/* w62: editor title bar at tablet widths: the account button shows the avatar only (its aria-label keeps the name); it sat 6 px past the edge at 768 */
@media (max-width:900px){button.acct.dk .nm{display:none}button.acct.dk{padding:0 6px}}
/* w62-deploy-diagrams-20261030T051154Z-26609 */

/* w63-dgbar-20261030T062753Z (task 84172d81): the editor bar holds 14 controls in one row; on a tablet, or on a laptop with the assistant panel open, the diagram title and the save state were cut («محفو…», «مخطط بدون اس…») and the bar overflowed. The rules follow the bar's own width: zoom out / zoom in / fit stay in the 100% zoom menu, Share, Commands and the account show their icons only (their names stay for screen readers), and the title and save state keep their full text. */
#tb{container:w63tb / inline-size}
@container w63tb (max-width:1100px){
  #tb .zoomg .ib{display:none}
  #tb [data-cmd="share"]{padding-inline:10px;position:relative}
  #tb [data-cmd="share"] span{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}
  #tb .yox-fab span,#tb .yox-fab kbd,#tb .acct .nm{display:none}
  #tb .yox-fab{margin-inline-end:4px!important}
  #tb .sstate{flex:none;max-width:none}
  #tb .ttl{flex:1 1 150px;width:auto;min-width:110px;max-width:280px}
}
@container w63tb (max-width:760px){
  #tb .yox-fab{display:none}
}

/* w91k: text-style link buttons on the home screen were 32-33px tall; give them a full 44px tap area without changing how they look */
#hAllT,.hm2 button.lnk{min-height:44px;display:inline-flex;align-items:center;padding-block:0}

/* w91k: list cards slid in from 0 opacity, so for a quarter second their text had almost no contrast (review_v3 H13 caught it mid-fade). Keep the slide, drop the fade. */
html .tcard,html .srow,html .shrow{animation-name:yoItemNoFade}
@keyframes yoItemNoFade{from{translate:0 6px}to{translate:0 0}}
/* w91m (1 Nov): phone home leaves room under the last row for the floating assistant button, so a card's «Options» can always scroll clear of it */
@media (max-width:767px){#home main.hmain{padding-bottom:200px}}
/* w91o (1 Nov): wider screens too — the «ابدأ من» templates wrap into rows instead of a sideways strip. With the assistant docked at 1280 the strip ran under the panel edge and showed a half-cut card; now every template is whole and on screen. */
@media (min-width:761px){.tgal.row{grid-auto-flow:row;grid-auto-columns:auto;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));overflow:visible;scroll-snap-type:none}.tgal.row .tcard{min-width:0}}

/* w91p: on phones the home-screen header scrolls away with the list (as the Docs/Sheets home already does on phones). Sticky, it sat over the template cards once the list was scrolled, hiding their titles (measured 2.42:1 'contrast' = title under the header). The editor's toolbar header is unchanged. */
@media (max-width:600px){body.yd:not(.editing) #home>.htop{position:relative}}
/* w91r: with the assistant button off the phone home, the points pill keeps a 44 px tap height there on its own */
@media (max-width:600px){#home .htop .pts{height:44px;min-height:44px}}
/* w136-diagrams: on phones a toast («تم النسخ», «أُضيفت طبقة…», «تم التجميع») sat over the bottom tool bar for about 3 s and swallowed the next tap on Connect, Add shape or Comments; it now shows above the page tabs and the tool bar, and below the top bar while a Shapes or Format sheet is open */
@media (max-width:760px){body.yd.editing #toasts{bottom:calc(122px + env(safe-area-inset-bottom))}body.yd.editing:has(#ed.sheet-open) #toasts{top:calc(64px + env(safe-area-inset-top));bottom:auto}}
/* w150-phone-leftovers (task 7e792d95): floating Duplicate / Delete bar over the selection on a phone (one tap to delete, like Visio mobile) */
.w150sel{position:fixed;z-index:25;display:flex;gap:4px;padding:4px;background:#fff;border:1px solid var(--line,#e4e1f0);border-radius:14px;box-shadow:0 6px 20px rgba(33,21,61,.18)}.w150sel[hidden]{display:none!important}.w150sel .ib{width:44px!important;height:44px!important;min-width:44px;margin:0;display:inline-flex;align-items:center;justify-content:center;border-radius:10px}.w150sel .ib[data-cmd=del]{color:#b42318}html.dark .w150sel{background:#221d38;border-color:#3d3660}html.dark .w150sel .ib[data-cmd=del]{color:#ff9b91}/* w152-reach-coverage */.w152sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap}#stage:focus-visible{outline:3px solid #6d4cff;outline-offset:-3px}

/* w170-diagrams-desktop-chrome (task 7c698ced): desktop editor chrome at 1229-1440 px vs Visio for the web.
   1) Tools bar: at a 1229 px window (125 % laptop scaling) with the assistant docked the bar was 39 px too wide and hid «Format panel» behind a scroll bar that is not drawn; at 1280 docked it was 1 px too wide. Buttons go 36→32 px when the bar is narrower than its one-row width, and if it is narrower still it wraps to a second row instead of hiding buttons.
   2) Format pane: the wheel over the pane did nothing (its inner body held the wheel without scrolling); it now scrolls the pane.
   3) Page bar: with many pages «New page» and the shape count went off the edge (under the docked assistant); they now stay pinned at the end of the bar while the page tabs scroll.
   4) Shapes search with no match showed an empty panel; it now says so. */
@media (min-width:761px){
  #tools{flex-wrap:wrap;row-gap:2px;container-type:inline-size}
  @container (max-width:970px){#tools>.ib{width:32px;min-width:32px}}
  #props .pbody{overscroll-behavior:auto}
  #pagebar .pinfo{position:sticky;inset-inline-end:0;z-index:1;flex:none;box-sizing:border-box;width:168px;padding-inline-start:10px;text-align:end;overflow:hidden;text-overflow:ellipsis;background:inherit}
  #pagebar [data-pgadd]{position:sticky;inset-inline-end:168px;z-index:1;background:inherit}
  #pagebar{scroll-padding-inline:0 214px}
}
#lib .libc:not(:has(.lcat:not([hidden])))::after{content:"No shapes match your search";display:block;padding:28px 16px;color:var(--muted);font-size:13px;line-height:1.5;text-align:center}
html[lang^=ar] #lib .libc:not(:has(.lcat:not([hidden])))::after{content:"لا توجد أشكال مطابقة لبحثك"}
/* end w170 */

/* nov6r6: shape tile tap answers at once */
.ltile.lt-hit{outline:2px solid var(--brand,#0f6b4f);outline-offset:-2px;background:color-mix(in srgb,var(--brand,#0f6b4f) 12%,transparent)}
.ltile.lt-hit::after{content:'✓';position:absolute;inset-block-start:4px;inset-inline-end:6px;font:700 13px/1 system-ui;color:var(--brand,#0f6b4f)}
.ltile{position:relative}

/* nov6r8: «ارسم» is a 44px target; an empty request shakes the bar and shows a hint */
.askbar .btn.pri.sm{min-height:44px;min-width:64px;padding-inline:16px}
.askbar.need{border-color:#dc2626!important;box-shadow:0 0 0 3px rgba(220,38,38,.18)!important;animation:askShake .32s ease}
@keyframes askShake{0%,100%{transform:none}25%{transform:translateX(-5px)}75%{transform:translateX(5px)}}
@media (prefers-reduced-motion:reduce){.askbar.need{animation:none}}
.askhint{display:table;margin:10px auto 0;max-width:640px;background:#fff;color:#b91c1c;padding:7px 14px;border-radius:999px;font-size:13.5px;font-weight:600;text-align:center;box-shadow:0 4px 14px rgba(0,0,0,.12)}.askhint:empty{display:none}
