.fourbp-aff-dashboard {
  max-width: 960px;
  font-family: inherit;
  color: inherit;
}

.fourbp-aff-dashboard h2 {
  margin: 0 0 0.5em;
  font-size: 1.6em;
}
.fourbp-aff-dashboard h3 {
  margin: 0 0 0.6em;
  font-size: 1.15em;
}

.fourbp-aff-empty,
.fourbp-aff-section {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1.25em 1.5em;
  margin-bottom: 1em;
}

.fourbp-aff-header {
  padding: 1.25em 1.5em;
  margin-bottom: 1em;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}
.fourbp-aff-header-meta {
  display: flex;
  gap: 1em;
  align-items: center;
  flex-wrap: wrap;
}

.fourbp-aff-status {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fourbp-aff-status.status-active {
  background: #d4edda;
  color: #155724;
}
.fourbp-aff-status.status-paused {
  background: #fff3cd;
  color: #856404;
}
.fourbp-aff-status.status-disabled {
  background: #f8d7da;
  color: #721c24;
}

.fourbp-aff-invoice-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-size: 0.75em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fourbp-aff-invoice-badge.is-invoiced {
  background: #d4edda;
  color: #155724;
}
.fourbp-aff-invoice-badge.is-pending {
  background: #e2e3e5;
  color: #41464b;
}

.fourbp-aff-code-label code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 3px;
}

.fourbp-aff-notice {
  padding: 0.75em 1em;
  border-radius: 6px;
  margin-bottom: 1em;
  border-left: 4px solid #999;
}
.fourbp-aff-notice-info {
  background: #e6f4fa;
  border-left-color: #2271b1;
  color: #0a4b6e;
}
.fourbp-aff-notice-warning {
  background: #fff8e5;
  border-left-color: #dba617;
  color: #674d00;
}
.fourbp-aff-notice-error {
  background: #fcf0f1;
  border-left-color: #d63638;
  color: #5d1416;
}

.fourbp-aff-link-row {
  display: flex;
  gap: 0.5em;
  align-items: center;
  margin-bottom: 0.5em;
  flex-wrap: wrap;
}
.fourbp-aff-link-row label {
  flex: 0 0 120px;
  font-weight: 600;
}
.fourbp-aff-link-row input {
  flex: 1 1 320px;
  padding: 6px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.9em;
  background: #f9fafb;
  min-width: 0;
}

.fourbp-aff-copy {
  background: var(--toa-crimson);
  color: var(--toa-white);
  border: none;
  padding: 8px 16px;
  border-radius: var(--toa-btn-radius, 4px);
  cursor: pointer;
  font-family: var(--toa-font-body);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  transition: background-color var(--toa-transition-fast, 0.15s ease);
}
.fourbp-aff-copy:hover {
  background: var(--toa-crimson-light);
  color: var(--toa-white);
}
.fourbp-aff-copy.is-copied {
  background: var(--toa-gold);
  color: var(--toa-crimson);
}

.fourbp-aff-btn {
  display: inline-block;
  background: var(--toa-crimson);
  color: var(--toa-white);
  padding: 12px 24px;
  border-radius: var(--toa-btn-radius, 4px);
  text-decoration: none;
  font-family: var(--toa-font-body);
  font-weight: 700;
  transition: background-color var(--toa-transition-fast, 0.15s ease);
}
.fourbp-aff-btn:hover {
  background: var(--toa-crimson-light);
  color: var(--toa-white);
}

.fourbp-aff-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1em;
}
.fourbp-aff-stat {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 1em;
  text-align: center;
}
.fourbp-aff-stat-value {
  font-size: 1.8em;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.2;
}
.fourbp-aff-stat-label {
  font-size: 0.85em;
  color: #6b7280;
  margin-top: 0.25em;
}

.fourbp-aff-recent {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid #f3f4f6;
}
.fourbp-aff-recent li {
  display: flex;
  gap: 1em;
  padding: 0.5em 0;
  border-bottom: 1px solid #f3f4f6;
  align-items: center;
  font-size: 0.9em;
}
.fourbp-aff-recent-date {
  flex: 0 0 160px;
  color: #6b7280;
}
.fourbp-aff-recent-source {
  flex: 0 0 70px;
  text-transform: uppercase;
  font-size: 0.7em;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
  text-align: center;
  letter-spacing: 0.04em;
}
.fourbp-aff-recent-source.src-route {
  background: #e0e7ff;
  color: #3730a3;
}
.fourbp-aff-recent-source.src-query {
  background: #dcfce7;
  color: #166534;
}
.fourbp-aff-recent-type {
  font-weight: 500;
}
.fourbp-aff-recent-path {
  color: #4b5563;
  font-family: monospace;
  font-size: 0.85em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
}

