/* v5: original header geometry + one-piece animated device accordion + invisible collection scrollbar. */

/* Header: preserve the established layout. Only the X glyph itself is redrawn. */
.collection-head{
  display:block!important;
  position:relative!important;
  padding-right:118px!important;
}
.collection-head .collection-select-toggle{
  position:absolute!important;
  top:-12px!important;
  right:68px!important;
  bottom:auto!important;
  left:auto!important;
  transform:none!important;
  margin:0!important;
  order:initial!important;
  grid-column:auto!important;
}
#collectionClose.collection-close{
  position:absolute!important;
  top:-12px!important;
  right:15px!important;
  bottom:auto!important;
  left:auto!important;
  transform:none!important;
  margin:0!important;
  order:initial!important;
  grid-column:auto!important;
  padding:0!important;
  display:grid!important;
  place-items:center!important;
  font-size:0!important;
  line-height:1!important;
}
#collectionClose.collection-close::before,
#collectionClose.collection-close::after{
  content:""!important;
  position:absolute!important;
  left:50%!important;
  top:50%!important;
  width:13px!important;
  height:2px!important;
  margin:0!important;
  border:0!important;
  border-radius:999px!important;
  background:currentColor!important;
  transform-origin:50% 50%!important;
  pointer-events:none!important;
}
#collectionClose.collection-close::before{transform:translate(-50%,-50%) rotate(45deg)!important}
#collectionClose.collection-close::after{transform:translate(-50%,-50%) rotate(-45deg)!important}

/* The bottom sheet keeps scrolling, but never reserves visible scrollbar width. */
.collection-body{
  scrollbar-width:none!important;
  -ms-overflow-style:none!important;
  scrollbar-gutter:auto!important;
}
.collection-body::-webkit-scrollbar{
  width:0!important;
  height:0!important;
  display:none!important;
}

/* One visual owner for the accordion. The parent owns every outer edge.
   The trigger row never paints its own rounded rectangle, so opening cannot
   leave the old closed-state card visible inside a second shell. */
.collection-device-accordion{
  display:grid!important;
  grid-template-columns:minmax(0,1fr)!important;
  gap:0!important;
  width:100%!important;
  overflow:hidden!important;
  border:1px solid rgba(28,40,65,.055)!important;
  border-radius:18px!important;
  background:#fff!important;
  color:#292b30!important;
  transition:border-color .18s ease,background-color .18s ease,box-shadow .18s ease!important;
}
html[data-theme="dark"] .collection-device-accordion{
  background:var(--v36-dark-surface,#171b21)!important;
  color:var(--v36-dark-text,#f2f4f8)!important;
  border-color:var(--v36-dark-line,rgba(255,255,255,.085))!important;
}

#collectionDeviceLink[data-device-safe-v2="true"]{
  position:relative!important;
  width:100%!important;
  margin:0!important;
  border:0!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  cursor:pointer!important;
  transition:background-color .16s ease!important;
}
#collectionDeviceLink[data-device-safe-v2="true"]:hover{
  background:rgba(77,91,116,.035)!important;
}
html[data-theme="dark"] #collectionDeviceLink[data-device-safe-v2="true"]:hover{
  background:rgba(255,255,255,.025)!important;
}
#collectionDeviceLink[data-device-safe-v2="true"]>.collection-device-chevron{
  display:inline-block!important;
  flex:0 0 auto!important;
  transform:rotate(0deg)!important;
  transform-origin:50% 50%!important;
  transition:transform .24s cubic-bezier(.22,.74,.24,1)!important;
}
.collection-device-accordion.is-device-expanded #collectionDeviceLink[data-device-safe-v2="true"]>.collection-device-chevron{
  transform:rotate(90deg)!important;
}

/* Accordion body rolls down from the trigger instead of popping in. */
.collection-device-panel-v2{
  display:grid!important;
  gap:13px!important;
  width:100%!important;
  max-height:0!important;
  margin:0!important;
  padding:0 14px!important;
  box-sizing:border-box!important;
  overflow:hidden!important;
  border:0!important;
  border-top:1px solid transparent!important;
  border-radius:0!important;
  background:transparent!important;
  box-shadow:none!important;
  opacity:0!important;
  transform:translateY(-8px)!important;
  visibility:hidden!important;
  pointer-events:none!important;
  transition:
    max-height .34s cubic-bezier(.22,.74,.24,1),
    padding .28s cubic-bezier(.22,.74,.24,1),
    opacity .20s ease,
    transform .30s cubic-bezier(.22,.74,.24,1),
    border-color .22s ease,
    visibility 0s linear .34s!important;
}
.collection-device-panel-v2[hidden]{display:grid!important}
.collection-device-accordion.is-device-expanded .collection-device-panel-v2{
  max-height:330px!important;
  padding:14px!important;
  border-top-color:rgba(92,105,128,.10)!important;
  opacity:1!important;
  transform:translateY(0)!important;
  visibility:visible!important;
  pointer-events:auto!important;
  transition:
    max-height .36s cubic-bezier(.22,.74,.24,1),
    padding .30s cubic-bezier(.22,.74,.24,1),
    opacity .22s ease .04s,
    transform .32s cubic-bezier(.22,.74,.24,1),
    border-color .22s ease,
    visibility 0s!important;
}
html[data-theme="dark"] .collection-device-accordion.is-device-expanded .collection-device-panel-v2{
  border-top-color:rgba(255,255,255,.065)!important;
}

