/* ===== Inbox card (hero layout) ===== */
.msg-inbox-card {
  width: min(100%, 46rem) !important;
  padding: 1.25rem 1.5rem 1.5rem !important;
}

.msg-inbox-card__header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-block-end: 1rem;
}

.msg-inbox-card__title {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}

.msg-inbox-card__archive-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: none;
}

.msg-inbox-card__archive-link:hover {
  color: var(--brand);
}

.msg-inbox-scroll {
  height: clamp(240px, 40vh, 420px);
  overflow-y: scroll;
  border-radius: 16px;
  border: 1px solid rgb(31 44 37 / 0.1);
  background: rgb(242 237 229 / 0.6);
  padding: 0.6rem;
  scrollbar-width: thin;
  scrollbar-color: var(--brand-mid, #8b7355) transparent;
}

.msg-inbox-scroll::-webkit-scrollbar { width: 5px; }
.msg-inbox-scroll::-webkit-scrollbar-track { background: transparent; }
.msg-inbox-scroll::-webkit-scrollbar-thumb {
  background: var(--brand-mid, #8b7355);
  border-radius: 3px;
}

.msg-inbox-empty {
  padding: 2rem 1rem;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  margin: 0;
}

/* ===== Inbox ===== */
.msg-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.msg-row-wrap {
  position: relative;
  border: 1px solid rgb(58 44 30 / 0.1);
  border-radius: 8px;
  background: rgb(255 252 246 / 0.9);
  transition: background 0.12s ease;
}

.msg-row-wrap:hover {
  background: rgb(255 252 246 / 1);
  border-color: rgb(58 44 30 / 0.2);
}

.msg-row-wrap--unread {
  background: #fff;
  border-color: rgb(11 76 58 / 0.18);
}

.msg-row-wrap--archived {
  opacity: 0.82;
}

.msg-row__link {
  display: grid;
  grid-template-columns: 160px 1fr 90px 12px;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 3.8rem 0.6rem 0.85rem;
  text-decoration: none;
  color: var(--ink);
}

.msg-row__from {
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.msg-row__subject {
  font-size: 0.82rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink-soft);
}

.msg-row--unread .msg-row__subject {
  color: var(--ink);
  font-weight: 600;
}

.msg-row__ref {
  margin-inline-start: 0.4rem;
  font-size: 0.72rem;
  color: #0b4c3a;
  background: rgb(11 76 58 / 0.08);
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
}

.msg-row__date {
  font-size: 0.72rem;
  color: var(--ink-soft);
  text-align: right;
  white-space: nowrap;
}

.msg-row__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #0b4c3a;
  flex-shrink: 0;
}

.msg-row__direction {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-inline-end: 0.2rem;
}

.msg-row__archived-label {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted, #999);
}

.msg-row__actions {
  position: absolute;
  inset-block: 0;
  inset-inline-end: 0;
  display: flex;
  align-items: center;
  gap: 0.15rem;
  padding-inline: 0.45rem;
  opacity: 0;
  transition: opacity 0.12s;
}

.msg-row-wrap:hover .msg-row__actions,
.msg-row-wrap:focus-within .msg-row__actions {
  opacity: 1;
}

.msg-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: var(--surface, #fff);
  cursor: pointer;
  color: var(--ink-soft);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
  padding: 0;
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.06);
}

.msg-action-btn--archive:hover,
.msg-action-btn--restore:hover {
  background: rgb(11 76 58 / 0.08);
  border-color: rgb(11 76 58 / 0.2);
  color: #0b4c3a;
}

.msg-action-btn--delete:hover {
  background: rgb(180 40 40 / 0.08);
  border-color: rgb(180 40 40 / 0.2);
  color: #b42828;
}

/* ===== Message detail ===== */
.msg-back {
  display: inline-block;
  margin-block-end: 1.25rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
  text-decoration: none;
}

.msg-back:hover { text-decoration: underline; }

.msg-ref-banner {
  margin-block-end: 1.25rem;
  padding: 0.5rem 0.85rem;
  border-radius: 8px;
  background: rgb(11 76 58 / 0.06);
  font-size: 0.82rem;
  color: #0b4c3a;
}

.msg-ref-banner a {
  color: inherit;
  font-weight: 700;
}

.msg-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-block-end: 1.75rem;
}

.msg-bubble {
  max-width: 80%;
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-size: 0.88rem;
  line-height: 1.55;
}

.msg-bubble--theirs {
  align-self: flex-start;
  background: rgb(255 252 246 / 1);
  border: 1px solid rgb(58 44 30 / 0.12);
  border-bottom-left-radius: 4px;
}

.msg-bubble--mine {
  align-self: flex-end;
  background: rgb(11 76 58 / 0.08);
  border: 1px solid rgb(11 76 58 / 0.14);
  border-bottom-right-radius: 4px;
}

