/* Shared controls and a quieter chat shell. Theme colours remain in themes.css. */
.ui-icon {
  display: block;
  width: 19px;
  height: 19px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.compact-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  padding: 7px;
  flex-shrink: 0;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
.compact-icon:focus-visible {
  outline: 2px solid var(--theme-accent);
  outline-offset: 3px;
}
.compact-icon[aria-busy='true'] {
  opacity: 0.55;
}

#sidebar {
  --sidebar-action-size: 28px;
  --sidebar-action-inset: 10px;
  padding-inline: 12px;
}
#sidebar .brand {
  gap: 10px;
  margin-bottom: 0;
  padding-bottom: 8px;
}
#sidebar .brand-mark {
  width: 34px;
  height: 34px;
  font-size: 25px;
}
#sidebar .brand > div {
  font-size: 14px;
  min-width: 0;
}
#communityTagline {
  margin-top: 3px;
  font-size: 11px;
  line-height: 1.35;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--theme-quiet);
}
.brand-mark {
  position: relative;
  padding: 0;
  border-radius: 11px;
  letter-spacing: normal;
  box-shadow: none;
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  -webkit-mask: url('/assets/brand/vibechat-symbol.svg') center / contain no-repeat;
  mask: url('/assets/brand/vibechat-symbol.svg') center / contain no-repeat;
}
.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  visibility: hidden;
}
.brand {
  letter-spacing: -0.035em;
}
#sidebar .section-title {
  margin-inline: var(--sidebar-action-inset);
  margin-top: 16px;
  margin-bottom: 4px;
  letter-spacing: 1px;
}
#sidebar .channel {
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
}
#sidebar .channel.active :is(.text-channel-name, .voice-channel-name) {
  font-weight: 700;
}
.voice-channel-card {
  margin-bottom: 4px;
  padding-bottom: 0;
}
.voice-channel-card .channel {
  gap: 8px;
  margin: 0;
}
.voice-channel-card .channel-symbol {
  display: flex;
  align-items: center;
  width: 18px;
}
.voice-channel-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-transport {
  display: inline;
  flex-shrink: 0;
  margin: 0;
  font-size: 9px;
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 4px;
  background: var(--theme-soft);
}
.channel-hint {
  display: flex;
  align-items: center;
  gap: 3px;
  margin-left: 0;
  font-size: 10px;
}
.channel-hint:empty {
  display: none;
}
.voice-occupancy {
  margin: 0 10px 7px 36px;
}
.voice-preview-people {
  padding: 0 6px 5px 29px;
}
.voice-preview-people:empty {
  display: none;
}
.voice-preview-people .person-row {
  min-height: 30px;
  padding: 3px 4px;
  gap: 7px;
  justify-content: flex-start;
  text-align: left;
}
.voice-preview-people .presence-avatar {
  width: 23px;
  height: 23px;
}
.person-row {
  min-height: 38px;
  padding-block: 5px;
  gap: 8px;
}
.person-copy {
  flex: 1;
  min-width: 0;
}
.person-copy strong {
  overflow-wrap: anywhere;
}
.media-indicators {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  color: var(--theme-quiet);
}
.media-indicators:empty {
  display: none;
}
.media-status {
  display: inline-flex;
  vertical-align: middle;
}
.media-status .ui-icon {
  width: 13px;
  height: 13px;
}
#onlineCount {
  display: inline-block;
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}
.people-title .compact-icon {
  padding: 6px;
  min-height: 32px;
  height: 32px;
  width: 32px;
  min-width: 32px;
}
#peopleRail .people-title {
  margin-bottom: 4px;
}
.sidebar-bottom {
  display: flex;
  align-items: center;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--theme-line);
}
.sidebar-bottom::before {
  display: none;
}
#accountButton {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 5px;
  border: 0;
  background: transparent;
  gap: 7px;
}
#accountButton .avatar {
  width: 28px;
  height: 28px;
}
#accountButton strong {
  font-size: 12px;
}
.avatar-reroll {
  display: flex;
  align-items: center;
  gap: 12px;
}
.avatar-reroll .avatar {
  width: 48px;
  height: 48px;
  flex: none;
}
.account-tools {
  display: flex;
  gap: 2px;
}
.account-tools .theme-launch {
  margin: 0;
  width: 32px;
  min-width: 32px;
  min-height: 36px;
  height: 36px;
  padding: 6px;
  border: 0;
}

