select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  background: var(--bg);
  color: var(--text);
  padding: 0.8rem 0.9rem;
}

select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.optional-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 400;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.rooms-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-right: 0.8rem;
}

.icon-button {
  display: inline-grid;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 0.6rem;
  background: var(--surface-2);
  color: var(--text);
  place-items: center;
  font-size: 1.25rem;
  line-height: 1;
}

.presence-panel {
  border-top: 1px solid var(--border);
  padding-bottom: 0.75rem;
}

.presence-list {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding: 0 1rem;
  list-style: none;
}

.presence-user {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  color: var(--text);
  font-size: 0.86rem;
}

.presence-user::before {
  width: 0.5rem;
  height: 0.5rem;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--success);
  content: "";
}

.presence-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.presence-idle {
  color: var(--muted);
  font-size: 0.72rem;
  white-space: nowrap;
}

.room-header {
  grid-row: 1;
}

.empty-state,
.message-list {
  grid-row: 2;
}

.composer-wrap {
  grid-row: 3;
}

.room-dialog {
  width: min(32rem, calc(100vw - 2rem));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.room-dialog::backdrop {
  background: rgb(0 0 0 / 0.68);
  backdrop-filter: blur(3px);
}

.room-dialog form {
  padding: 1.25rem;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.dialog-header h2 {
  margin: 0;
}

code {
  border-radius: 0.25rem;
  background: var(--surface-2);
  padding: 0.08rem 0.3rem;
}

#load-older-button {
  align-self: center;
}

.attachment-picker {
  display: flex;
  min-width: 0;
  grid-column: 1 / -1;
  align-items: center;
  gap: 0.65rem;
}

.attachment-button {
  cursor: pointer;
  white-space: nowrap;
}

.attachment-name {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.82rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-card {
  display: grid;
  width: min(34rem, 100%);
  gap: 0.65rem;
  margin-top: 0.35rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface-2);
}

.attachment-preview {
  display: block;
  width: auto;
  max-width: 100%;
  max-height: 24rem;
  border-radius: 0.55rem;
  object-fit: contain;
}

.attachment-details {
  display: grid;
  min-width: 0;
  gap: 0.2rem;
}

.attachment-download {
  overflow: hidden;
  color: var(--accent-strong);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-metadata {
  color: var(--muted);
  font-size: 0.76rem;
  overflow-wrap: anywhere;
}

@media (max-width: 34rem) {
  .presence-panel {
    display: none;
  }

  .attachment-picker {
    flex-wrap: wrap;
  }

  .attachment-name {
    flex-basis: 100%;
    order: 3;
  }
}
