/* =====================================================================
   Acre & Element Partner Program — Earn look
   Warm terracotta (#A85B32) + charcoal on warm ivory, gold kept to a
   minimum — deliberately DIFFERENT from Track (deep green + gold on
   cream). This palette is the DEFAULT for every page of the portal
   (slice 6: the slices 1–3 pages were restyled into it; the admin
   and slice-5 pages already used it via the body.admin / body.earn
   remap, which is now redundant). System fonts only, no external
   dependencies. Responsive: mobile ~375px, tablet ~768px, desktop.
   ===================================================================== */

:root {
  --green-900: #2b2622;   /* charcoal — headers, buttons */
  --green-700: #a85b32;   /* terracotta — headings, links */
  --green-100: #f6e8db;   /* pale terracotta — accents */
  --accent: #a85b32;      /* terracotta — header/footer rules, nav */
  --gold: #c9a227;        /* gold — kept, used sparingly */
  --gold-dark: #9a7b1a;
  --cream: #fdf8f1;       /* warm ivory — page background */
  --card: #fffdf9;        /* card background */
  --ink: #2b2622;         /* body text */
  --muted: #7a6a5c;
  --line: #e8d8c8;
  --error: #8c2f1b;
  --error-bg: #fbe9e4;
  --success: #a85b32;
  --success-bg: #f6e8db;
  --radius: 10px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               Helvetica, Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--green-700);
  line-height: 1.25;
  margin: 0 0 0.5rem;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.35rem; }

p { margin: 0 0 1rem; }

a { color: var(--green-700); }
a:hover { color: var(--gold-dark); }

.muted { color: var(--muted); font-size: 0.92rem; }

.wrap {
  max-width: 1020px;
  margin: 0 auto;
  padding: 0 1rem;
}

/* --- Header ------------------------------------------------------- */

.site-header {
  background: var(--green-900);
  color: #f4ecd4;
  border-bottom: 3px solid var(--accent);
}

.header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: #f4ecd4;
  text-decoration: none;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.4rem;
  height: 2.4rem;
  border: 2px solid var(--gold);
  border-radius: 50%;
  font-family: Georgia, serif;
  font-weight: bold;
  font-size: 1.05rem;
  color: var(--gold);
}

.brand-amp { font-size: 0.7em; margin: 0 0.05em; }

.brand-text {
  font-family: Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.1;
}

.brand-text small {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; }

.site-nav a {
  color: #f4ecd4;
  text-decoration: none;
  padding: 0.4rem 0.7rem;
  border-radius: 6px;
  font-size: 0.95rem;
}

