/* v66 — stable scroll behaviour for blog editor sidebar cards.
   Goal: each card owns its small internal scrollbar so opening Annotations
   does not deform the surrounding cards. */
.blog-side-panel{
  overflow-y:auto;
  scrollbar-width:thin;
  scrollbar-color:rgba(107,44,255,.28) transparent;
}
.blog-side-panel::-webkit-scrollbar,
.blog-tool-body::-webkit-scrollbar,
.annotation-list::-webkit-scrollbar,
.mini-loop-chat::-webkit-scrollbar{
  width:5px;
  height:5px;
}
.blog-side-panel::-webkit-scrollbar-track,
.blog-tool-body::-webkit-scrollbar-track,
.annotation-list::-webkit-scrollbar-track,
.mini-loop-chat::-webkit-scrollbar-track{
  background:transparent;
}
.blog-side-panel::-webkit-scrollbar-thumb,
.blog-tool-body::-webkit-scrollbar-thumb,
.annotation-list::-webkit-scrollbar-thumb,
.mini-loop-chat::-webkit-scrollbar-thumb{
  background:rgba(107,44,255,.30);
  border-radius:999px;
}
.blog-side-panel::-webkit-scrollbar-thumb:hover,
.blog-tool-body::-webkit-scrollbar-thumb:hover,
.annotation-list::-webkit-scrollbar-thumb:hover,
.mini-loop-chat::-webkit-scrollbar-thumb:hover{
  background:rgba(107,44,255,.46);
}

.blog-tool-card{
  flex:0 0 auto;
  overflow:hidden;
}
.blog-tool-card.is-open{
  display:flex;
  flex-direction:column;
  min-height:0!important;
  max-height:min(430px,52dvh)!important;
}
.blog-tool-card.is-open .blog-tool-header{
  flex:0 0 auto;
  position:relative!important;
  top:auto!important;
  z-index:6;
  background:#fff;
}
.blog-tool-card.is-open .blog-tool-body{
  display:block;
  min-height:0!important;
  max-height:min(340px,42dvh)!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding:12px 18px 16px!important;
  scrollbar-width:thin;
  scrollbar-color:rgba(107,44,255,.30) transparent;
}

/* Annotations keeps its own compact structure instead of stretching the sidebar. */
.blog-tool-card[data-accordion-card="annotations"].is-open{
  height:auto!important;
  min-height:0!important;
  max-height:min(470px,56dvh)!important;
}
.blog-tool-card[data-accordion-card="annotations"].is-open .blog-tool-body{
  display:flex!important;
  flex-direction:column!important;
  gap:10px;
  max-height:min(390px,46dvh)!important;
  overflow:hidden!important;
}
.annotation-control-row{
  position:relative!important;
  top:auto!important;
  z-index:4;
  flex:0 0 auto;
  background:#fff;
  padding:0 0 6px!important;
}
.annotation-inline-popover{
  flex:0 0 auto;
}
.annotation-list{
  flex:1 1 auto!important;
  min-height:160px;
  max-height:none!important;
  overflow-y:auto!important;
  overflow-x:hidden!important;
  padding-right:5px!important;
  scrollbar-width:thin;
  scrollbar-color:rgba(107,44,255,.30) transparent;
}

/* Other cards get the same premium scroll treatment when their content grows. */
.blog-tool-card[data-accordion-card="loop"].is-open .blog-tool-body,
.blog-tool-card[data-accordion-card="snapshot"].is-open .blog-tool-body,
.blog-tool-card[data-accordion-card="cowrite"].is-open .blog-tool-body{
  max-height:min(320px,40dvh)!important;
}
.mini-loop-chat{
  max-height:150px!important;
  overflow-y:auto!important;
  scrollbar-width:thin;
  scrollbar-color:rgba(107,44,255,.30) transparent;
}

/* Fullscreen/focus mode must not inherit compact card limits. */
.blog-editor-shell.is-blog-card-expanded .blog-tool-card.is-blog-card-focused,
.blog-editor-shell.is-tool-fullscreen .blog-tool-card.is-focused-card{
  max-height:none!important;
  height:100%!important;
}
.blog-editor-shell.is-blog-card-expanded .blog-tool-card.is-blog-card-focused .blog-tool-body,
.blog-editor-shell.is-tool-fullscreen .blog-tool-card.is-focused-card .blog-tool-body{
  max-height:none!important;
  overflow-y:auto!important;
  padding:18px!important;
}
.blog-editor-shell.is-blog-card-expanded .blog-tool-card.is-blog-card-focused[data-accordion-card="annotations"] .blog-tool-body,
.blog-editor-shell.is-tool-fullscreen .blog-tool-card.is-focused-card[data-accordion-card="annotations"] .blog-tool-body{
  overflow:hidden!important;
}
.blog-editor-shell.is-blog-card-expanded .blog-tool-card.is-blog-card-focused[data-accordion-card="annotations"] .annotation-list,
.blog-editor-shell.is-tool-fullscreen .blog-tool-card.is-focused-card[data-accordion-card="annotations"] .annotation-list{
  min-height:0!important;
  max-height:none!important;
}

@media(max-width:1040px){
  .blog-tool-card.is-open{max-height:none!important;}
  .blog-tool-card.is-open .blog-tool-body{max-height:min(360px,48dvh)!important;}
  .blog-tool-card[data-accordion-card="annotations"].is-open .blog-tool-body{max-height:min(420px,58dvh)!important;}
}
@media(max-width:760px){
  .blog-tool-card.is-open .blog-tool-body{padding:10px 12px 14px!important;}
  .blog-tool-card[data-accordion-card="annotations"].is-open .blog-tool-body{max-height:min(390px,60dvh)!important;}
  .annotation-control-row{grid-template-columns:1fr!important;gap:7px!important;}
  .annotation-add-btn{width:100%;justify-content:center;}
  .annotation-list{min-height:150px;}
}
