/* Coach hub — client messages inbox */
.coach-msg-inbox {
  display: grid;
  grid-template-columns: minmax(220px, 280px) 1fr;
  min-height: min(70vh, 640px);
  border-radius: var(--radius-lg, 16px);
  border: 1px solid var(--border-color);
  overflow: hidden;
}

.coach-msg-inbox__header {
  margin-bottom: 1rem;
}

.coach-msg-inbox__list-wrap {
  border-inline-end: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.light-mode .coach-msg-inbox__list-wrap {
  background: rgba(0, 0, 0, 0.03);
}

.coach-msg-inbox__list-label {
  padding: 0.75rem 1rem 0.35rem;
  margin: 0;
}

.coach-msg-inbox__list {
  overflow-y: auto;
  flex: 1;
  padding: 0.25rem;
}

.coach-msg-thread-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: var(--btn-radius, 10px);
  background: transparent;
  color: var(--text-primary);
  text-align: start;
  cursor: pointer;
  transition: background 0.15s ease;
}

.coach-msg-thread-item:hover,
.coach-msg-thread-item.is-active {
  background: var(--accent-soft);
}

.coach-msg-thread-item__avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  display: grid;
  place-items: center;
  font-size: var(--text-ui);
  font-weight: var(--fw-semibold);
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
  flex-shrink: 0;
}

.coach-msg-thread-item__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.coach-msg-thread-item__name {
  font-size: var(--text-ui);
  font-weight: var(--fw-medium);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-msg-thread-item__meta {
  font-size: var(--text-caption);
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.coach-msg-inbox__thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
}

.coach-msg-inbox__thread-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.coach-msg-inbox__back {
  display: none;
}

.coach-msg-inbox__thread-title {
  font-size: var(--text-ui);
  font-weight: var(--fw-semibold);
}

.coach-msg-inbox__messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.coach-msg-thread-empty {
  margin: auto;
  text-align: center;
  padding: 2rem 1rem;
}

.coach-msg-bubble {
  max-width: min(85%, 420px);
  padding: 0.55rem 0.75rem;
  border-radius: 14px;
  font-size: var(--text-body);
}

.coach-msg-bubble--mine {
  align-self: flex-end;
  background: rgba(var(--accent-rgb), 0.18);
  border: 1px solid rgba(var(--accent-rgb), 0.25);
}

.coach-msg-bubble--theirs {
  align-self: flex-start;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
}

.coach-msg-bubble__text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.coach-msg-bubble__time {
  display: block;
  margin-top: 0.25rem;
  font-size: var(--text-caption);
  color: var(--text-secondary);
}

.coach-msg-inbox__compose {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--border-color);
}

.coach-msg-inbox__input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--border-color);
  border-radius: var(--btn-radius, 10px);
  background: var(--input-bg);
  color: var(--text-primary);
  padding: 0.55rem 0.75rem;
  font-size: var(--text-body);
}

.coach-msg-inbox__empty-thread {
  display: grid;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

.coach-msg-inbox--thread-open .coach-msg-inbox__empty-thread {
  display: none;
}

.coach-msg-inbox--thread-open .coach-msg-inbox__thread {
  display: flex;
}

.coach-settings-section--feedback {
  margin-top: 1.5rem;
}

.coach-settings-section__title {
  margin: 0 0 0.25rem;
}

.coach-settings-section__sub {
  margin: 0 0 1rem;
}

.coach-msg-inbox__compose {
  display: flex;
  gap: 0.35rem;
  align-items: center;
}

.coach-msg-inbox__attach {
  flex-shrink: 0;
  width: 2rem;
  height: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.06);
  cursor: pointer;
  font-size: var(--text-caption);
}

.coach-msg-bubble__image,
.coach-msg-bubble__gif,
.coach-msg-bubble__video {
  max-width: min(280px, 100%);
  border-radius: 10px;
  display: block;
}

.coach-msg-bubble__audio {
  min-width: 200px;
}

.coach-msg-bubble__caption {
  margin: 0.35rem 0 0;
  font-size: var(--text-ui);
}

.coach-msg-thread-item__preview {
  display: block;
  font-size: var(--text-caption);
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.feedback-screenshot {
  max-width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border-color);
}

@media (max-width: 768px) {
  .coach-msg-inbox {
    grid-template-columns: 1fr;
    min-height: min(75vh, 720px);
  }

  .coach-msg-inbox--thread-open .coach-msg-inbox__list-wrap {
    display: none;
  }

  .coach-msg-inbox__back {
    display: inline-flex;
  }

  .coach-msg-inbox__empty-thread {
    display: none;
  }
}