.fourbp-aff-recent-total {
  margin-left: auto;
  font-weight: 600;
  white-space: nowrap;
}

.fourbp-aff-empty-row {
  color: #9ca3af;
  font-style: italic;
  margin: 0;
}

@media (max-width: 768px) {
  .fourbp-aff-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (max-width: 480px) {
  .fourbp-aff-stats-grid {
    grid-template-columns: 1fr;
  }
  .fourbp-aff-link-row label {
    flex-basis: 100%;
  }
  .fourbp-aff-recent li {
    flex-wrap: wrap;
  }
  .fourbp-aff-recent-date {
    flex-basis: 100%;
  }
}

/* ---------- Payout information ---------- */
.fourbp-aff-payout-hint {
  margin: 0 0 1em;
  color: #4b5563;
  font-size: 0.95em;
}
.fourbp-aff-payout-field {
  margin-bottom: 0.85em;
}
.fourbp-aff-payout-field .fourbplus-form-label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.3em;
}
.fourbp-aff-payout-field .fourbplus-form-input {
  width: 100%;
  max-width: 360px;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 0.95em;
  box-sizing: border-box;
}

/* =============================================================
   MY ACCOUNT → AFFILIATE TAB (Taste of Asia design system)
   Scoped to .fourbp-aff-panel so it only restyles the account
   endpoint, not the [fourbplus_affiliate_dashboard] shortcode.
   Structural cards/stats/inputs reuse the theme's account.css
   (.toa-dash-card, .toa-stats-grid, .toa-field-input, …); the
   rules below cover the affiliate-only widgets.
   ============================================================= */

.fourbp-aff-panel {
  font-family: var(--toa-font-body);
  color: var(--toa-text-dark);
}

/* ---- Profile meta row (status + code + joined) ---- */
.fourbp-aff-panel .fourbp-aff-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.fourbp-aff-panel .fourbp-aff-status {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-family: var(--toa-font-body);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.fourbp-aff-panel .fourbp-aff-status.status-active {
  color: oklch(45% 0.14 145);
  background: oklch(45% 0.14 145 / 0.15);
}
.fourbp-aff-panel .fourbp-aff-status.status-paused {
  color: var(--toa-gold);
  background: rgba(201, 162, 39, 0.18);
}
.fourbp-aff-panel .fourbp-aff-status.status-disabled {
  color: #c0392b;
  background: rgba(192, 57, 43, 0.12);
}

.fourbp-aff-panel .fourbp-aff-code {
  font-size: 13px;
  color: var(--toa-text-muted);
}
.fourbp-aff-panel .fourbp-aff-code code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  font-weight: 700;
  color: var(--toa-crimson);
  background: var(--toa-cream);
  padding: 3px 8px;
  border-radius: 4px;
}

.fourbp-aff-panel .fourbp-aff-joined {
  font-size: 13px;
  color: var(--toa-text-muted);
}

/* ---- Hint / helper text ---- */
.fourbp-aff-panel .fourbp-aff-hint {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--toa-text-muted);
}

/* ---- Share links ---- */
.fourbp-aff-panel .fourbp-aff-link + .fourbp-aff-link {
  margin-top: 6px;
}
.fourbp-aff-panel .fourbp-aff-link-row {
  display: flex;
  gap: 10px;
  align-items: stretch;
  flex-wrap: nowrap;
}
.fourbp-aff-panel .fourbp-aff-link-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 1.5px solid rgba(0, 0, 0, 0.15);
  border-radius: var(--toa-btn-radius, 4px);
  padding: 11px 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--toa-text-dark);
  background: var(--toa-cream);
}
.fourbp-aff-panel .fourbp-aff-link-input:focus {
  outline: none;
  border-color: var(--toa-crimson);
  background: var(--toa-white);
}

/* ---- Payout + request form actions ---- */
.fourbp-aff-panel .fourbp-aff-form-actions {
  margin-top: 4px;
}
.fourbp-aff-panel .fourbp-aff-request-note-input {
  resize: vertical;
  min-height: 110px;
}

