/* assets/css/ua_window_manager.css
   Chrome-like in-page window manager + dashboard-matched golden navigator.
   Applies only to the normal shell pages; iframe/popup pages stay clean. */

body.ua-shell-chrome:not(.ua-page-dashboard){
  --ua-wm-sidebar-w: var(--ua-layout-sidebar-w, var(--ua-sidebar-w, 238px));
  --ua-wm-gap: var(--ua-layout-gap, 16px);
  --ua-wm-gold-w: 18px;
  --ua-wm-gold-gap: 7px;
}

body.ua-shell-chrome:not(.ua-page-dashboard) .ua-unified-shell-block{
  position:relative !important;
  z-index:90 !important;
  margin-inline-start:calc(var(--ua-wm-sidebar-w) + var(--ua-wm-gold-w) + var(--ua-wm-gold-gap)) !important;
  margin-inline-end:16px !important;
}
html[dir="ltr"] body.ua-shell-chrome:not(.ua-page-dashboard) .ua-unified-shell-block{
  margin-inline-start:16px !important;
  margin-inline-end:calc(var(--ua-wm-sidebar-w) + var(--ua-wm-gold-w) + var(--ua-wm-gold-gap)) !important;
}

body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-windowbar{
  overflow:visible !important;
  isolation:isolate;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-windowbar__pages{
  overflow-x:auto !important;
  overflow-y:hidden !important;
  scrollbar-width:none;
  padding-block:4px;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-windowbar__pages::-webkit-scrollbar{display:none;}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-windowbar__pages::before{display:none !important;}

body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab{
  appearance:none !important;
  border:1px solid var(--ua-ds-line) !important;
  background:color-mix(in srgb,var(--ua-theme-input) 78%,transparent) !important;
  color:var(--ua-ds-text) !important;
  height:30px !important;
  min-width:112px !important;
  max-width:220px !important;
  padding:0 9px !important;
  border-radius:10px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  gap:7px !important;
  font-size:12px !important;
  font-weight:850 !important;
  white-space:nowrap !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
  flex:0 0 auto !important;
  cursor:pointer !important;
  box-shadow:inset 0 1px 0 color-mix(in srgb,var(--ua-ds-title) 6%,transparent) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab:hover{
  color:var(--ua-ds-title) !important;
  border-color:color-mix(in srgb,var(--ua-accent) 34%,var(--ua-ds-line)) !important;
  background:color-mix(in srgb,var(--ua-accent) 12%,var(--ua-theme-input)) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab.is-current{
  color:var(--ua-ds-title) !important;
  border-color:color-mix(in srgb,var(--ua-accent) 40%,var(--ua-ds-line)) !important;
  background:color-mix(in srgb,var(--ua-accent) 14%,var(--ua-theme-input)) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab.is-minimized{
  opacity:.72 !important;
  border-color:color-mix(in srgb,var(--ua-sem-warning) 38%,var(--ua-ds-line)) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab i{
  flex:0 0 auto !important;
  opacity:.9 !important;
  font-size:11px !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab span{
  min-width:0 !important;
  overflow:hidden !important;
  text-overflow:ellipsis !important;
}

body.ua-shell-chrome:not(.ua-page-dashboard) .ua-wm-stage{
  width:100% !important;
  min-width:0 !important;
  position:relative !important;
  display:block !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-wm-pane{
  width:100% !important;
  min-width:0 !important;
  display:block !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-wm-pane[hidden]{
  display:none !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-wm-pane.is-minimized{
  display:none !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-wm-iframe{
  display:block !important;
  width:100% !important;
  min-width:0 !important;
  border:0 !important;
  background:transparent !important;
  border-radius:18px !important;
  overflow:hidden !important;
  min-height:var(--ua-contract-workspace-h, calc(100dvh - 130px)) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-wm-empty{
  display:grid !important;
  place-items:center !important;
  min-height:calc(100vh - 160px) !important;
  color:var(--ua-sem-muted) !important;
  font-weight:900 !important;
  border-radius:18px !important;
  background:rgba(255,255,255,.025) !important;
  border:1px dashed rgba(255,255,255,.09) !important;
}

body.ua-shell-chrome:not(.ua-page-dashboard).ua-page-window-min .ua-wm-pane.is-current{
  display:none !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard).ua-page-window-max .ua-unified-shell-block{
  margin-inline-start:16px !important;
  margin-inline-end:16px !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard).ua-page-window-max .ua-main{
  margin-inline-start:16px !important;
  margin-inline-end:16px !important;
}

/* Golden navigator: cloned from dashboard dimensions, but bounded under the shell controls. */
html:has(body.ua-shell-chrome:not(.ua-page-dashboard)),
body.ua-shell-chrome:not(.ua-page-dashboard){
  scrollbar-width:none !important;
}
html:has(body.ua-shell-chrome:not(.ua-page-dashboard))::-webkit-scrollbar,
body.ua-shell-chrome:not(.ua-page-dashboard)::-webkit-scrollbar{
  width:0 !important;
  height:0 !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav{
  position:fixed !important;
  top:0 !important;
  bottom:0 !important;
  right:calc(var(--ua-wm-sidebar-w) + 4px) !important;
  width:var(--ua-wm-gold-w) !important;
  z-index:120 !important;
  display:block !important;
  border:0 !important;
  border-radius:0 !important;
  pointer-events:auto !important;
  opacity:1 !important;
  touch-action:none !important;
  background:linear-gradient(180deg,
    rgba(94,58,10,.06) 0%,
    rgba(166,111,22,.20) 16%,
    rgba(219,151,42,.32) 50%,
    rgba(166,111,22,.20) 84%,
    rgba(94,58,10,.06) 100%) !important;
  box-shadow:0 0 10px rgba(255,180,58,.16), inset 0 0 12px rgba(255,205,96,.10) !important;
}
html[dir="ltr"] body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav{
  right:auto !important;
  left:calc(var(--ua-wm-sidebar-w) + 4px) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav::before,
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-track{
  content:"" !important;
  position:absolute !important;
  left:50% !important;
  top:0 !important;
  bottom:0 !important;
  transform:translateX(-50%) !important;
  width:14px !important;
  border:0 !important;
  border-radius:0 !important;
  background:linear-gradient(180deg,
    rgba(255,221,128,.10),
    rgba(245,178,62,.34),
    rgba(169,101,22,.24),
    rgba(245,178,62,.34),
    rgba(255,221,128,.10)) !important;
  box-shadow:0 0 14px rgba(255,190,66,.18), inset 0 0 10px rgba(255,226,143,.10) !important;
  pointer-events:none !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-thumb{
  position:absolute !important;
  left:50% !important;
  right:auto !important;
  top:0 !important;
  margin:0 !important;
  transform:translateX(-50%) translateY(0) !important;
  z-index:2 !important;
  width:3px !important;
  min-height:120px !important;
  border:0 !important;
  border-radius:0 !important;
  cursor:grab !important;
  background:linear-gradient(180deg,rgba(255,235,160,.98),rgba(255,197,69,.98),rgba(210,132,28,.98),rgba(255,215,112,.96)) !important;
  box-shadow:0 0 5px rgba(255,210,94,.55),0 0 13px rgba(222,145,35,.32),0 0 1px rgba(255,244,198,.90) inset !important;
  animation:uaWmGoldScrollGlow 2.6s ease-in-out infinite !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-thumb:active{cursor:grabbing !important;}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav.is-hidden{display:none !important;}
@keyframes uaWmGoldScrollGlow{
  0%,100%{filter:brightness(1.02); box-shadow:0 0 5px rgba(255,210,94,.55),0 0 13px rgba(222,145,35,.32),0 0 1px rgba(255,244,198,.90) inset;}
  50%{filter:brightness(1.16); box-shadow:0 0 7px rgba(255,222,112,.70),0 0 17px rgba(238,159,42,.44),0 0 2px rgba(255,246,205,.96) inset;}
}

/* Popup/iframe pages must be clean and never show shell chrome. */
body.ua-popup-mode .ua-sb3,
body.ua-popup-mode .ua-sb-backdrop,
body.ua-popup-mode .ua-unified-shell-block,
body.ua-popup-mode .ua-shell-scroll-nav{
  display:none !important;
}
body.ua-popup-mode .ua-main,
body.ua-popup-mode .ua-page{
  margin:0 !important;
  padding:0 !important;
  width:100% !important;
  max-width:100% !important;
}

@media (max-width:900px){
  body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav{display:none !important;}
  body.ua-shell-chrome:not(.ua-page-dashboard) .ua-unified-shell-block,
  html[dir="ltr"] body.ua-shell-chrome:not(.ua-page-dashboard) .ua-unified-shell-block{
    margin-inline:12px !important;
  }
}


/* Dashboard uses the same window manager engine, but with its own compact strip inside dashboard.php. */
body.ua-page-dashboard .ua-wm-stage--dashboard{
  width:100% !important;
  min-width:0 !important;
  display:block !important;
}
body.ua-page-dashboard .ua-wm-stage--dashboard .ua-wm-pane{
  width:100% !important;
  min-width:0 !important;
  display:block !important;
}
body.ua-page-dashboard .ua-wm-stage--dashboard .ua-wm-pane[hidden],
body.ua-page-dashboard .ua-wm-stage--dashboard .ua-wm-pane.is-minimized{
  display:none !important;
}
body.ua-page-dashboard .ua-wm-stage--dashboard .ua-wm-iframe{
  display:block !important;
  width:100% !important;
  min-width:0 !important;
  min-height:var(--ua-contract-workspace-h, calc(100dvh - 205px)) !important;
  border:0 !important;
  background:transparent !important;
  border-radius:16px !important;
  overflow:hidden !important;
}
body.ua-page-dashboard .ua-wm-stage--dashboard .ua-wm-empty{
  display:grid !important;
  place-items:center !important;
  min-height:calc(100vh - 230px) !important;
  color:var(--ua-sem-muted) !important;
  font-weight:900 !important;
  border-radius:18px !important;
  background:rgba(255,255,255,.025) !important;
  border:1px dashed rgba(255,255,255,.09) !important;
}

/* 2026-05-06: fixed dashboard shortcut inside normal pages windowbar. */
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab--dashboard{
  min-width:132px !important;
  border-color:rgba(92,218,255,.18) !important;
  background:linear-gradient(180deg, rgba(40,178,205,.15), rgba(40,178,205,.055)) !important;
  color:#eefbff !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab--dashboard i{
  color:#6fe0ff !important;
  opacity:1 !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab--dashboard:hover{
  border-color:rgba(92,218,255,.34) !important;
  background:linear-gradient(180deg, rgba(40,178,205,.24), rgba(40,178,205,.085)) !important;
}

/* 2026-05-06 final: current page title is shown once; keep dashboard shortcut first from RTL side. */
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-windowbar__pages{
  direction:rtl !important;
  justify-content:flex-start !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab--dashboard{
  order:-999 !important;
  border-color:rgba(92,218,255,.18) !important;
  background:linear-gradient(180deg, rgba(44,188,211,.14), rgba(44,188,211,.055)) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-page-tab--dashboard i{
  color:#7ee5ff !important;
}


/* Unified dashboard windowbar uses the same classes as normal pages. */
body.ua-page-dashboard .ua-page-windowbar--dashboard{display:flex !important;}
body.ua-page-dashboard .ua-page-windowbar--dashboard .ua-page-windowbar__title{display:none !important;}
body.ua-page-dashboard .ua-page-windowbar--dashboard .ua-page-windowbar__pages{display:flex !important;direction:rtl !important;gap:6px !important;overflow-x:auto !important;overflow-y:hidden !important;scrollbar-width:none !important;}
body.ua-page-dashboard .ua-page-windowbar--dashboard .ua-page-windowbar__pages::-webkit-scrollbar{display:none !important;}
body.ua-page-dashboard .ua-page-windowbar--dashboard .ua-page-tab{height:28px !important;display:inline-flex !important;align-items:center !important;gap:7px !important;white-space:nowrap !important;overflow:hidden !important;text-overflow:ellipsis !important;border:1px solid var(--ua-ds-line)!important;background:color-mix(in srgb,var(--ua-theme-input) 82%,transparent)!important;color:var(--ua-ds-title)!important;}


/* 2026-05-07 final shell navigator guard: do not cover the top bars. */
body.ua-shell-chrome:not(.ua-page-dashboard){
  --ua-wm-gold-w:18px;
  --ua-wm-gold-gap:7px;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav{
  top:116px !important;
  bottom:12px !important;
  width:18px !important;
  right:calc(var(--ua-wm-sidebar-w) + 4px) !important;
  z-index:80 !important;
  overflow:hidden !important;
}
html[dir="ltr"] body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav{
  right:auto !important;
  left:calc(var(--ua-wm-sidebar-w) + 4px) !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav::before,
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-track{
  width:12px !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-thumb{
  width:3px !important;
  min-height:92px !important;
}


/* 2026-05-07 final: soft close buttons on tabs + navigator full-height polish. */
.ua-page-tab__close{
  width:16px !important;
  height:16px !important;
  min-width:16px !important;
  border-radius:999px !important;
  display:inline-flex !important;
  align-items:center !important;
  justify-content:center !important;
  margin-inline-start:3px !important;
  color:var(--ua-sem-muted) !important;
  font-size:12px !important;
  line-height:1 !important;
  background:transparent !important;
  border:0 !important;
  opacity:.58 !important;
  transition:opacity .14s ease, background .14s ease, color .14s ease !important;
}
.ua-page-tab:hover .ua-page-tab__close{opacity:.95 !important;}
.ua-page-tab__close:hover{color:var(--ua-sem-on-accent) !important;background:var(--ua-sem-danger) !important;}
body.ua-page-dashboard .nocx-topbar--control > .nocx-topbar__actions{flex:1 1 0 !important;}
body.ua-page-dashboard .nocx-topbar__actions > .ua-page-windowbar--dashboard{flex:1 1 0 !important;min-width:0 !important;max-width:none !important;}
body.ua-page-dashboard .ua-page-windowbar--dashboard .ua-page-windowbar__pages{flex:1 1 0 !important;min-width:0 !important;}

.ua-wm-context-menu{
  position:fixed;
  z-index:2147483000;
  width:210px;
  max-width:calc(100vw - 16px);
  padding:7px;
  border:1px solid rgba(255,214,79,.28);
  border-radius:11px;
  background:rgba(7,20,34,.97);
  box-shadow:0 18px 48px rgba(0,0,0,.48);
  color:#eef5ff;
  direction:rtl;
  text-align:right;
  backdrop-filter:blur(16px);
  -webkit-backdrop-filter:blur(16px);
}
.ua-wm-context-menu__title{
  padding:7px 9px 9px;
  margin-bottom:5px;
  border-bottom:1px solid rgba(255,255,255,.08);
  overflow:hidden;
  color:#dbe8f5;
  font-size:11px;
  font-weight:800;
  text-overflow:ellipsis;
  white-space:nowrap;
}
.ua-wm-context-menu__close{
  width:100%;
  min-height:36px;
  display:flex;
  align-items:center;
  gap:9px;
  justify-content:flex-start;
  padding:8px 10px;
  border:0;
  border-radius:8px;
  background:transparent;
  color:#ffd2d6;
  font:inherit;
  font-size:12px;
  font-weight:800;
  cursor:pointer;
}
.ua-wm-context-menu__close:hover,
.ua-wm-context-menu__close:focus-visible{
  outline:0;
  background:#b92533;
  color:#fff;
}
body.ua-shell-chrome:not(.ua-page-dashboard) #uaShellScrollNav,
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav,
body.ua-shell-chrome:not(.ua-page-dashboard) .nocx-gold-scrollbar{bottom:0 !important;height:auto !important;}
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav.is-hidden,
body.ua-shell-chrome:not(.ua-page-dashboard) .nocx-gold-scrollbar.is-hidden{display:none !important;pointer-events:none !important;}

/* 2026-05-07 real centered golden grip: compute from rail width, no RTL/LTR offset drift. */
body.ua-shell-chrome:not(.ua-page-dashboard) #uaShellScrollThumb,
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav .ua-shell-scroll-thumb,
body.ua-shell-chrome:not(.ua-page-dashboard) .nocx-gold-scrollbar .nocx-gold-scrollbar__thumb{
  width:3px !important;
  left:calc((100% - 3px) / 2) !important;
  right:auto !important;
  inset-inline-start:auto !important;
  inset-inline-end:auto !important;
  margin:0 !important;
  transform:translateY(0px) !important;
  transform-origin:50% 0 !important;
}


/* 2026-05-07 scrollbar correction: keep rail below the shell bars and center grip horizontally. */
body.ua-shell-chrome:not(.ua-page-dashboard){
  --ua-shell-gold-top:116px !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) #uaShellScrollNav,
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav,
body.ua-shell-chrome:not(.ua-page-dashboard) .nocx-gold-scrollbar{
  top:var(--ua-shell-gold-top,116px) !important;
  bottom:0 !important;
  height:auto !important;
}
body.ua-shell-chrome:not(.ua-page-dashboard) #uaShellScrollThumb,
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav .ua-shell-scroll-thumb,
body.ua-shell-chrome:not(.ua-page-dashboard) .nocx-gold-scrollbar .nocx-gold-scrollbar__thumb{
  left:50% !important;
  right:auto !important;
  inset-inline-start:auto !important;
  inset-inline-end:auto !important;
  margin:0 !important;
  transform:translateX(-50%) translateY(0px) !important;
  transform-origin:50% 0 !important;
}

/* 2026-05-07 definitive fix: center golden scroll thumb by auto margins. */
body.ua-shell-chrome:not(.ua-page-dashboard) #uaShellScrollThumb,
body.ua-shell-chrome:not(.ua-page-dashboard) .ua-shell-scroll-nav .ua-shell-scroll-thumb,
body.ua-shell-chrome:not(.ua-page-dashboard) .nocx-gold-scrollbar .nocx-gold-scrollbar__thumb{
  width:3px !important;
  left:0 !important;
  right:0 !important;
  inset-inline-start:0 !important;
  inset-inline-end:0 !important;
  margin-left:auto !important;
  margin-right:auto !important;
  margin-inline-start:auto !important;
  margin-inline-end:auto !important;
  transform:translateY(0px) !important;
  transform-origin:50% 0 !important;
}