.chat-header {
  min-height: 56px;
  gap: 10px;
  padding: 8px 20px;
}
.channel-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}
.channel-heading h1 {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-heading > .retention-badge {
  display: inline-block;
  flex-shrink: 0;
  font-size: 10px;
  padding: 3px 5px;
  border: 1px solid var(--theme-line);
  border-radius: 5px;
  color: var(--theme-quiet);
}
.header-hash {
  font-size: 23px;
}
#peopleButton {
  min-height: 36px;
  padding: 7px 10px;
  background: transparent;
  border-color: transparent;
  gap: 6px;
}
#peopleButtonLabel {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}
#peopleButton[data-live='false'] {
  color: var(--theme-quiet);
}
#invite {
  padding: 7px;
  background: transparent;
  border-color: transparent;
}
.chat-header button:hover,
.account-tools button:hover,
#accountButton:hover {
  background: var(--theme-soft);
}
#messages {
  padding-inline: 22px;
}
#composer {
  padding: 8px 20px 10px;
}
.compose-box {
  gap: 8px;
  padding: 5px;
}
#message {
  padding: 9px 4px;
}
#send {
  width: 36px;
  min-width: 36px;
  min-height: 36px;
  height: 36px;
  padding: 8px;
}
#attachMedia {
  min-height: 36px;
  height: 36px;
  width: 36px;
  min-width: 36px;
  border: 0;
  background: transparent;
}
.composer-meta {
  min-height: 18px;
  padding: 4px 2px 0;
  align-items: center;
  gap: 8px;
}
#composerHint.sr-only {
  display: block;
}
.composer-meta #connection[data-state='connected'] {
  font-size: 0;
}
.composer-meta #connection:not([data-state='connected']) {
  font-size: 10px;
  width: auto;
}
#sendStatus:empty {
  display: none;
}

/* Call controls stay in the bottom dock. */
#voiceStatus {
  display: block;
  margin-inline: 20px;
  padding: 8px 10px;
  max-height: 40dvh;
}
.call-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.voice-actions {
  flex-wrap: nowrap;
  gap: 4px;
}
.voice-actions .compact-icon {
  min-height: 34px;
  height: 34px;
  width: 34px;
  min-width: 34px;
  padding: 7px;
}
#shareCamera[aria-pressed='true'],
#shareScreen[aria-pressed='true'],
#callSettingsToggle[aria-expanded='true'] {
  color: var(--theme-accent);
  background: var(--theme-soft);
  border-color: var(--theme-accent);
}
#leaveVoice {
  color: var(--theme-warn);
}
#participants {
  display: flex;
  align-items: flex-start;
  gap: 5px;
  margin-top: 7px;
  max-height: 160px;
}
#participants li {
  width: auto;
  max-width: 100%;
  min-width: 0;
  padding: 4px 7px;
  border-radius: 8px;
  font-size: 11px;
}
#participants .participant-avatar {
  width: 23px;
  height: 23px;
}
.participant-label {
  min-width: 0;
  overflow-wrap: anywhere;
}
#callSettings {
  margin-top: 10px;
  border-top: 1px solid var(--theme-line);
  padding-top: 8px;
}
.call-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}
.call-options label {
  align-items: flex-start;
  flex-direction: column;
  gap: 5px;
  font-size: 11px;
  min-width: 0;
}
.call-options select {
  width: 100%;
  max-width: none;
  min-width: 0;
  min-height: 34px;
  padding: 6px 8px;
  margin: 0;
  font-size: 12px;
}
#voiceStatus .screen-hint {
  margin: 7px 0 0;
  font-size: 11px;
  line-height: 1.5;
}
#voiceStatus :is(#noiseHint, #cameraHint, #screenHint):not([data-alert='true']) {
  display: none;
}
#voiceStatus .screen-hint:empty {
  display: none;
}
#voiceStatus > button {
  margin-top: 7px;
}
#cameraGrid:not([hidden]) {
  margin-top: 8px;
}

#runnerPanel {
  padding-top: 8px;
}
#runnerPanel .runner-heading {
  margin-bottom: 0;
}
#runnerPanel .runner-heading strong {
  font-size: 13px;
  letter-spacing: 0;
}
#runnerPanel #runnerPause {
  width: 32px;
  min-width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 7px;
  background: transparent;
  border: 0;
}
#runnerPanel #runnerBody {
  margin-top: 8px;
}
#runnerPanel :is(.runner-records, .runner-trail) {
  display: none;
}
.dialog-heading {
  gap: 12px;
  margin-bottom: 12px;
}
.dialog-heading h2 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 21px;
}
#themeDialog > p {
  max-width: none;
}
#themeChoices {
  margin-top: 16px;
}
#themeFeedback:empty {
  display: none;
}
@media (min-width: 501px) {
  .theme-card img {
    height: 90px;
  }
}