.site-nav a:hover { background: rgba(168, 91, 50, 0.22); }
.site-nav a.active { background: var(--accent); color: #fdf8f1; }

/* --- Main ---------------------------------------------------------- */

main.wrap { padding-top: 1.5rem; padding-bottom: 2.5rem; }

section { margin-bottom: 2rem; }

.hero {
  background: var(--card);
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.kicker {
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-dark);
}

.hero h1 { font-size: 2rem; }
.lede { font-size: 1.08rem; max-width: 38rem; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 0; }

.hero-photo { margin: 1.25rem 0 0; }
.hero-photo img { display: block; width: 100%; border-radius: var(--radius); }
.hero-photo figcaption { margin-top: 0.5rem; font-size: 0.9rem; }

/* --- Life strip (home page photos) ---------------------------------- */

.life-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.life-strip figure { margin: 0; }
.life-strip img { display: block; width: 100%; border-radius: var(--radius); }
.life-strip figcaption { margin-top: 0.45rem; font-size: 0.92rem; font-weight: 600; }

@media (min-width: 768px) {
  .life-strip { grid-template-columns: repeat(4, 1fr); }
}

/* --- Buttons -------------------------------------------------------- */

.btn {
  display: inline-block;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  border: 2px solid var(--green-900);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary { background: var(--green-900); color: #f4ecd4; }
.btn-primary:hover { background: var(--green-700); color: #fff; }
.btn-ghost { background: transparent; color: var(--green-900); }
.btn-ghost:hover { background: var(--green-100); }

/* --- Cards ---------------------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}

.card h2 { margin-bottom: 0.35rem; }
.card p:last-child { margin-bottom: 0; }

.stat-value {
  font-family: Georgia, serif;
  font-size: 1.9rem;
  font-weight: bold;
  color: var(--green-900);
  margin: 0.1rem 0 0.3rem;
}

/* --- Steps / metrics ------------------------------------------------- */

.steps { padding-left: 1.4rem; }
.steps li { margin-bottom: 0.6rem; }

.metrics {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin: 0;
}

.metric {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--gold);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}

.metric dt {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.metric dd {
  margin: 0.15rem 0 0;
  font-family: Georgia, serif;
  font-size: 1.6rem;
  font-weight: bold;
  color: var(--green-900);
}

.cta-band {
  text-align: center;
  background: var(--green-900);
  color: #f4ecd4;
  border-radius: var(--radius);
  padding: 1.5rem 1rem;
}

.cta-band h2 { color: var(--gold); }
.cta-band .btn-primary {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--green-900);
}

/* --- Forms ------------------------------------------------------------ */

.form { max-width: 30rem; }

.form p { margin-bottom: 1rem; }

label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

input[type="text"],
input[type="email"],
input[type="password"],
input[type="date"],
select {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

input:focus, select:focus, button:focus {
  outline: 3px solid rgba(168, 91, 50, 0.55);
  outline-offset: 1px;
}

.field-error {
  display: block;
  margin-top: 0.25rem;
  color: var(--error);
  font-size: 0.9rem;
}

/* --- Filters + tables -------------------------------------------------- */

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 1rem;
  align-items: end;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
}

.filters p { margin: 0; }

.table-scroll { overflow-x: auto; }

table.data {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 0.95rem;
}

.data th, .data td {
  text-align: left;
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.data th {
  background: var(--green-100);
  color: var(--green-900);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.data tr:last-child td { border-bottom: none; }
.data td.empty { white-space: normal; color: var(--muted); }

/* --- Flash messages ------------------------------------------------------ */

.flash {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid;
  margin-bottom: 1.25rem;
}

.flash-error { background: var(--error-bg); border-color: var(--error); color: var(--error); }
.flash-success { background: var(--success-bg); border-color: var(--success); color: var(--success); }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  border-top: 3px solid var(--accent);
  background: var(--green-900);
  color: #d8d2b8;
  padding: 1.5rem 0 2rem;
}

.site-footer a { color: var(--gold); }
.site-footer p { margin-bottom: 0.5rem; }
.footer-note { font-size: 0.85rem; color: #a9a58c; }

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
}

/* --- Tablet (768px) -------------------------------------------------------- */

@media (min-width: 768px) {
  h1 { font-size: 2.2rem; }
  .hero h1 { font-size: 2.4rem; }
  .hero { padding: 2rem; }
  .cards { grid-template-columns: repeat(2, 1fr); }
  .metrics { grid-template-columns: repeat(3, 1fr); }
  .filters { grid-template-columns: repeat(3, 1fr); }
  .footer-inner { grid-template-columns: 2fr 1fr 1fr; }
}

/* --- Desktop --------------------------------------------------------------- */

@media (min-width: 1024px) {
  .cards { grid-template-columns: repeat(3, 1fr); }
  /* Dashboard stat cards stay at 4 across on wide screens. */
  .cards:has(.stat) { grid-template-columns: repeat(4, 1fr); }
  .filters { grid-template-columns: repeat(6, auto); }
}

/* --- Slice 2: filtered note, charts, scenario modeler -------------------- */

.filter-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.filtered-note {
  background: var(--green-100);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.6rem 0.9rem;
  margin-bottom: 0.75rem;
}

.btn-small { padding: 0.35rem 0.75rem; font-size: 0.9rem; }

/* Charts — pure CSS bars, no JavaScript libraries. */

.chart-card { margin-bottom: 1rem; }
.chart-card h3 { margin-bottom: 0.2rem; }
.chart-card .muted { margin-bottom: 1rem; }

.chart-empty {
  color: var(--muted);
  background: var(--green-100);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 0;
}

.chart-bars {
  display: flex;
  align-items: stretch;
  gap: 0.35rem;
  height: 11.5rem;
}

.chart-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}

.chart-val {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--green-900);
  white-space: nowrap;
  min-height: 1.05rem;
}

.chart-bar {
  width: 100%;
  max-width: 2.6rem;
  background: var(--green-700);
  border-radius: 4px 4px 0 0;
}

.chart-bar-now { background: var(--gold); }

.chart-label {
  margin-top: 0.3rem;
  font-size: 0.72rem;
  color: var(--muted);
  white-space: nowrap;
  text-align: center;
}

/* Horizontal bars (orders by product). */

.chart-hbars { display: grid; gap: 0.6rem; }

.hbar-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.15rem 0.75rem;
  align-items: center;
}

.hbar-label {
  font-weight: 600;
  font-size: 0.92rem;
  overflow-wrap: anywhere;
}

.hbar-track {
  display: block;
  height: 1.1rem;
  background: var(--green-100);
  border-radius: 999px;
  overflow: hidden;
}

.hbar-fill {
  display: block;
  height: 100%;
  background: var(--green-700);
  border-radius: 999px;
}

.hbar-value {
  font-size: 0.88rem;
  color: var(--muted);
  white-space: nowrap;
}

/* Scenario modeler. */

.modeler p { max-width: 34rem; }

.modeler-presets {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.modeler input[type="range"] {
  width: 100%;
  max-width: 26rem;
  accent-color: var(--green-900);
}

.modeler output { font-weight: 700; color: var(--green-900); }

.modeler-result {
  background: var(--green-100);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.8rem 1rem;
  font-size: 1.05rem;
}

/* --- Slice 3: agreement, guidelines, metrics -------------------------- */

.doc { max-width: 42rem; }

.doc h2 {
  margin-top: 1.75rem;
  border-top: 1px solid var(--line);
  padding-top: 1.25rem;
}

.doc h2:first-of-type {
  border-top: none;
  margin-top: 0;
  padding-top: 0;
}

.doc ol, .doc ul { padding-left: 1.4rem; }
.doc li { margin-bottom: 0.5rem; }

.callout {
  background: var(--green-100);
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 0.8rem 1rem;
}

.check-list,
.no-list {
  list-style: none;
  padding-left: 0;
}

.check-list li,
.no-list li {
  padding-left: 1.6rem;
  position: relative;
}

.check-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--green-700);
  font-weight: 700;
}

