/* Drawer v2: the history rail owns scrolling; controls stay in a compact dock. */
.drawer-panel {
  grid-template-rows: auto auto minmax(112px, 1fr) auto;
  gap: 10px;
  overflow: hidden;
}

.drawer-head {
  padding-bottom: 2px;
}

.drawer-new {
  min-height: 64px;
}

.drawer-history {
  position: relative;
  z-index: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid rgba(72, 96, 128, .09);
  border-radius: 20px;
  background: rgba(255, 255, 255, .44);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .72);
}

.drawer-history-head {
  min-height: 35px;
  padding: 10px 12px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #7e8b9e;
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .12em;
}

.drawer-history-head b {
  min-width: 22px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #537083;
  background: rgba(222, 238, 240, .8);
  font-size: 8px;
  text-align: center;
  letter-spacing: 0;
}

.drawer-history .conversation-list {
  min-height: 0;
  margin: 0;
  padding: 4px 7px 10px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.drawer-history .conversation-list::-webkit-scrollbar {
  width: 4px;
}

.drawer-history .conversation-list::-webkit-scrollbar-thumb {
  border-radius: 99px;
  background: rgba(91, 115, 142, .2);
}

.drawer-history .conversation-row {
  min-height: 52px;
}

.drawer-history .conversation-open {
  min-height: 52px;
}

.drawer-tools {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  padding-top: 2px;
}

.drawer-utilities {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.drawer-tools .drawer-profile {
  width: auto;
  min-width: 0;
  min-height: 63px;
  padding: 7px 5px;
  grid-template-columns: 30px minmax(0, 1fr);
  grid-template-rows: auto;
  gap: 7px;
  border-radius: 15px;
}

.drawer-tools .drawer-profile .profile-monogram {
  width: 30px;
  height: 38px;
  border-radius: 10px;
  font-size: 11px;
}

.drawer-tools .drawer-profile > span:nth-child(2) {
  min-width: 0;
  gap: 3px;
}

.drawer-tools .drawer-profile strong,
.drawer-tools .drawer-profile small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drawer-tools .drawer-profile strong {
  font-size: 9px;
}

.drawer-tools .drawer-profile small {
  font-size: 7px;
}

.drawer-tools .drawer-profile > svg {
  display: none;
}

.drawer-tools .drawer-theme {
  margin: 0;
  padding: 6px;
  border-radius: 15px;
}

.drawer-tools .drawer-theme > span {
  min-width: 62px;
}

.drawer-tools .drawer-footer {
  padding: 2px 4px 0;
}

.message-list,
.messages {
  overflow-anchor: none;
}

:root[data-theme="colorful"] .drawer-history {
  border-color: rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

:root[data-theme="colorful"] .drawer-history-head {
  color: rgba(255, 255, 255, .58);
}

:root[data-theme="colorful"] .drawer-history-head b {
  color: rgba(255, 255, 255, .78);
  background: rgba(255, 255, 255, .12);
}

:root[data-theme="dark"] .drawer-history {
  border-color: rgba(137, 163, 202, .1);
  background: rgba(13, 21, 35, .68);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035);
}

:root[data-theme="dark"] .drawer-history-head {
  color: #77869c;
}

:root[data-theme="dark"] .drawer-history-head b {
  color: #a4b5cb;
  background: rgba(103, 128, 163, .14);
}

@media (max-height: 690px) {
  .drawer-panel {
    gap: 7px;
  }

  .drawer-head .eyebrow,
  .drawer-new small,
  .drawer-tools .drawer-profile small,
  .drawer-footer {
    display: none;
  }

  .drawer-head h2 {
    margin: 0;
  }

  .drawer-new {
    min-height: 50px;
  }

  .drawer-tools {
    gap: 6px;
  }

  .drawer-tools .drawer-profile {
    min-height: 48px;
  }
}
