.health-talks-page {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

.talks-hero {
  background: linear-gradient(135deg, #ecfeff, #f0f9ff);
  border: 1px solid #bae6fd;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 18px;
}

.talks-hero h1 {
  margin: 0;
  color: #0f172a;
}

.talks-hero p {
  margin: 0;
  color: #334155;
}

.talks-note {
  margin-top: 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: #92400e;
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 0.92rem;
}

.composer-card,
.feed-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
}

.talks-hero-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.profile-launcher {
  border: 1px solid #dbeafe;
  background: #fff;
  border-radius: 14px;
  padding: 6px 8px;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.profile-launcher-avatar-wrap {
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.profile-launcher-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: none;
}

.profile-launcher-initial {
  font-weight: 700;
  color: #334155;
}

.profile-launcher-name {
  font-size: 0.78rem;
  color: #334155;
  font-weight: 600;
  text-align: center;
  line-height: 1.1;
}

.profile-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  padding: 16px;
}

.profile-modal.show {
  display: flex;
}

.profile-modal-card {
  width: 100%;
  max-width: 520px;
  background: #fff;
  border-radius: 14px;
  border: 1px solid #e5e7eb;
  padding: 14px;
}

.profile-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.profile-modal-head h2 {
  margin: 0;
  color: #111827;
  font-size: 1.05rem;
}

.btn-close {
  border: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f1f5f9;
  color: #334155;
  cursor: pointer;
}

.profile-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.profile-avatar-wrap {
  flex-shrink: 0;
}

.profile-avatar-preview {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  object-fit: cover;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
}

.profile-inputs {
  flex: 1;
  min-width: 0;
}

#profile-name {
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.92rem;
  margin-bottom: 8px;
}

.profile-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.feed-section h2 {
  margin: 0;
  font-size: 1.2rem;
  color: #111827;
}

.feed-layout {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 16px;
}

.feed-main {
  min-width: 0;
}

.feed-main-full {
  grid-column: 1 / -1;
}

.composer-top {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.composer-top input {
  flex: 1;
}

.composer-identity {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  padding: 6px 10px;
  width: fit-content;
}

.composer-avatar {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 1px solid #cbd5e1;
  object-fit: cover;
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
}

#composer-name {
  font-size: 0.86rem;
  color: #334155;
  font-weight: 600;
}

#talk-form textarea {
  width: 100%;
  border: 0;
  border-radius: 0;
  padding: 12px 12px 8px;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 108px;
  outline: none;
  background: transparent;
}

.form-row,
.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#talk-author,
#talk-category,
#talk-filter,
.comment-row input {
  border: 1px solid #d1d5db;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 0.92rem;
}

#talk-char-count,
#talk-form small {
  color: #6b7280;
  font-size: 0.82rem;
}

