.wach-comments {
  grid-column: 1 / -1;
  margin: 22px 0 4px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #fff;
  color: #172033;
}

.wach-comments__head,
.wach-comments__login {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wach-comments__head h3 { margin: 0; font-size: 20px; }
.wach-comments__head p { margin: 4px 0 0; color: #667085; font-size: 13px; font-weight: 650; }
.wach-comments__count { min-width: 34px; padding: 7px 10px; border-radius: 999px; background: #fff2a8; color: #6b5100; text-align: center; font-weight: 900; }
.wach-comments__composer { margin-top: 16px; }
.wach-comments__composer-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 10px; align-items: start; }

.wach-comments__profile-avatar,
.wach-comment__avatar,
.wach-comment__reply-avatar {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  background: #172033;
  color: #ffd43b;
  font-weight: 900;
  flex: 0 0 auto;
}

.wach-comments__profile-avatar { width: 42px; height: 42px; }
.wach-comment__avatar { width: 40px; height: 40px; }
.wach-comment__reply-avatar { width: 30px; height: 30px; font-size: 12px; }
.wach-comments__profile-avatar img,
.wach-comment__avatar img,
.wach-comment__reply-avatar img,
.wach-account-avatar { width: 100%; height: 100%; display: block; object-fit: cover; }

/* Toolbar: the sort control only appears once there is more than one
   top-level comment to order (renderComments decides this). */
.wach-comments__toolbar { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 2px 4px 12px; }
.wach-comments__toolbar label { color: #667085; font-size: 12px; font-weight: 750; }
.wach-comments__toolbar select {
  border: 1px solid #d7dce5;
  border-radius: 8px;
  padding: 6px 10px;
  background: #fff;
  color: #172033;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}
.wach-comments__toolbar select:focus { outline: 2px solid rgba(24,119,242,.2); border-color: #1877f2; }

.wach-comments__field-wrap { flex: 1 1 auto; min-width: 0; }
.wach-comments__form { display: flex; align-items: flex-end; gap: 8px; }
.wach-comments__form textarea {
  width: 100%;
  min-height: 40px;
  max-height: 130px;
  box-sizing: border-box;
  resize: none;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 10px 15px;
  background: #f0f2f5;
  color: #172033;
  font: inherit;
  line-height: 1.4;
}

.wach-comments__form textarea:focus { outline: 3px solid rgba(24,119,242,.12); border-color: #1877f2; background: #fff; }
.wach-comments__remaining { display: block; margin: 4px 2px 0; color: #b45309; font-size: 11px; font-weight: 750; text-align: right; }
.wach-comments__remaining[hidden] { display: none; }
.wach-comments__submit,
.wach-comments__login-btn { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 10px 18px; background: #1877f2; color: #fff; font-weight: 850; cursor: pointer; }
.wach-comments__submit:disabled { background: #cfd8e8; color: #8a94ac; cursor: not-allowed; }
.wach-comments__login { padding: 13px 14px; border-radius: 12px; background: #f6f8fc; color: #475467; font-size: 13px; font-weight: 750; }
.wach-comments__list { margin-top: 16px; border-top: 1px solid #edf0f5; }

.wach-comment { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 8px; align-items: start; padding: 12px 0 2px; }
.wach-comment__body { min-width: 0; }
.wach-comment__bubble-wrap { position: relative; display: inline-flex; max-width: 100%; }
.wach-comment__bubble { display: inline-block; max-width: min(100%, 620px); padding: 9px 12px; border-radius: 16px; background: #f0f2f5; color: #172033; }
.wach-comment__bubble strong { display: block; font-size: 13px; line-height: 1.2; }
.wach-comment__bubble p { margin: 3px 0 0; font-size: 14px; line-height: 1.38; overflow-wrap: anywhere; }
.wach-comment__like-badge {
  position: absolute;
  right: 6px;
  bottom: -9px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(15,23,42,.18);
  color: #1877f2;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.5;
}
.wach-comment__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; min-height: 24px; padding: 6px 8px 2px; color: #65676b; font-size: 12px; font-weight: 800; }
.wach-comment__actions button { padding: 0; border: 0; background: transparent; color: #65676b; font: inherit; font-weight: 800; cursor: pointer; }
.wach-comment__actions button:hover { text-decoration: underline; }
.wach-comment__actions time { font-weight: 650; cursor: default; }
.wach-comment__actions time:hover { text-decoration: none; }
.wach-comment__actions .wach-comment__like.is-liked { color: #1877f2; }
.wach-comment__actions .wach-comment__delete { color: #b42318; margin-left: auto; }
.wach-comment__replies { margin-top: 2px; padding-left: 14px; border-left: 2px solid #eef1f5; }
.wach-comment--reply { grid-template-columns: 32px minmax(0, 1fr); padding-top: 7px; }
.wach-comment--reply .wach-comment__avatar { width: 32px; height: 32px; font-size: 12px; }
.wach-comment--reply .wach-comment__bubble { padding: 8px 11px; }
.wach-comment__reply-slot { margin-top: 3px; }
.wach-comment__reply-composer { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 7px; align-items: center; padding: 5px 0; }
.wach-comment__reply-composer form { display: flex; align-items: center; gap: 6px; min-width: 0; }
.wach-comment__reply-composer input { width: 100%; min-width: 0; box-sizing: border-box; border: 1px solid transparent; border-radius: 20px; padding: 9px 12px; background: #f0f2f5; font: inherit; }
.wach-comment__reply-composer input:focus { outline: 2px solid rgba(24,119,242,.18); border-color: #1877f2; background: #fff; }
.wach-comment__reply-composer button { flex: 0 0 auto; border: 0; border-radius: 999px; padding: 8px 14px; background: #1877f2; color: #fff; font-weight: 850; cursor: pointer; }
.wach-comment__reply-composer button:disabled { background: #cfd8e8; color: #8a94ac; cursor: not-allowed; }

/* Audio: the mic/record/preview widget in a composer, and the playback
   element inside a published comment/reply bubble. Shared by the main
   composer, the inline reply composer and wach-demand-replies.js's
   composer -- see WachComments.attachAudioRecorder. */
.wach-audio-recorder { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.wach-audio-recorder__mic {
  flex: 0 0 auto; width: 32px; height: 32px; border: 1px solid #d7dce5; border-radius: 50%;
  background: #f0f2f5; font-size: 15px; cursor: pointer; display: grid; place-items: center;
}
.wach-audio-recorder__mic:hover { background: #e4e8ee; }
.wach-audio-recorder__rec { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #e0245e; animation: wachAudioRecPulse 1s ease-in-out infinite; }
@keyframes wachAudioRecPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.wach-audio-recorder__timer { font-size: 12px; font-weight: 800; color: #39415a; font-variant-numeric: tabular-nums; }
.wach-audio-recorder__stop,
.wach-audio-recorder__discard {
  flex: 0 0 auto; width: 28px; height: 28px; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; font-size: 13px;
}
.wach-audio-recorder__stop { background: #e0245e; color: #fff; }
.wach-audio-recorder__discard { background: #eef1f5; color: #65676b; }
.wach-comment__audio,
.wach-audio-recorder audio { display: block; width: 100%; max-width: 260px; height: 36px; margin-top: 6px; }
.wach-comment__reply-composer .wach-audio-recorder { margin: 0; }
.wach-comment__reply-composer .wach-comment__audio,
.wach-comment__reply-composer .wach-audio-recorder audio { max-width: 150px; }

/* A freshly published comment gets a brief highlight so "it worked" is
   visible without relying on the toast alone. One-shot: only the comment
   just inserted carries this class (see rerenderFromCache's highlightId). */
@keyframes wachCommentNew { from { background: #fff7d1; } to { background: transparent; } }
.wach-comment--new > .wach-comment__body > .wach-comment__bubble-wrap > .wach-comment__bubble { animation: wachCommentNew 1.6s ease-out; border-radius: 16px; }

.wach-comments__loading,
.wach-comments__empty,
.wach-comments__error { padding: 17px 4px; color: #667085; font-size: 13px; font-weight: 700; }
.wach-comments__error { color: #b42318; }

.user-pill:has(.wach-account-avatar) { overflow: hidden; padding: 0; }
.wach-account-avatar { border-radius: 50%; }

/* Mobile (also covers 320-390px phones). */
@media (max-width: 640px) {
  .wach-comments { margin-top: 16px; padding: 15px; border-radius: 15px; }
  .wach-comments__head, .wach-comments__login { align-items: flex-start; }
  .wach-comments__login { flex-direction: column; }
  .wach-comments__toolbar { justify-content: space-between; }
  .wach-comment__like-badge { right: 2px; }
}

/* Tablet. */
@media (min-width: 641px) and (max-width: 1024px) {
  .wach-comments { padding: 24px; }
  .wach-comment__bubble { max-width: min(100%, 520px); }
}

/* Desktop: keep the thread from stretching edge-to-edge on wide product pages. */
@media (min-width: 1025px) {
  .wach-comments { padding: 26px 28px; }
  .wach-comments__composer-row { grid-template-columns: 44px minmax(0, 1fr); }
  .wach-comment { grid-template-columns: 44px minmax(0, 1fr); }
  .wach-comment__avatar { width: 44px; height: 44px; }
  .wach-comment__bubble { max-width: min(100%, 560px); }
}
