/* Top-bar Messages and Email feeds (PD-739): compact rows, read/unread states, infinite scroll. */

.admin-feed-panel.admin-live-dropdown {
  width: min(440px, 94vw);
  max-height: min(78vh, 640px);
  padding: 0;
  display: none;
  flex-direction: column;
  overflow: hidden;
  background: var(--card, #fff);
  color: var(--ink, #111827);
}

.admin-feed-panel.admin-live-dropdown.show {
  display: flex;
}

.admin-feed-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}

.admin-feed-heading {
  flex: 1 1 auto;
  min-width: 0;
}

.admin-feed-heading .title {
  font-size: 13px;
  font-weight: 700;
}

.admin-feed-heading .summary {
  font-size: 11px;
  color: var(--muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-feed-mark-all {
  font-size: 12px;
  white-space: nowrap;
}

.admin-feed-close {
  border: 0;
  background: transparent;
  color: var(--muted, #6b7280);
  font-size: 20px;
  line-height: 1;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  cursor: pointer;
}

.admin-feed-close:hover,
.admin-feed-close:focus-visible {
  background: rgba(37, 99, 235, 0.08);
  color: var(--ink, #111827);
}

.admin-feed-list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  flex: 1 1 auto;
}

.admin-feed-row {
  position: relative;
  border-bottom: 1px solid var(--line, #eef0f4);
}

.admin-feed-sentinel {
  height: 1px;
}

.admin-feed-open {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  column-gap: 8px;
  width: 100%;
  padding: 7px 10px 2px;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.admin-feed-open:hover,
.admin-feed-open:focus-visible {
  background: rgba(37, 99, 235, 0.06);
  outline: none;
}

.admin-feed-open:focus-visible {
  box-shadow: inset 0 0 0 2px #2563eb;
}

.admin-feed-dot {
  grid-row: 1 / span 2;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: transparent;
}

.admin-feed-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  font-size: 13px;
}

.admin-feed-sender {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.admin-feed-channel,
.admin-feed-linked,
.admin-feed-tag {
  flex: 0 0 auto;
  font-size: 10px;
  line-height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid var(--line, #e2e8f0);
  color: var(--muted, #475569);
  white-space: nowrap;
}

.admin-feed-linked {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.admin-feed-tag {
  border-color: #fcd34d;
  color: #92400e;
  background: #fffbeb;
}

.admin-feed-time {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted, #6b7280);
  white-space: nowrap;
}

.admin-feed-preview {
  grid-column: 2;
  font-size: 12px;
  color: var(--muted, #6b7280);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Unread: bold sender, dark preview, blue dot and a left rule. Read rows stay visible but quiet. */
.admin-feed-row.is-unread {
  background: rgba(37, 99, 235, 0.04);
  box-shadow: inset 3px 0 0 #2563eb;
}

.admin-feed-row.is-unread .admin-feed-dot {
  background: #2563eb;
}

.admin-feed-row.is-unread .admin-feed-sender {
  font-weight: 700;
}

.admin-feed-row.is-unread .admin-feed-preview {
  color: var(--ink, #1f2937);
}

/* Desktop: actions sit at the end of the preview line so each row is two lines tall. */
.admin-feed-open {
  padding-bottom: 6px;
}

.admin-feed-row .admin-feed-preview {
  padding-right: var(--admin-feed-actions-width, 150px);
}

.admin-feed-actions {
  position: absolute;
  right: 10px;
  top: 24px;
  display: flex;
  gap: 10px;
}

.admin-feed-action {
  border: 0;
  background: transparent;
  padding: 2px 0;
  min-height: 24px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  color: #1d4ed8;
  cursor: pointer;
}

.admin-feed-action:hover,
.admin-feed-action:focus-visible {
  text-decoration: underline;
}

.admin-feed-reply {
  padding: 0 10px 8px 28px;
}

.admin-feed-reply textarea {
  width: 100%;
  box-sizing: border-box;
  font: inherit;
  font-size: 12px;
  border: 1px solid var(--line, #cbd5e1);
  border-radius: 6px;
  padding: 6px;
  resize: vertical;
}

.admin-feed-reply-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 11px;
}

.admin-feed-empty {
  padding: 16px 12px;
  font-size: 12px;
}

.admin-feed-more {
  display: block;
  width: 100%;
  padding: 8px;
  font-size: 12px;
  border-top: 1px solid var(--line, #e5e7eb);
}

.admin-feed-more[hidden] {
  display: none;
}

.admin-live-btn .count.is-zero {
  opacity: 0.55;
}

.admin-feed-review-count {
  font-size: 10px;
  font-weight: 700;
  line-height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  border: 1px solid #fcd34d;
  background: #fffbeb;
  color: #92400e;
  white-space: nowrap;
}

.admin-feed-review-count[hidden] {
  display: none;
}

@media (max-width: 960px) {
  .admin-feed-panel.admin-live-dropdown {
    width: auto;
    max-height: calc(100vh - 84px);
  }

  .admin-feed-review-count {
    display: none;
  }
}

@media (max-width: 640px) {
  .topbar.show {
    grid-template-columns: minmax(0, 1fr) auto auto auto auto;
    grid-template-areas:
      "left left left left account"
      "search buyers messages email voice";
  }

  .topbar-right > .admin-email-wrap {
    grid-area: email;
  }

  /* Matches the mobile dropdown offset in admin-shell-mobile.css (safe area + two top-bar rows). */
  .admin-feed-panel.admin-live-dropdown {
    max-height: calc(100dvh - var(--shell-mobile-safe-top, 8px) - 108px);
  }

  .admin-feed-open {
    padding-top: 9px;
    padding-bottom: 2px;
  }

  .admin-feed-row .admin-feed-preview {
    padding-right: 0;
  }

  .admin-feed-actions {
    position: static;
    flex-wrap: wrap;
    gap: 2px 14px;
    padding: 0 10px 6px 28px;
  }

  .admin-feed-action {
    min-height: 32px;
    font-size: 12px;
  }
}
