.buddy-window {
  display: flex;
  flex-direction: column;
  width: 250px;
  min-height: 0;
  font: 8.25pt Tahoma, Arial, sans-serif;
}

.buddy-window > :not(.roster) { flex: none; }
.buddy-window .titlebar { gap: 4px; }
#buddyWindowTitle, .buddy-list-heading {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.buddy-window .menubar { height: 22px; }
.buddy-window .menubar button { padding: 3px 7px; }
.buddy-window .menubar button:hover { background: #000080; color: #fff; }

.buddy-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 154px;
  background: inherit;
}
.buddy-brand img { width: 190px; height: 150px; max-width: 100%; object-fit: contain; }
.buddy-list-heading {
  margin: 0;
  padding: 2px 3px;
  border: 1px solid #777;
  background: #fff;
  font: inherit;
  line-height: 15px;
}

.buddy-window .roster {
  flex: 1;
  min-height: 0;
  margin: 0;
  padding: 0 2px;
  border: 1px solid #777;
  border-top: 0;
  background: #fff;
  overflow: auto;
  font: inherit;
}
.roster ul { margin: 0; padding: 0; list-style: none; }
.roster li ul { padding-left: 14px; }
.roster .buddy, .roster .group-title {
  position: relative;
  display: block;
  width: max-content;
  max-width: 100%;
  height: 18px;
  padding: 0 2px 0 18px;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  font: inherit;
  line-height: 18px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.roster .group-title { font-weight: bold; }
.roster .group-title::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 5px;
  border: 4px solid transparent;
  border-right: 0;
  border-left-color: #000;
}
.roster .group-title[aria-expanded="true"]::before {
  left: 3px;
  top: 7px;
  border: 4px solid transparent;
  border-bottom: 0;
  border-top-color: #000;
}
.roster .offline-group { color: #666; }
.roster .offline-group .group-title { font-weight: normal; }
.roster .buddy img { position: absolute; left: 2px; top: 3px; }
.roster .buddy span { display: block; overflow: hidden; padding: 0 2px; text-overflow: ellipsis; }
.roster .buddy[aria-pressed="true"] span, .roster .buddy:focus-visible span {
  background: #ff0;
  outline: 1px dotted #000;
  outline-offset: -1px;
}
.roster button:focus-visible { outline-offset: -1px; }

.buddy-actions {
  position: relative;
  display: flex;
  height: 48px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  border: 1px solid #777;
  border-top: 0;
}
.buddy-actions > button { min-width: 0; padding: 0 2px; border: 2px solid transparent; background: transparent; }
.buddy-actions > button:hover:enabled { border: 2px outset #eee; }
.buddy-actions > button:active:enabled { border: 2px inset #eee; }
.buddy-actions > button:disabled img { opacity: .5; }
.buddy-actions img { display: block; }
.buddy-window .popup-menu { top: 47px; max-height: 55dvh; overflow: auto; }
.presence-option { display: flex; align-items: center; justify-content: space-between; padding: 3px 8px 3px 18px; }
#setupMenu { top: auto; bottom: 100%; left: auto; right: 0; }

.buddy-status {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 6px;
  padding: 2px 4px;
}
.buddy-status .connection-status, .buddy-status .secure-session { margin: 0; padding: 0; border: 0; }
.buddy-status .connection-status:empty, .buddy-status .secure-session:has(p:empty) { display: none; }
.buddy-status button { margin-top: 2px; }

@media (max-width: 700px) {
  .buddy-window { width: 100%; height: auto; }
  .buddy-window .roster { flex: none; height: 180px; }
}
