/* Hide legacy Open link bar if old cached JS still runs */
#email-links,
.buyer-inbox-links {
  display: none !important;
}

/* Email fetcher — themed single-message inbox */
.buyer-inbox-shell {
  position: relative;
  overflow: hidden;
  padding: 0;
  margin-bottom: 1.25rem;
  border-radius: 18px;
  background: linear-gradient(155deg, rgba(92, 20, 32, 0.96) 0%, rgba(36, 8, 12, 0.98) 55%, rgba(18, 4, 7, 0.99) 100%);
  border: 1px solid rgba(255, 150, 150, 0.16);
  box-shadow:
    0 14px 38px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 200, 200, 0.1);
}

.buyer-inbox-shell::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 38%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

.buyer-inbox-toolbar {
  position: relative;
  z-index: 1;
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
  padding: 1.1rem 1.1rem 0.85rem;
  border-bottom: 1px solid rgba(255, 140, 140, 0.12);
}

.buyer-inbox-select-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.buyer-inbox-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #b87878;
}

.buyer-inbox-select {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 140, 140, 0.2);
  background: rgba(0, 0, 0, 0.28);
  color: #fff0f0;
  font-size: 0.9rem;
}

.buyer-inbox-select:focus {
  outline: none;
  border-color: rgba(255, 120, 130, 0.45);
  box-shadow: 0 0 0 2px rgba(229, 9, 20, 0.15);
}

.buyer-inbox-fetch-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.1rem;
  white-space: nowrap;
  border-radius: 12px;
}

.buyer-inbox-viewport {
  position: relative;
  z-index: 1;
  min-height: 220px;
  padding: 1rem 1.1rem 1.15rem;
}

.buyer-inbox-empty {
  text-align: center;
  padding: 2rem 1rem 1.5rem;
  color: #c89898;
}

.buyer-inbox-empty-icon {
  width: 52px;
  height: 52px;
  margin: 0 auto 0.75rem;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 140, 140, 0.14);
}

.buyer-inbox-empty strong {
  display: block;
  color: #ffe4e4;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.buyer-inbox-empty p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.5;
  max-width: 28rem;
  margin-inline: auto;
}

.buyer-inbox-message {
  position: relative;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(255, 140, 140, 0.14);
  box-shadow: inset 0 1px 0 rgba(255, 200, 200, 0.06);
}

.buyer-inbox-message-gloss {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 40%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.05) 0%, transparent 100%);
  pointer-events: none;
}

.buyer-inbox-message-head {
  position: relative;
  padding: 1rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(255, 140, 140, 0.1);
}

.buyer-inbox-badge {
  display: inline-block;
  margin-bottom: 0.55rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #ffc8c8;
  background: rgba(229, 9, 20, 0.22);
  border: 1px solid rgba(255, 120, 130, 0.28);
}

.buyer-inbox-subject {
  margin: 0 0 0.75rem;
  font-family: 'Syne', system-ui, sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.35;
  color: #fff0f0;
}

.buyer-inbox-meta-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.buyer-inbox-meta-row span {
  display: block;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #a87878;
  margin-bottom: 0.15rem;
}

.buyer-inbox-meta-row strong {
  display: block;
  font-size: 0.82rem;
  color: #ffe4e4;
  word-break: break-word;
}

.buyer-inbox-body {
  position: relative;
  max-height: 420px;
  overflow: auto;
  padding: 1rem 1.05rem;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #e8c8c8;
  white-space: pre-wrap;
  word-break: break-word;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 120, 130, 0.35) transparent;
}

.buyer-inbox-body--html {
  white-space: normal;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0%, transparent 42%),
    rgba(0, 0, 0, 0.28);
  border-top: 1px solid rgba(255, 140, 140, 0.08);
  color: #f0d4d4;
}

.buyer-inbox-body--html table,
.buyer-inbox-body--html tbody,
.buyer-inbox-body--html tr,
.buyer-inbox-body--html td,
.buyer-inbox-body--html th,
.buyer-inbox-body--html div,
.buyer-inbox-body--html p,
.buyer-inbox-body--html span {
  background: transparent !important;
  background-color: transparent !important;
}

.buyer-inbox-body--html img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.buyer-inbox-body a,
.buyer-inbox-body--html a,
.buyer-inbox-email-link {
  color: #ffb4b4 !important;
  text-decoration: underline !important;
  text-underline-offset: 2px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
}

.buyer-inbox-body a:hover,
.buyer-inbox-body--html a:hover,
.buyer-inbox-email-link:hover {
  color: #ffe0e0 !important;
}

.buyer-inbox-body--html center,
.buyer-inbox-body--html [align="center"] {
  text-align: center;
}

.buyer-inbox-body--html h1,
.buyer-inbox-body--html h2,
.buyer-inbox-body--html h3,
.buyer-inbox-body--html strong,
.buyer-inbox-body--html b {
  color: #fff0f0 !important;
}

.buyer-inbox-body--html p,
.buyer-inbox-body--html li,
.buyer-inbox-body--html td,
.buyer-inbox-body--html span {
  color: #e8c8c8 !important;
}

.buyer-inbox-guide {
  margin-top: 0;
}

.buyer-inbox-guide h2 {
  font-family: 'Syne', system-ui, sans-serif;
  text-transform: lowercase;
  color: #fff0f0;
}

.buyer-email-guide {
  margin-top: 1rem;
}

.buyer-email-guide-steps {
  list-style: none;
  display: grid;
  gap: 0.85rem;
  margin: 0;
  padding: 0;
  counter-reset: guide-step;
}

.buyer-email-guide-steps li {
  counter-increment: guide-step;
  padding: 0.75rem 0.85rem;
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 140, 140, 0.12);
  border-radius: 10px;
}

.buyer-email-guide-steps li::before {
  content: counter(guide-step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-right: 0.45rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: #fff0f0;
  background: rgba(229, 9, 20, 0.45);
  border-radius: 999px;
  vertical-align: middle;
}

.buyer-email-guide-steps strong {
  font-size: 0.9rem;
  color: #ffe4e4;
}

.buyer-email-guide-steps p {
  margin: 0.35rem 0 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: #c89898;
}

.buyer-email-guide-tip {
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: #a87878;
}

.buyer-email-guide .dashboard-empty {
  margin-top: 0.75rem;
}

@media (max-width: 640px) {
  .buyer-inbox-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .buyer-inbox-fetch-btn {
    justify-content: center;
  }

  .buyer-inbox-meta-row {
    grid-template-columns: 1fr;
  }
}
