/* admin-referrals.css — Referral & Charity Pot admin tab styles
   Uses the same light purple design tokens as the rest of the admin panel.
   Tokens: --bg #f9f5ff · --bg2 #f2ecff · --bg3 #e8deff · --card-bg #FDFAF6
           --text #1A1025 · --muted #4a3968 · --blue #6C3CE1 · --border #d4c6f8
*/

/* ── Form grid ── */
.ref-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  align-items: end;
}

/* ── Labels ── */
.ref-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted, #4a3968);
  margin-bottom: 4px;
  line-height: 1.4;
}

/* ── Ratio badge (shows total % of charities) ── */
.ref-ratio-badge {
  display: inline-block;
  font-size: 0.82rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--bg3, #e8deff);
  color: var(--muted, #4a3968);
  transition: background 0.15s, color 0.15s;
}
.ref-ratio-ok {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.ref-ratio-over {
  background: rgba(220, 38, 38, 0.1);
  color: #dc2626;
}
.ref-ratio-under {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

/* ── Stat chips (KPI cards in the stats row) ── */
.ref-stat-chip {
  background: var(--bg2, #f2ecff);
  border: 1px solid var(--border, #d4c6f8);
  border-radius: 10px;
  padding: 12px 16px;
  min-width: 110px;
  text-align: center;
}
.ref-stat-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--blue, #6C3CE1);
  line-height: 1.2;
}
.ref-stat-lbl {
  font-size: 0.73rem;
  color: var(--muted, #4a3968);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ref-stat-sub {
  font-size: 0.75rem;
  color: var(--muted, #4a3968);
  margin-top: 4px;
}

/* ── Calculation summary grid ── */
.ref-calc-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

/* ── Alert boxes ── */
.ref-alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.84rem;
  line-height: 1.5;
  border: 1px solid transparent;
}
.ref-alert-warn {
  background: rgba(245, 158, 11, 0.08);
  border-color: rgba(245, 158, 11, 0.3);
  color: #92400e;
}
.ref-alert-err {
  background: rgba(220, 38, 38, 0.07);
  border-color: rgba(220, 38, 38, 0.25);
  color: #dc2626;
}

/* ── Charity rows ── */
.ref-charity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #d4c6f8);
}
.ref-charity-row:last-child {
  border-bottom: none;
}

/* ── Active / inactive status badges ── */
.ref-badge-active,
.ref-badge-inactive {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.ref-badge-active {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.ref-badge-inactive {
  background: var(--bg3, #e8deff);
  color: var(--muted, #4a3968);
}

/* ── Settings card variant ── */
.ref-settings-card {
  /* Extends .admin-card */
}

/* ── Settings view mode (read-only display) ── */
.ref-settings-view-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.ref-settings-view-row {
  background: var(--bg2, #f2ecff);
  border: 1px solid var(--border, #d4c6f8);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ref-settings-view-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #4a3968);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ref-settings-view-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text, #1A1025);
  line-height: 1.3;
}

.ref-settings-view-note {
  font-size: 0.73rem;
  color: var(--muted, #4a3968);
  line-height: 1.4;
}

/* ── Settings value pills ── */
.ref-settings-pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 0.92rem;
  font-weight: 700;
}
.ref-settings-pill--blue {
  background: rgba(108, 60, 225, 0.12);
  color: var(--blue, #6C3CE1);
}
.ref-settings-pill--green {
  background: rgba(16, 185, 129, 0.12);
  color: #059669;
}
.ref-settings-pill--amber {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}
.ref-settings-pill--neutral {
  background: var(--bg3, #e8deff);
  color: var(--text, #1A1025);
}

/* ── Calculate Distribution: live preview chips ── */
.ref-calc-preview-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg2, #f2ecff);
  border: 1px solid var(--border, #d4c6f8);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.82rem;
}

.ref-calc-preview-label {
  color: var(--muted, #4a3968);
  font-size: 0.76rem;
}

.ref-calc-preview-val {
  font-weight: 700;
  font-size: 0.92rem;
}

.ref-calc-preview-val--blue {
  color: var(--blue, #6C3CE1);
}

.ref-calc-preview-val--green {
  color: #059669;
}

.ref-calc-preview-pct {
  color: var(--muted, #4a3968);
  font-size: 0.74rem;
}

/* ── iOS zoom fix: all inputs in referrals must be ≥16px font-size ── */
/* iOS Safari zooms in on any input with font-size < 16px */
#ref-calc-month,
#ref-calc-revenue,
.ref-modal-input,
#modal-ref-pot-pct,
#modal-charity-pot-pct,
#modal-ref-min,
#modal-ref-max-single,
#modal-ref-min-payout,
#charity-add-name,
#charity-add-number,
#charity-add-email,
#charity-add-contact,
#charity-add-ratio,
#charity-add-desc,
#settings-charity-pot-pct,
.charity-ratio-input {
  font-size: 16px !important;
}