@media (min-width: 1100px) {
  #chat {
    grid-template-columns: 236px minmax(0, 1fr) 218px;
  }
  #peopleRail {
    padding: 12px 10px;
  }
}
@media (min-width: 701px) {
  .mobile-only.compact-icon {
    display: none;
  }
}
@media (max-width: 1099px) {
  .sidebar-bottom {
    flex-wrap: wrap;
  }
  .account-tools .theme-launch {
    min-width: 36px;
    width: 36px;
  }
}
@media (max-width: 700px) {
  .compact-icon,
  .account-tools .theme-launch,
  .people-title .compact-icon {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
  }
  #sidebar .channel {
    min-height: 44px;
  }
  .chat-header {
    min-height: 56px;
    padding: 6px 8px;
    gap: 4px;
  }
  .channel-heading {
    gap: 6px;
  }
  #peopleButton {
    min-height: 44px;
    padding: 7px;
  }
  #invite {
    width: 44px;
  }
  #messages {
    padding-inline: 14px;
  }
  #composer {
    padding: 6px 10px 8px;
  }
  #message {
    padding-block: 12px;
  }
  #send,
  #attachMedia {
    width: 44px;
    min-width: 44px;
    height: 44px;
    min-height: 44px;
  }
  .composer-meta {
    padding-top: 2px;
  }

  #voiceStatus {
    margin-inline: 10px;
    padding: 7px;
    max-height: 38dvh;
  }
  .call-toolbar {
    flex-wrap: wrap;
    gap: 6px;
  }

  .voice-actions {
    gap: 3px;
  }
  .voice-actions .compact-icon {
    min-width: 44px;
    width: 44px;
    min-height: 44px;
    height: 44px;
    padding: 8px;
  }
  #participants {
    max-height: 136px;
  }
  .call-options select {
    min-height: 44px;
  }
}

/* Voice activity belongs to its channel; the call dock stays above the account. */
#sidebar #voiceStatus {
  margin: 8px 0;
  padding: 10px;
  max-height: 45dvh;
  overflow-y: auto;
}
#sidebar .call-toolbar {
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
}
#sidebar .voice-actions {
  flex-wrap: wrap;
}
#sidebar .call-options {
  grid-template-columns: minmax(0, 1fr);
}
#sidebar .sidebar-bottom {
  flex-shrink: 0;
}
#sidebar #participants {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 4px 6px 20px;
  margin: 0;
  max-height: none;
  overflow: visible;
}
#sidebar #participants li {
  width: 100%;
  padding: 0 4px;
  border: 0;
  background: transparent;
}
#sidebar #participants .participant-label {
  flex: 1;
  text-align: left;
}
#sidebar #participants .participant-avatar {
  flex-shrink: 0;
}
#sidebar #participants li.speaking .participant-avatar {
  outline: 2px solid var(--theme-ok);
  outline-offset: 2px;
}
#content > #cameraGrid:not([hidden]) {
  flex: 0 0 auto;
  margin: 8px 20px;
  max-height: 30dvh;
  overflow-y: auto;
}
#mobileCallStrip {
  display: none;
}
@media (max-width: 700px) {
  #mobileCallStrip:not([hidden]) {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
    margin: 0 10px 8px;
    padding: 6px;
    border: 1px solid var(--theme-line);
    border-radius: 10px;
    background: var(--theme-card);
  }
  #sidebar.open ~ #content #mobileCallStrip {
    display: none;
  }
  #mobileCallOpen {
    flex: 1;
    min-width: 0;
    text-align: left;
    color: var(--theme-ink);
  }
  #mobileCallLabel {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #mobileCallStrip button {
    min-height: 44px;
  }
  #mobileCallStrip .compact-icon {
    width: 44px;
    min-width: 44px;
  }
  #mobileMuteVoice[aria-pressed='true'],
  #mobileLeaveVoice {
    color: var(--theme-warn);
  }
  #sidebar .voice-actions .compact-icon {
    width: 44px;
    min-width: 44px;
    height: 44px;
  }
  #content > #cameraGrid:not([hidden]) {
    margin-inline: 10px;
  }
}