.msg-bubble__meta {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  margin-block-end: 0.35rem;
}

.msg-bubble__from {
  font-size: 0.75rem;
  font-weight: 700;
  color: #0b4c3a;
}

.msg-bubble__date {
  font-size: 0.7rem;
  color: var(--ink-soft);
}

.msg-bubble__body { color: var(--ink); }

.msg-reply-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding-block-start: 1rem;
  border-top: 1px solid rgb(58 44 30 / 0.1);
}

.msg-reply-form__textarea {
  width: 100%;
  padding: 0.7rem 0.9rem;
  border: 1px solid rgb(58 44 30 / 0.18);
  border-radius: 10px;
  font-family: var(--font-sans);
  font-size: 0.88rem;
  line-height: 1.5;
  resize: vertical;
  background: #fff;
  color: var(--ink);
}

.msg-reply-form__textarea:focus {
  outline: none;
  border-color: #0b4c3a;
}

.msg-detail-scroll {
  height: auto;
  max-height: clamp(240px, 38vh, 380px);
  overflow-y: auto;
}

.msg-reply-form--card {
  border-top: 1px solid rgb(31 44 37 / 0.1);
  padding-block-start: 0.85rem;
  margin-block-start: 0.85rem;
}

.msg-awaiting-reply {
  padding-block-start: 1rem;
  border-top: 1px solid rgb(58 44 30 / 0.1);
  font-size: 0.82rem;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
  margin: 0;
}

/* ===== Moderation bar (recipe/article detail) ===== */
.mod-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 800;
  background: rgb(15 20 15 / 0.96);
  backdrop-filter: blur(8px);
  border-top: 1px solid rgb(255 255 255 / 0.08);
  padding: 0.6rem 1rem;
}

.mod-bar__inner {
  max-width: 1200px;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.mod-bar__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: rgb(255 255 255 / 0.45);
  margin-inline-end: 0.25rem;
  white-space: nowrap;
}

.mod-bar__btn {
  display: inline-flex;
  align-items: center;
  padding: 0.28rem 0.8rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
  line-height: 1.4;
}

.mod-bar__btn:hover { opacity: 0.82; }

.mod-bar__btn--approve {
  background: rgb(11 76 58 / 0.9);
  color: #fff;
}

.mod-bar__btn--reject {
  background: rgb(255 193 7 / 0.18);
  color: rgb(255 220 80);
  border-color: rgb(255 193 7 / 0.35);
}

.mod-bar__btn--delete {
  background: rgb(180 40 40 / 0.15);
  color: rgb(255 140 140);
  border-color: rgb(180 40 40 / 0.35);
}

.mod-bar__btn--block {
  background: rgb(60 60 60 / 0.2);
  color: rgb(235 235 235);
  border-color: rgb(255 255 255 / 0.18);
}

.mod-bar__btn--message {
  background: rgb(80 120 200 / 0.15);
  color: rgb(140 180 255);
  border-color: rgb(80 120 200 / 0.3);
}

.mod-bar__btn--back {
  background: transparent;
  color: rgb(255 255 255 / 0.4);
  border-color: rgb(255 255 255 / 0.12);
  margin-inline-start: auto;
}

/* Message form panel in mod-bar */
.mod-bar__message-panel {
  display: none;
  width: 100%;
  margin-block-start: 0.6rem;
  padding-block-start: 0.6rem;
  border-top: 1px solid rgb(255 255 255 / 0.08);
}

.mod-bar__message-panel.is-open { display: flex; gap: 0.5rem; align-items: flex-start; }

.mod-bar__message-panel textarea {
  flex: 1;
  padding: 0.5rem 0.75rem;
  border: 1px solid rgb(255 255 255 / 0.15);
  border-radius: 8px;
  background: rgb(255 255 255 / 0.06);
  color: #fff;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  resize: none;
  min-height: 60px;
}

.mod-bar__message-panel textarea::placeholder { color: rgb(255 255 255 / 0.3); }
.mod-bar__message-panel textarea:focus { outline: none; border-color: rgb(255 255 255 / 0.3); }

/* ===== Messages badge in header ===== */
.msg-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #c0392b;
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  line-height: 1;
  margin-inline-start: 0.3rem;
  vertical-align: middle;
}

@media (max-width: 600px) {
  .msg-row__link {
    grid-template-columns: 1fr 80px;
    grid-template-rows: auto auto;
  }
  .msg-row__from { grid-column: 1; grid-row: 1; }
  .msg-row__date { grid-column: 2; grid-row: 1; }
  .msg-row__subject { grid-column: 1 / -1; grid-row: 2; }
  .msg-row__dot { display: none; }

  .msg-row__actions { opacity: 1; }

  .mod-bar__inner { gap: 0.35rem; }
  .mod-bar__btn--back { margin-inline-start: 0; }
}
