/* YNS Yavuz Unified Layout Authority v1310
   Loaded last. Owns desktop/sidebar geometry and collision-proof chat roles. */
:root{
  --yv1310-sidebar:var(--v525-sidebar-w,238px);
  --yv1310-mobile-header:calc(62px + env(safe-area-inset-top));
}

html,body{margin:0!important;min-width:0!important}
body.admin-shell{display:block!important;min-height:100dvh!important;overflow-x:hidden!important}

/* Desktop: the sidebar is never allowed to participate in document flow. */
@media (min-width:1181px){
  html body.admin-shell>aside.sidebar[data-sidebar]{
    position:fixed!important;
    inset:0 auto 0 0!important;
    left:0!important;top:0!important;bottom:0!important;
    float:none!important;clear:none!important;
    display:flex!important;
    width:var(--yv1310-sidebar)!important;
    height:100dvh!important;min-height:100dvh!important;max-height:100dvh!important;
    margin:0!important;
    transform:none!important;
    overflow-x:hidden!important;overflow-y:auto!important;
    overscroll-behavior:contain!important;
    z-index:300!important;
  }
  html body.admin-shell>main.main{
    position:relative!important;
    inset:auto!important;
    float:none!important;clear:none!important;
    display:block!important;
    margin:0 0 0 var(--yv1310-sidebar)!important;
    width:calc(100% - var(--yv1310-sidebar))!important;
    max-width:none!important;
    min-width:0!important;
    min-height:100dvh!important;
    padding-top:22px!important;
    overflow:visible!important;
  }
  html body.admin-shell.page-yavuz>main.main{
    display:flex!important;
    flex-direction:column!important;
    height:100dvh!important;
    min-height:100dvh!important;
    overflow:hidden!important;
    padding-bottom:0!important;
  }
  html body.admin-shell>.mobile-top,
  html body.admin-shell>.shell-overlay,
  html body.admin-shell>.v1000-mobile-dock{display:none!important}
}

/* Tablet / mobile: sidebar is an off-canvas layer, never a content block. */
@media (max-width:1180px){
  html body.admin-shell>aside.sidebar[data-sidebar]{
    position:fixed!important;
    inset:0 auto 0 0!important;
    left:0!important;top:0!important;bottom:0!important;
    float:none!important;clear:none!important;
    width:min(88vw,340px)!important;
    height:100dvh!important;max-height:100dvh!important;
    margin:0!important;
    transform:translate3d(-105%,0,0)!important;
    overflow-y:auto!important;
    z-index:310!important;
  }
  html body.admin-shell>aside.sidebar[data-sidebar].open{transform:translate3d(0,0,0)!important}
  html body.admin-shell>main.main{
    position:relative!important;
    float:none!important;clear:none!important;
    margin:0!important;
    width:100%!important;max-width:none!important;min-width:0!important;
  }
  html body.admin-shell.page-yavuz{overflow:auto!important}
  html body.admin-shell.page-yavuz>main.main{height:auto!important;min-height:100dvh!important;overflow:visible!important;padding-bottom:82px!important}
  html body.admin-shell>.mobile-top{display:flex!important;position:fixed!important;inset:0 0 auto 0!important;z-index:290!important}
  html body.admin-shell>.shell-overlay{position:fixed!important;inset:0!important;z-index:300!important}
}

/* Old theme has a global `.user{display:none!important}` rule. Chat roles never use it. */
.yv13-message[data-role="user"],
.yv13-message.role-user{
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
  align-self:flex-end!important;
  flex-direction:row-reverse!important;
}
.yv13-message[data-role="assistant"],
.yv13-message.role-assistant{
  display:flex!important;
  visibility:visible!important;
  opacity:1!important;
  align-self:flex-start!important;
}
.yv13-message.role-user .yv13-message-body,
.yv13-message[data-role="user"] .yv13-message-body{
  border-radius:17px 17px 5px 17px!important;
  background:linear-gradient(135deg,rgba(58,111,218,.38),rgba(77,64,187,.32))!important;
  border-color:rgba(116,151,232,.27)!important;
}
.yv13-message.role-user .yv13-message-avatar,
.yv13-message[data-role="user"] .yv13-message-avatar{
  background:linear-gradient(135deg,#3478e8,#18a5cb)!important;
}
.yv13-message.role-user .yv13-message-meta,
.yv13-message[data-role="user"] .yv13-message-meta{justify-content:flex-end!important}

/* Prevent a stale global user selector from hiding the topbar identity only where desired. */
.yv13-message .yv13-message-body,.yv13-message .yv13-message-content{min-width:0!important}

@media(max-width:720px){
  body.admin-shell.page-yavuz>main.main{
    padding:var(--yv1310-mobile-header) 7px calc(78px + env(safe-area-inset-bottom))!important;
    min-height:100svh!important;height:auto!important;overflow:visible!important;
  }
  body.admin-shell>.mobile-top{height:var(--yv1310-mobile-header)!important;padding:calc(8px + env(safe-area-inset-top)) 11px 8px!important}
}
