/* v7: group member visibility in the conversation header. */
.group-member-preview {
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 20px;
  margin-top: 3px;
}
.group-member-preview[hidden] { display: none; }
.group-member-preview > span {
  display: grid;
  width: 20px;
  height: 20px;
  margin-left: -5px;
  place-items: center;
  border: 2px solid var(--surface);
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(124,101,244,.26), rgba(54,210,184,.25));
  color: var(--text);
  font-size: 7px;
  font-weight: 900;
}
.group-member-preview > span:first-child { margin-left: 0; }
.group-member-preview > small {
  min-width: 0;
  margin-left: 7px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#spaceOverlay { padding: 12px; }

#spaceOverlay .create-space-dialog {
  width: min(408px, 100%);
  max-height: calc(100dvh - 24px);
  min-height: 0;
  gap: 10px;
  overflow: auto;
  padding: 16px;
  border-radius: 10px;
  background: var(--surface) !important;
  box-shadow: var(--shadow);
  scrollbar-width: thin;
}

#spaceOverlay .create-space-dialog::before { content: none; }

.create-space-head,
.create-space-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.create-space-head h2 { margin: 0; font-size: 19px; line-height: 1.25; }
.create-space-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
#spaceOverlay .create-space-head .icon-button {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  box-shadow: none;
}

.create-space-types {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--ui-stroke);
  border-radius: 7px;
  background: var(--ui-control);
}

.create-space-types button {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}

.create-space-types button[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--blue) 30%, var(--ui-stroke));
  background: color-mix(in srgb, var(--blue) 15%, var(--surface));
  color: var(--text);
}
.create-space-types svg,
.create-space-search svg { width: 16px; height: 16px; flex-shrink: 0; }

.create-space-field { display: grid; gap: 5px; font-weight: 600; }
#spaceOverlay .create-space-field input,
#spaceOverlay .create-space-search input {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--ui-stroke);
  border-radius: 6px;
  font: inherit;
  font-weight: 400;
}

.create-space-members summary {
  padding: 6px 0;
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}
.create-space-members-count { margin-inline-start: 8px; color: var(--muted); }
.create-space-search { position: relative; display: block; margin-top: 4px; }
.create-space-search svg { position: absolute; inset: 11px auto auto 10px; color: var(--muted); pointer-events: none; }
#spaceOverlay .create-space-search input { padding-inline-start: 34px; }
#spaceOverlay #spaceSelectedMembers { padding: 0; min-height: 0; }
#spaceOverlay #spaceSelectedMembers:empty { display: none; }
#spaceOverlay #spaceSelectedMembers button { margin-top: 5px; cursor: pointer; }
.create-space-results { display: grid; gap: 4px; max-height: 155px; overflow-y: auto; scrollbar-width: thin; }
.create-space-results:not(:empty) { margin-top: 6px; }
#spaceOverlay .person-row { min-height: 42px; border-radius: 6px; }
#spaceOverlay .person-row .username-tier,
#spaceOverlay .person-row .telegram-handle { display: none; }
.create-space-status,
.create-space-error { margin: 6px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.create-space-error { margin: 0; color: var(--text); }
.create-space-actions {
  padding-top: 10px;
  border-top: 1px solid var(--ui-stroke-soft);
}
#spaceOverlay .create-space-actions button { min-height: 34px; padding: 6px 10px; border-radius: 6px; box-shadow: none; }
#spaceOverlay :is(.create-space-actions button, .create-space-head .icon-button) {
  border-color: var(--ui-stroke) !important;
  background: var(--ui-control) !important;
  color: var(--text) !important;
  font-weight: 650;
}
#spaceOverlay :is(.create-space-actions button, .create-space-head .icon-button)::before { content: none; }
#spaceOverlay .create-space-actions .primary-button:not(:disabled) {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--ui-stroke)) !important;
  background: color-mix(in srgb, var(--blue) 28%, var(--surface)) !important;
}
#spaceOverlay .create-space-actions .primary-button:disabled { color: var(--muted) !important; cursor: default; }

.telegram-topic-select:not([hidden]) {
  flex: 0 1 auto;
  max-width: clamp(80px, 25vw, 200px);
  min-height: 32px;
  padding: 4px 6px;
  border: 1px solid var(--ui-stroke);
  border-radius: 6px;
  color: var(--text);
  background: var(--ui-control);
  text-overflow: ellipsis;
}

.telegram-topic-select option { background: var(--surface); color: var(--text); }
#memberOverlay .person-row:disabled { opacity: .7; cursor: default; }
#memberOverlay .person-row small { color: var(--muted); }