.no-list li::before {
  content: "\2715";
  position: absolute;
  left: 0;
  color: var(--error);
  font-weight: 700;
}

/* Agreement checkbox on the application form. */

.agree { margin-bottom: 1rem; }

.checkbox-label {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  font-weight: 400;
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  margin-top: 0.2rem;
  accent-color: var(--green-900);
}

/* --- Slice 4: admin pages ------------------------------------------------ */

.pill {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: capitalize;
  background: var(--green-100);
  color: var(--green-900);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.pill-approved, .pill-paid, .pill-active, .pill-ok { background: var(--success-bg); color: var(--success); }
.pill-pending, .pill-requested { background: #fdf3d7; color: #7a5c00; }
.pill-refunded, .pill-rejected, .pill-suspended, .pill-paused, .pill-error { background: var(--error-bg); color: var(--error); }
.pill-archived, .pill-deleted, .pill-no_code, .pill-bad_signature, .pill-bad_payload, .pill-code_paused, .pill-partner_not_approved { background: #f3ede0; color: var(--muted); }

.inline-form { display: inline-block; margin: 0 0.35rem 0.35rem 0; }
.inline-form input[type="text"] { width: 16rem; max-width: 100%; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

button[disabled] { opacity: 0.5; cursor: not-allowed; }

/* --- Slice 4b/5: body classes (kept for compatibility) ------------- */
/* The Earn palette above is now the DEFAULT for every page, so the
   old body.admin / body.earn variable remap is gone (slice 6). The
   classes are still set by app/lib/view.php and are harmless —
   nothing in this file depends on them any more. */

/* Danger button — delete / destructive admin actions. */
.btn-danger {
  background: transparent;
  color: var(--error);
  border-color: var(--error);
}
.btn-danger:hover { background: var(--error-bg); }

.danger-zone {
  border: 1px solid var(--error);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  background: var(--card);
}
.danger-zone h2 { color: var(--error); }

/* --- Slice 5: growth features -------------------------------------------- */
/* Tier badges — Bronze (terracotta outline), Silver, Gold. */
.tier-badge {
  display: inline-block;
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
  border: 1px solid var(--line);
  background: var(--card);
}
.tier-bronze { color: #a85b32; border-color: #a85b32; }
.tier-silver { color: #5c6670; border-color: #9aa3ab; background: #f4f5f6; }
.tier-gold { color: #8a6d1b; border-color: #c9a227; background: #fbf3d9; }

/* Progress bars — tier progress and payout progress. */
.progress {
  height: 0.75rem;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-fill {
  height: 100%;
  background: #a85b32;
  border-radius: 999px;
}

/* Referral QR block on the dashboard. */
.qr-block { margin-top: 1rem; }
.qr-block img {
  display: block;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem;
  max-width: 100%;
  height: auto;
}

/* Resources page: photo grid + brand colour swatches. */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 1rem;
}
.resource-item img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: var(--radius);
  margin-bottom: 0.5rem;
}
.swatch {
  display: inline-block;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  vertical-align: -0.2rem;
  margin-right: 0.4rem;
}

/* Spotlight (monthly top partner) and announcements. */
.spotlight { border-left: 4px solid #a85b32; }
.spotlight .kicker {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.25rem;
}
.announcement { border-left: 4px solid var(--line); }

/* Notifications: unread ones stand out. */
.notification-unread {
  border-left: 4px solid #a85b32;
  background: #fffaf5;
}

/* Leaderboard: highlight the logged-in partner's own row. */
tr.my-row { background: var(--green-100); }

/* Header notification bell + unread count badge. */
.nav-bell { position: relative; }
.bell-count {
  display: inline-block;
  min-width: 1.25rem;
  padding: 0 0.3rem;
  border-radius: 999px;
  background: #a85b32;
  color: #fdf8f1;
  font-size: 0.8rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.25rem;
}

/* How-it-works lead paragraph. */
.lead { font-size: 1.15rem; line-height: 1.55; }

/* --- Tablet (768px) — slice 2 -------------------------------------------- */

@media (min-width: 768px) {
  .hbar-row { grid-template-columns: 11rem 1fr auto; }
  .chart-bars { height: 13rem; }
}