/* Group labels and controls so validation and wrapped text stay in normal flow. */
#voiceDialog .dialog-heading {
  align-items: flex-start;
}
#voiceDialog .dialog-heading .icon-button {
  margin: -6px -6px 0 0;
}
.channel-form {
  display: grid;
  gap: 20px;
  min-width: 0;
  margin-top: 20px;
}
.channel-form-field {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.channel-form-field :is(label, input, select, .field-help) {
  margin: 0;
  min-width: 0;
  width: 100%;
}
.channel-form-field :is(input, select) {
  min-height: 44px;
}
.channel-form > .field-help {
  margin: 0;
}
.channel-form-actions {
  display: flex;
  justify-content: flex-end;
}
@media (max-width: 480px) {
  .channel-form-actions .primary {
    width: 100%;
  }
}

/* Programmatic focus after a pointer action must not draw keyboard focus rings.
   Keep focus in place; the next keyboard action restores the normal indicators. */
:root[data-input-modality='pointer'] :focus {
  outline: none !important;
}

.ui-tooltip {
  position: fixed;
  inset: auto;
  margin: 0;
  pointer-events: none;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  padding: 7px 10px;
  border: 1px solid var(--theme-line);
  border-radius: 7px;
  background: var(--theme-surface);
  color: var(--theme-ink);
  box-shadow: 0 4px 16px var(--theme-shade);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

/* The account and composer share one bottom baseline; feedback grows upward. */
:root {
  --chat-bottom-inset: max(12px, env(safe-area-inset-bottom));
}
#sidebar {
  padding-bottom: var(--chat-bottom-inset);
}
#sidebar .sidebar-bottom {
  min-height: 54px;
  padding-top: 0;
  border-top: 0;
  flex-wrap: nowrap;
}
#accountButton {
  min-height: 54px;
}
#composer {
  margin-top: auto;
  padding: 8px 20px var(--chat-bottom-inset);
}
.compose-box {
  min-height: 54px;
}
.composer-meta {
  min-height: 0;
  padding: 0;
  margin: 0 2px 6px;
  flex-wrap: wrap;
}
.composer-meta #connection[data-state='connected'] {
  display: none;
}
.composer-meta:not(
  :has(
    #connection:not([data-state='connected']),
    #sendStatus:not(:empty),
    #messageCount:not([hidden]),
    #cancelUpload:not([hidden])
  )
) {
  display: none;
}
@media (max-width: 700px) {
  #composer {
    padding-inline: 10px;
  }
  #mobileCallStrip:not([hidden]) {
    margin-bottom: 0;
  }
  #sidebar .sidebar-bottom .account-tools {
    gap: 0;
  }
  #sidebar .sidebar-bottom .theme-launch {
    width: 36px;
    min-width: 36px;
  }
}

/* One member list, in the rail on desktop and the member dialog on smaller screens. */
#onlineSection .people-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
}
#onlineSection #invite {
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
}
#offlinePeople {
  margin-top: 16px;
}
#offlineTitle {
  cursor: pointer;
  padding-block: 8px;
  font-size: 11px;
}
#peopleOffline .person-row {
  opacity: 0.65;
}
#peopleDialog .online-section {
  border: 0;
  margin: 16px 0 0;
}
@media (min-width: 1100px) {
  #peopleButton {
    display: none;
  }
}

/* Text and voice channels use the same compact row geometry and selection fill. */
#sidebar .channel {
  min-height: 38px;
  padding: 8px 10px;
  margin: 0;
  gap: 8px;
  font-size: 13px;
  line-height: 20px;
}
#sidebar .channel .channel-symbol {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  font-size: 18px;
  line-height: 20px;
}
#sidebar .channel .channel-transport {
  line-height: 12px;
}
#sidebar .channel.active {
  background: var(--theme-selected);
  border-color: transparent;
}
#textChannels,
#directMessages,
#voiceChannels {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
}
#sidebar :is(.voice-title .compact-icon, #expandCall) {
  width: var(--sidebar-action-size);
  min-width: var(--sidebar-action-size);
  height: var(--sidebar-action-size);
  min-height: var(--sidebar-action-size);
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--theme-quiet);
}
#sidebar :is(.voice-title .compact-icon, #expandCall) .ui-icon {
  width: 18px;
  height: 18px;
}
#sidebar :is(.voice-title .compact-icon, #expandCall):hover:not(:disabled) {
  background: var(--theme-soft);
  color: var(--theme-accent);
}
@media (max-width: 700px), (hover: none), (pointer: coarse) {
  #sidebar {
    --sidebar-action-size: 44px;
  }
}
#sidebar #participants li.speaking {
  border-color: transparent;
  box-shadow: none;
}
#sidebar #participants .participant-avatar {
  border-radius: 50%;
}
#sidebar .watch-screen-indicator,
#onlineSection .watch-screen-indicator {
  width: 26px;
  min-width: 26px;
  height: 26px;
  min-height: 26px;
  padding: 5px;
  border: 0;
  color: var(--theme-ok);
  background: var(--theme-soft);
  border-radius: 5px;
}
#sidebar .watch-screen-indicator:hover,
#onlineSection .watch-screen-indicator:hover {
  background: var(--theme-selected);
}
@media (pointer: coarse) {
  #sidebar .watch-screen-indicator,
  #onlineSection .watch-screen-indicator {
    width: 32px;
    min-width: 32px;
    height: 32px;
    min-height: 32px;
  }
}

/* Media yields space before it can displace the bottom composer. */
#content > #cameraGrid:not([hidden]) {
  flex-shrink: 1;
  min-height: 0;
}
#history {
  overflow: hidden;
}
@media (max-height: 600px) {
  #message {
    max-height: 20dvh;
  }
  .attachment-queue {
    max-height: 16dvh;
  }
}
