/* Money fixes (owner audit, 21 Oct 2026) — Earnings withdrawal pop-up,
   withdrawal history receipt, income cards, Coin/Star history paging.
   Loaded after style.css; every rule is scoped to these surfaces. */

/* ── Request payout: always a centred pop-up (owner rule), never a bottom
   sheet that runs off a phone screen. The card scrolls inside itself. ── */
#withdrawalModal.video-upload-overlay {
  align-items: center;
  justify-content: center;
  padding: 16px;
}
#withdrawalModal .vu-modal {
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  border-radius: 20px;
}
@media (max-width: 600px) {
  #withdrawalModal.video-upload-overlay { align-items: center; padding: 16px; }
  #withdrawalModal .vu-modal { border-radius: 20px; max-width: 100%; }
}

/* Server-quote states */
.payout-fee-rows:empty { display: none; }
.payout-fee-row.payout-fee-checking .payout-fee-label { font-style: italic; opacity: 0.8; }
.payout-fee-status { min-height: 1.1em; margin: 0 0 0.4rem; font-size: 0.8rem; color: #dc2626; }
body:not(.light) .payout-fee-status { color: #ff97a6; }
.payout-quote-retry {
  margin-left: 0.4rem;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
#withdrawalSubmit:disabled { opacity: 0.55; cursor: not-allowed; }

/* ── Income categories: Videos / Books / Posts / Gifts (+ Subscriptions,
   Other when they carry money), two to a row as cards. ── */
.earnings-breakdown { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.earnings-breakdown-card[hidden] { display: none; }
@media (max-width: 640px) {
  .earnings-breakdown { grid-template-columns: 1fr; }
}

/* ── Withdrawal history receipt: requested / fees / amount paid ── */
.earnings-withdrawal-receipt {
  margin: 0.45rem 0 0;
  display: grid;
  gap: 0.15rem;
  font-size: 0.8rem;
}
.earnings-withdrawal-receipt > div {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  max-width: 22rem;
}
.earnings-withdrawal-receipt dt { color: var(--text2); }
.earnings-withdrawal-receipt dd { margin: 0; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

/* ── Coin / Star history: current balance + All / Earned / Spent + paging ── */
.wallet-history-modal .wallet-history-summary { grid-template-columns: 1fr; }
.wallet-history-filters {
  display: flex;
  gap: 0.4rem;
  padding: 0.7rem 1.4rem 0.2rem;
  flex-wrap: wrap;
}
.wallet-history-filter {
  padding: 0.3rem 0.85rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.28);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.wallet-history-filter.is-active {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fff;
}
.wallet-history-more {
  display: block;
  margin: 0.5rem auto 1rem;
  padding: 0.45rem 1.2rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.wallet-history-more[hidden] { display: none; }
.wallet-history-more:disabled { opacity: 0.6; cursor: default; }
@media (max-width: 600px) {
  .wallet-history-filters { padding: 0.6rem 1rem 0.2rem; }
}

/* ── Contrast fixes (owner rule 21 Oct: visual defects are fixed, not reported) ──
   Buttons do not inherit text colour, so the card's coin line rendered in the
   browser's button ink (black) on the dark card. */
.earnings-breakdown-card { color: var(--text); }
.earnings-breakdown-coins {
  font-size: 0.74rem;
  color: var(--text2);
  margin-top: 0.15rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

/* Status chips: every stored status has a chip, readable on both themes. */
.earnings-row-status-verified,
.earnings-row-status-adjusted   { background: rgba(34, 197, 94, 0.10); color: #166534; }
.earnings-row-status-rejected,
.earnings-row-status-w-failed   { background: rgba(220, 38, 38, 0.10); color: #991b1b; }
body:not(.light) .earnings-row-status-pending,
body:not(.light) .earnings-row-status-w-pending   { background: rgba(251, 191, 36, 0.14); color: #fcd34d; }
body:not(.light) .earnings-row-status-available,
body:not(.light) .earnings-row-status-verified,
body:not(.light) .earnings-row-status-adjusted,
body:not(.light) .earnings-row-status-w-approved  { background: rgba(74, 222, 128, 0.14); color: #86efac; }
body:not(.light) .earnings-row-status-withdrawn,
body:not(.light) .earnings-row-status-w-paid      { background: rgba(var(--accent-rgb), 0.22); color: #ddd6fe; }
body:not(.light) .earnings-row-status-reversed,
body:not(.light) .earnings-row-status-rejected,
body:not(.light) .earnings-row-status-w-rejected,
body:not(.light) .earnings-row-status-w-failed    { background: rgba(248, 113, 113, 0.14); color: #fca5a5; }
body:not(.light) .earnings-row-status-w-cancelled { background: rgba(209, 213, 219, 0.12); color: #e5e7eb; }
body:not(.light) .earnings-row-amount { color: #fcd34d; }

/* Refresh had no base style and rendered as a bare browser button. */
.earnings-refresh-btn {
  padding: 0.35rem 0.95rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.35);
  background: transparent;
  color: var(--accent-dark);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
}
body:not(.light) .earnings-refresh-btn { color: #ddd6fe; border-color: rgba(var(--accent-rgb), 0.5); }

/* Request payout, light theme: the grey hint / subtitle ink was 2.5:1 on white. */
body.light #withdrawalModal .vu-subtitle,
body.light #withdrawalModal .vu-hint { color: #4b5563; }

/* Coin / Star history, dark theme */
body:not(.light) .wallet-history-more { color: #ddd6fe; border-color: rgba(var(--accent-rgb), 0.55); }
body:not(.light) .wallet-history-modal .wallet-history-summary-label { color: #ede9fe; opacity: 1; }
body:not(.light) .wallet-history-filter { color: #e5e7eb; border-color: rgba(var(--accent-rgb), 0.45); }
body.light .wallet-history-modal .wallet-history-summary-label { color: #3b0764; opacity: 1; }

/* Request payout errors: readable on both themes (the pink ink was 1.7:1 on light). */
#withdrawalError { color: #ff97a6; }
body.light #withdrawalError { color: #b91c1c; }

/* ── Monthly earnings by earned_at (21 Oct 2026, money-goals-003) ─────────── */
.earnings-month-about {
  margin-top: 0.4rem;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  color: #4c1d95;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
body:not(.light) .earnings-month-about { color: #ede9fe; }

/* The app's one-time notice — a centred pop-up (owner rule). Its own ink, so
   nothing inherits a dark colour onto the dark panel. */
#monthlyEarningsNoticeModal.modal-overlay { align-items: center; justify-content: center; padding: 16px; z-index: 1600; }
.monthly-earnings-notice {
  position: relative;
  max-width: 460px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  text-align: center;
  color: var(--text);
}
.monthly-earnings-notice .modal-close-btn { position: absolute; top: 12px; right: 12px; }
.monthly-earnings-notice-icon {
  width: 46px; height: 46px; margin: 0.25rem auto 0;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent-strong);
}
.monthly-earnings-notice-title { margin: 0.75rem 0 0.25rem; font-size: 1.15rem; font-weight: 700; color: var(--text); }
.monthly-earnings-notice-body { text-align: left; }
.monthly-earnings-notice-body p { margin: 0.75rem 0 0; font-size: 0.86rem; line-height: 1.5; color: var(--text2); }
.monthly-earnings-notice-ok { margin-top: 1.1rem; width: 100%; }
body:not(.light) .monthly-earnings-notice-icon { color: #ddd6fe; }

/* Earnings page contrast (owner rule 21 Oct; measured in both themes). Scoped to
   #earningsPage so the shared Studio pager elsewhere is untouched. */
body.light #earningsPage .author-earnings-total-lifetime {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.24), rgba(var(--accent-rgb), 0.12));
}
body.light #earningsPage .author-earnings-total-label { color: #4c1d95; }
body.light #earningsPage .author-earnings-total-foot { color: #4b5563; }
body:not(.light) #earningsPage .author-earnings-total-label { color: #ede9fe; }
body:not(.light) #earningsPage .author-earnings-total-foot { color: #d1d5db; }
body.light #earningsPage .studio-pagination {
  background: linear-gradient(180deg, rgba(var(--accent-rgb), 0.16), rgba(var(--accent-rgb), 0.10));
}
body.light #earningsPage .studio-pagination-label,
body.light #earningsPage .studio-pagination-info { color: #4c1d95; }
body.light #earningsPage .studio-pagesize-option:not(.is-selected) { color: #5b21b6; }
body:not(.light) #earningsPage .studio-pagination-label,
body:not(.light) #earningsPage .studio-pagination-info { color: #ede9fe; }
body:not(.light) #earningsPage .studio-pagesize-option:not(.is-selected) { color: #ddd6fe; }
#earningsPage .studio-pagesize-option.is-selected { background: #6d28d9; }
.monthly-earnings-notice-ok.btn-purple { background: #6d28d9; color: #fff; }
