/* 062D: V2 session manager, adapted for the V1 Xiaobei left chat rail. */
#xbRailActions .xb-rail-actions-title.has-session-manager {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
}

.chat-status.has-session-manager {
  position: relative;
  z-index: 60;
  overflow: visible;
  padding: 8px 10px;
}

.chat-status.has-session-manager .wb-session-manager {
  width: 100%;
}

.wb-session-manager {
  position: relative;
  min-width: 0;
  justify-self: stretch;
}

.wb-session-controls {
  display: flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  width: 100%;
}

.wb-session-new,
.wb-session-current {
  height: 28px;
  border: 1px solid rgba(184, 115, 51, .24);
  border-radius: 999px;
  background: rgba(255, 247, 234, .9);
  color: #3a2618;
  font-size: 11.5px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(32, 56, 51, .05);
}

.wb-session-new {
  flex: 0 0 auto;
  padding: 0 8px;
}

.wb-session-current {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  padding: 0 8px 0 10px;
  background: linear-gradient(135deg, rgba(255, 250, 240, .96), rgba(255, 241, 223, .9));
}

.wb-session-current span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-session-current i {
  flex: 0 0 auto;
  color: #7a5636;
  font-style: normal;
  font-weight: 900;
}

.wb-session-new:hover,
.wb-session-current:hover,
.wb-session-current[aria-expanded="true"] {
  border-color: rgba(184, 115, 51, .42);
  background: #fff0d8;
}

.wb-session-menu {
  position: absolute;
  top: 34px;
  left: 0;
  z-index: 70;
  width: min(326px, calc(100vw - 32px));
  padding: 9px;
  border: 1px solid rgba(184, 115, 51, .22);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 250, 240, .98), rgba(255, 246, 231, .97));
  box-shadow: 0 18px 45px rgba(61, 38, 24, .18);
  backdrop-filter: blur(14px);
}

.wb-session-menu[hidden] {
  display: none !important;
}

.wb-session-menu header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 8px;
  padding: 1px 3px 8px;
}

.wb-session-menu header strong {
  color: #3a2618;
  font-size: 12.5px;
}

.wb-session-menu header small {
  color: #7a5636;
  font-size: 10.5px;
  font-weight: 800;
  white-space: nowrap;
}

.wb-session-list {
  display: grid;
  gap: 6px;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.wb-session-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  min-width: 0;
  border: 1px solid rgba(184, 115, 51, .16);
  border-radius: 13px;
  background: rgba(255, 253, 248, .74);
  overflow: visible;
}

.wb-session-row.active {
  border-color: rgba(184, 115, 51, .38);
  background: #fff1df;
}

.wb-session-row.open {
  z-index: 2;
}

.wb-session-item {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px;
  padding: 8px 0 8px 9px;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.wb-session-item strong,
.wb-session-item span,
.wb-session-item small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wb-session-item strong {
  color: #3a2618;
  font-size: 12.5px;
}

.wb-session-item span,
.wb-session-item small {
  color: #7a5636;
  font-size: 10.8px;
}

.wb-session-item span {
  justify-self: end;
  max-width: 112px;
}

.wb-session-item small {
  grid-column: 1 / -1;
}

.wb-session-more {
  width: 24px;
  height: 24px;
  margin-right: 6px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #7a5636;
  font-size: 15px;
  font-weight: 900;
  letter-spacing: -2px;
  line-height: 1;
  cursor: pointer;
}

.wb-session-more:hover,
.wb-session-row.open .wb-session-more {
  background: rgba(184, 115, 51, .12);
  color: #3a2618;
}

.wb-session-actions {
  position: absolute;
  top: 30px;
  right: 6px;
  z-index: 90;
  width: 104px;
  padding: 5px;
  border: 1px solid rgba(184, 115, 51, .18);
  border-radius: 12px;
  background: #fff9ef;
  box-shadow: 0 14px 34px rgba(61, 38, 24, .16);
  display: grid;
  gap: 4px;
}

.wb-session-actions.rename {
  width: 178px;
}

.wb-session-rename-input {
  width: 100%;
  min-width: 0;
  height: 30px;
  padding: 0 9px;
  border: 1px solid rgba(184, 115, 51, .28);
  border-radius: 9px;
  background: #fffdf8;
  color: #3a2618;
  font-size: 12px;
  font-weight: 800;
  outline: 0;
}

.wb-session-rename-input:focus {
  border-color: rgba(184, 115, 51, .55);
  box-shadow: 0 0 0 3px rgba(184, 115, 51, .12);
}

.wb-session-rename-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.wb-session-actions button {
  border: 0;
  border-radius: 9px;
  background: transparent;
  padding: 7px 8px;
  color: #3a2618;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.wb-session-actions button:hover {
  background: rgba(184, 115, 51, .12);
  color: #3a2618;
}

.wb-session-actions button[data-wb-session-action="delete"] {
  color: #9c3c2e;
}

.wb-session-actions button[data-wb-session-action="delete"]:hover {
  background: #fff1ee;
}

@media (max-width: 900px) {
  #xbRailActions .xb-rail-actions-title.has-session-manager {
    grid-template-columns: auto minmax(0, 1fr);
  }

  #xbRailActions .xb-rail-actions-title.has-session-manager > .btn {
    display: none;
  }
}