.btn-primary,
.btn-danger,
.btn-action {
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.btn-primary {
  background: #0ea5e9;
  color: #fff;
  padding: 9px 14px;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
  padding: 9px 12px;
  width: 100%;
}

.talks-feed {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.talk-card {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.talk-card-inner {
  padding: 12px;
}

.talk-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  /* Keep follow button in view: left block must shrink (flex min-width:auto clips the right column). */
  min-width: 0;
}

.follow-btn-wrap {
  flex-shrink: 0;
  padding-top: 2px;
  align-self: center;
}

.follow-btn {
  border: 1px solid #0ea5e9;
  background: #0ea5e9;
  color: #fff;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  line-height: 1.2;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.follow-btn i {
  font-size: 0.72rem;
}

.follow-btn:hover {
  background: #0284c7;
  border-color: #0284c7;
  color: #fff;
}

.follow-btn.is-following {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
  font-weight: 600;
}

.follow-btn.is-following:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
  color: #0f172a;
}

.talk-user {
  display: flex;
  gap: 9px;
  flex: 1;
  min-width: 0;
}

.talk-user > div {
  min-width: 0;
  flex: 1;
}

.talk-avatar {
  width: 38px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(135deg, #bae6fd, #0ea5e9);
  color: #0c4a6e;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.talk-title {
  margin: 0 0 2px;
  font-size: 0.97rem;
  color: #0f172a;
}

.talk-meta {
  font-size: 0.82rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.talk-category {
  background: #e0f2fe;
  border: 1px solid #7dd3fc;
  color: #075985;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 0.75rem;
  height: fit-content;
}

.talk-body {
  white-space: pre-wrap;
  color: #1f2937;
  margin: 0;
}

.talk-body-wrap {
  margin: 10px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.post-inline-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.post-inline-edit-btn {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #334155;
  border-radius: 8px;
  height: 30px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.post-inline-edit-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.post-inline-delete-btn {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b91c1c;
  border-radius: 8px;
  height: 30px;
  padding: 0 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.post-inline-delete-btn:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.talk-media {
  margin-bottom: 10px;
}

.talk-media img,
.talk-media video {
  width: 100%;
  max-height: 480px;
  object-fit: contain;
  background: #0f172a;
}

.talk-actions {
  display: flex;
  gap: 1px;
  margin-top: 8px;
  border-top: 1px solid #e5e7eb;
  border-bottom: 1px solid #e5e7eb;
  background: #f8fafc;
}

.btn-action {
  background: transparent;
  color: #111827;
  padding: 10px;
  font-size: 0.85rem;
  flex: 1;
  border-radius: 0;
}

.btn-action:hover {
  background: #e2e8f0;
}

/* Follow in action row (Facebook-style) — override global dark-theme button !important rules */
.health-talks-page .talk-actions .follow-action-btn {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  visibility: visible !important;
  opacity: 1 !important;
  flex: 1 !important;
  min-height: 44px !important;
  font-weight: 700 !important;
  color: #0c4a6e !important;
  background: #e0f2fe !important;
  border: 0 !important;
  border-left: 1px solid #e5e7eb !important;
  border-right: 1px solid #e5e7eb !important;
  box-shadow: none !important;
  transform: none !important;
  gap: 6px !important;
}

.health-talks-page .talk-actions .follow-action-btn:hover {
  background: #bae6fd !important;
  color: #0c4a6e !important;
}

.health-talks-page .talk-actions .follow-action-btn.is-following {
  background: #f1f5f9 !important;
  color: #475569 !important;
  font-weight: 600 !important;
}

.health-talks-page .talk-actions .follow-action-btn.is-following:hover {
  background: #e2e8f0 !important;
}

body.dark-theme .health-talks-page .talk-actions .follow-action-btn {
  background: #0e7490 !important;
  color: #ecfeff !important;
  border-left-color: #164e63 !important;
  border-right-color: #164e63 !important;
}

body.dark-theme .health-talks-page .talk-actions .follow-action-btn:hover {
  background: #155e75 !important;
  color: #f0fdfa !important;
}

body.dark-theme .health-talks-page .talk-actions .follow-action-btn.is-following {
  background: #334155 !important;
  color: #e2e8f0 !important;
}

body.dark-theme .health-talks-page .talk-actions .follow-action-btn.is-following:hover {
  background: #475569 !important;
}

/* Header pill: beat global button styles */
.health-talks-page .talk-head .follow-btn {
  display: inline-flex !important;
  visibility: visible !important;
  opacity: 1 !important;
  box-shadow: none !important;
  transform: none !important;
}

body.dark-theme .health-talks-page .talk-head .follow-btn {
  background: #0e7490 !important;
  color: #ecfeff !important;
  border: 1px solid #22d3ee !important;
}

body.dark-theme .health-talks-page .talk-head .follow-btn.is-following {
  background: #334155 !important;
  color: #e2e8f0 !important;
  border-color: #475569 !important;
}

.comment-row {
  display: flex;
  gap: 8px;
  padding: 10px 12px 6px;
}

.comment-input-wrap {
  display: flex;
  width: 100%;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
}

.comment-input {
  flex: 1;
  border: 0;
  padding: 11px 12px;
  font-size: 0.95rem;
  outline: none;
  height: 40px;
}

.comment-post-btn {
  /* Match main Post button style/rounded shape */
  width: auto;
  min-width: 78px;
  flex: 0 0 auto !important;
  flex-shrink: 0 !important;
  border-radius: 0 10px 10px 0 !important;
  background: #0ea5e9;
  color: #fff;
  border: 0;
  height: 40px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.comment-post-btn:hover {
  background: #0284c7;
  opacity: 1;
}

.comment-list {
  margin: 0 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.comment-item {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 7px 8px;
  font-size: 0.88rem;
}

.comment-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.comment-meta-wrap {
  min-width: 0;
  flex: 1;
}

.comment-avatar {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  object-fit: cover;
  border: 1px solid #d1d5db;
  flex-shrink: 0;
}

.comment-avatar-fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #bae6fd, #0ea5e9);
  color: #0c4a6e;
  font-weight: 700;
}

.comment-meta {
  font-size: 0.78rem;
  color: #475569;
  font-weight: 600;
}

.comment-text {
  color: #1f2937;
}

.comment-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.comment-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.comment-edit-btn {
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #334155;
  border-radius: 8px;
  height: 28px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.comment-edit-btn:hover {
  background: #f8fafc;
  border-color: #94a3b8;
}

.comment-delete-btn {
  border: 1px solid #fecaca;
  background: #fff1f2;
  color: #b91c1c;
  border-radius: 8px;
  height: 28px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.comment-delete-btn:hover {
  background: #ffe4e6;
  border-color: #fda4af;
}

.comment-actions-mini {
  margin-top: 6px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.comment-mini-btn {
  border: 0;
  background: transparent;
  color: #475569;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
}

.comment-mini-btn:hover {
  color: #0ea5e9;
}

.comment-reply-box {
  margin-top: 8px;
}

.reply-list {
  margin-top: 8px;
  margin-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 2px solid #e5e7eb;
  padding-left: 10px;
}

.reply-item {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 8px;
}

.media-preview img,
.media-preview video {
  margin-top: 8px;
  width: 220px;
  max-width: 100%;
  max-height: 140px;
  object-fit: contain;
  background: #111827;
  border-radius: 8px;
  border: 1px solid #d1d5db;
}

.composer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.composer-box {
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
}

.composer-actions.in-box {
  padding: 8px 10px;
  border-top: 1px solid #e5e7eb;
  margin-top: 0;
  background: #f8fafc;
}

#talk-media {
  display: none;
}

#media-preview {
  padding: 0 12px 12px;
}

#profile-avatar {
  display: none;
}

.media-btn {
  background: #ecfeff;
  border: 1px solid #a5f3fc;
  color: #155e75;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 0.88rem;
  cursor: pointer;
}

.feed-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.feed-follow-hint {
  margin: 6px 0 0;
  font-size: 0.82rem;
  color: #64748b;
  line-height: 1.35;
}

.feed-follow-hint strong {
  color: #0ea5e9;
  font-weight: 700;
}

.feed-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.side-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 14px;
}

.side-card h3 {
  margin: 0 0 8px;
  color: #111827;
}

.side-card p,
.side-card li {
  color: #4b5563;
  font-size: 0.9rem;
}

.empty-state {
  color: #6b7280;
  margin: 10px 0 0;
}

@media (max-width: 768px) {
  .feed-layout { grid-template-columns: 1fr; }
  .feed-side { order: 2; }
  .feed-main { order: 1; }
  .composer-top { flex-direction: column; }
  .feed-head { flex-direction: column; align-items: stretch; }
  .profile-row { align-items: flex-start; }
  .talks-hero-row { align-items: flex-start; }
  .talk-head {
    flex-wrap: wrap;
    align-items: center;
  }
  .follow-btn-wrap {
    width: 100%;
    margin-left: 0;
    padding-top: 6px;
  }
  .follow-btn {
    width: 100%;
    justify-content: center;
  }
}