.collection-device-panel__current{
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:12px!important;
  min-width:0!important;
  padding:0!important;
  border:0!important;
  background:transparent!important;
}
.collection-device-panel__current-copy{
  min-width:0!important;
  display:grid!important;
  gap:4px!important;
}
.collection-device-panel__current-copy small,
.collection-device-panel__group>label{
  color:var(--muted,#737c88)!important;
  font-size:11px!important;
  font-weight:760!important;
  line-height:1.3!important;
}
.collection-device-panel__current-copy code{
  display:block!important;
  min-width:0!important;
  overflow:hidden!important;
  text-overflow:ellipsis!important;
  white-space:nowrap!important;
  color:inherit!important;
  font:650 12px/1.45 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace!important;
  letter-spacing:.015em!important;
}

.collection-device-panel-v2 .collection-device-copy{
  flex:0 0 auto!important;
  min-height:34px!important;
  padding:0 11px!important;
  border:1px solid rgba(74,88,112,.12)!important;
  border-radius:10px!important;
  background:rgba(69,83,108,.055)!important;
  color:inherit!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.58)!important;
  font:760 11px/1 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  cursor:pointer!important;
}
html[data-theme="dark"] .collection-device-panel-v2 .collection-device-copy{
  background:var(--v36-dark-surface-3,#20252d)!important;
  border-color:rgba(255,255,255,.075)!important;
  color:#c6cdd7!important;
  box-shadow:inset 0 1px 0 rgba(255,255,255,.03)!important;
}

.collection-device-panel__divider{
  height:1px!important;
  background:rgba(100,111,128,.10)!important;
}
html[data-theme="dark"] .collection-device-panel__divider{background:rgba(255,255,255,.06)!important}

.collection-device-panel__group{
  display:grid!important;
  gap:7px!important;
}
.collection-device-panel__hint{
  margin:0 0 2px!important;
  color:var(--muted,#737c88)!important;
  font-size:11px!important;
  line-height:1.45!important;
}
.collection-device-panel__connect-row{
  display:grid!important;
  grid-template-columns:minmax(0,1fr) auto!important;
  gap:8px!important;
}
.collection-device-panel-v2 input{
  width:100%!important;
  min-width:0!important;
  height:40px!important;
  box-sizing:border-box!important;
  border:1px solid rgba(92,105,128,.14)!important;
  border-radius:11px!important;
  background:rgba(255,255,255,.76)!important;
  color:inherit!important;
  padding:0 12px!important;
  font:500 12px/1.2 ui-monospace,SFMono-Regular,Menlo,Consolas,monospace!important;
  outline:none!important;
}
html[data-theme="dark"] .collection-device-panel-v2 input{
  background:#12171e!important;
  border-color:rgba(255,255,255,.085)!important;
}
.collection-device-panel-v2 input:focus{
  border-color:rgba(66,112,205,.46)!important;
  box-shadow:0 0 0 3px rgba(66,112,205,.09)!important;
}

.collection-device-panel-v2 .collection-device-connect{
  min-height:40px!important;
  padding:0 14px!important;
  border:1px solid rgba(255,255,255,.30)!important;
  border-radius:11px!important;
  background:linear-gradient(180deg,var(--v36-blue-top,#6598ef),var(--v36-blue-bottom,#3568d4))!important;
  color:#fff!important;
  box-shadow:0 4px 10px rgba(42,91,185,.12),inset 0 1px 0 rgba(255,255,255,.24)!important;
  font:760 12px/1 system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif!important;
  cursor:pointer!important;
}
.collection-device-panel__status{
  min-height:0!important;
  color:var(--muted,#737c88)!important;
  font-size:11px!important;
  line-height:1.45!important;
}
.collection-device-panel__status:empty{display:none!important}
.collection-device-panel__status.is-error{display:block!important;color:#df5e62!important}

@media(max-width:560px){
  .collection-device-accordion.is-device-expanded .collection-device-panel-v2{max-height:430px!important;padding:13px!important}
  .collection-device-panel__connect-row{grid-template-columns:1fr!important}
  .collection-device-panel-v2 .collection-device-connect{width:100%!important}
}

@media(prefers-reduced-motion:reduce){
  .collection-device-panel-v2,
  #collectionDeviceLink[data-device-safe-v2="true"]>.collection-device-chevron{
    transition:none!important;
  }
}