/* ---- Request status / note display ---- */
.fourbp-aff-panel .fourbp-aff-request-headline {
  margin: 0;
  font-size: 16px;
  color: var(--toa-text-dark);
}
.fourbp-aff-panel .fourbp-aff-request-sub {
  margin: 0;
  font-size: 14px;
  color: var(--toa-text-muted);
  line-height: 1.6;
}
.fourbp-aff-panel .fourbp-aff-request-denied-hint {
  margin: 0;
  font-size: 13px;
  color: var(--toa-gold);
}
.fourbp-aff-panel .fourbp-aff-request-note-display {
  margin-top: 4px;
}
.fourbp-aff-panel .fourbp-aff-request-note-body {
  margin: 8px 0 0;
  padding: 12px 16px;
  border-left: 3px solid var(--toa-gold);
  background: var(--toa-cream);
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  color: var(--toa-text-dark);
  font-style: italic;
}

/* ---- Notices (TOA-aligned) ---- */
.fourbp-aff-panel .fourbp-aff-notice {
  padding: 12px 16px;
  border-radius: 6px;
  margin: 0;
  font-size: 14px;
  line-height: 1.5;
  border-left: 4px solid var(--toa-text-muted);
}
.fourbp-aff-panel .fourbp-aff-notice-info {
  background: var(--toa-cream);
  border-left-color: var(--toa-crimson);
  color: var(--toa-crimson);
}
.fourbp-aff-panel .fourbp-aff-notice-warning {
  background: rgba(201, 162, 39, 0.12);
  border-left-color: var(--toa-gold);
  color: #6b5410;
}
.fourbp-aff-panel .fourbp-aff-notice-error {
  background: rgba(192, 57, 43, 0.08);
  border-left-color: #c0392b;
  color: #8a241b;
}

/* ---- Copy button: align height with link input ---- */
.fourbp-aff-panel .fourbp-aff-copy {
  flex: 0 0 auto;
}

@media (max-width: 480px) {
  .fourbp-aff-panel .fourbp-aff-link-row {
    flex-wrap: wrap;
  }
  .fourbp-aff-panel .fourbp-aff-copy {
    width: 100%;
  }
}

/* =============================================================
   Featured products picker (My Account → Affiliate)
   ============================================================= */
.fourbp-aff-products {
  margin-top: 8px;
}

/* Toggle switch */
.fourbp-aff-switch {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  user-select: none;
}
.fourbp-aff-switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}
.fourbp-aff-switch-track {
  position: relative;
  display: inline-block;
  width: 46px;
  height: 26px;
  background: #c9ccd2;
  border-radius: 999px;
  transition: background 0.15s ease;
  flex: 0 0 auto;
}
.fourbp-aff-switch-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s ease;
}
.fourbp-aff-switch input:checked + .fourbp-aff-switch-track {
  background: var(--toa-crimson, #82001b);
}
.fourbp-aff-switch input:checked + .fourbp-aff-switch-track .fourbp-aff-switch-thumb {
  transform: translateX(20px);
}
.fourbp-aff-switch input:focus-visible + .fourbp-aff-switch-track {
  outline: 2px solid var(--toa-gold, #c9a227);
  outline-offset: 2px;
}
.fourbp-aff-switch-label {
  font-weight: 600;
}

/* Picker */
.fourbp-aff-products-picker {
  margin-top: 18px;
}
.fourbp-aff-product-search {
  position: relative;
  max-width: 460px;
}
.fourbp-aff-product-results {
  list-style: none;
  margin: 4px 0 0;
  padding: 6px;
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #e2e2e2;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}
.fourbp-aff-product-result {
  padding: 9px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}
.fourbp-aff-product-result:hover {
  background: var(--toa-cream, #f5f5f3);
}
.fourbp-aff-product-result.is-added {
  opacity: 0.5;
  cursor: default;
}
.fourbp-aff-product-result.is-note {
  color: #888;
  cursor: default;
}
.fourbp-aff-product-result.is-note:hover {
  background: transparent;
}

/* Selected chips */
.fourbp-aff-product-selected {
  list-style: none;
  margin: 16px 0 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.fourbp-aff-product-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px 7px 14px;
  background: var(--toa-cream, #f5f5f3);
  border: 1px solid #e2e2e2;
  border-radius: 999px;
  font-size: 13px;
}
.fourbp-aff-product-remove {
  border: 0;
  background: rgba(0, 0, 0, 0.08);
  color: #333;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  line-height: 1;
  cursor: pointer;
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.fourbp-aff-product-remove:hover {
  background: var(--toa-crimson, #82001b);
  color: #fff;
}
.fourbp-aff-product-empty {
  margin: 14px 0 0;
  color: #888;
  font-size: 13px;
}

/* Save row */
.fourbp-aff-products .fourbp-aff-form-actions {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.fourbp-aff-products-status {
  font-size: 13px;
}
.fourbp-aff-products-status.is-success {
  color: #1a7f37;
}
.fourbp-aff-products-status.is-error {
  color: #b3261e;
}
