/*
 * Fivegive — base styles.
 * Tokens match wiki/brand-site style guide (cream paper, ink, red, Fraunces + Outfit).
 */

:root {
  --paper: #f6efe3;
  --paper-deep: #f3efe6;
  --card: #fffdf8;
  --ink: #1a1510;
  --body: #3a352c;
  --soft: #7a7266;
  --mute: #c4b7a4;
  --line: #e0d4c0;
  --red: #e23d2a;
  --red-dark: #c42e1f;
  --red-soft: rgba(226, 61, 42, 0.1);

  --brand: var(--red);
  --brand-dark: var(--red-dark);
  --brand-soft: var(--red-soft);
  --bg: var(--paper);
  --surface: var(--card);
  --text: var(--ink);
  --muted: var(--soft);
  --border: var(--line);
  --success: #3d6b4f;
  --success-soft: rgba(61, 107, 79, 0.12);
  --danger: #b91c1c;
  --danger-soft: #fef2f2;
  --warning: #b45309;
  --warning-soft: #fffbeb;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(26, 21, 16, 0.04), 0 8px 24px rgba(26, 21, 16, 0.05);
  --shadow-lg: 0 12px 40px rgba(26, 21, 16, 0.08);
  --font: Outfit, system-ui, -apple-system, sans-serif;
  --font-display: Fraunces, Georgia, "Times New Roman", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.2;
  margin: 0 0 0.5em;
  letter-spacing: -0.03em;
  font-weight: 700;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.7rem 1.25rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.04s ease, background 0.15s ease, box-shadow 0.15s ease;
  text-decoration: none;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: #fffdf8; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--paper-deep); text-decoration: none; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); text-decoration: none; }
.btn-block { width: 100%; }
.btn-lg { padding: 0.9rem 1.6rem; font-size: 1.05rem; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 1.1rem; }
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}
.form-control {
  width: 100%;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-family: inherit;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-control:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}
.form-hint { color: var(--muted); font-size: 0.85rem; margin-top: 0.35rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}
.card + .card { margin-top: 1.25rem; }

/* ---------- Flash ---------- */
.flash { padding: 0.85rem 1.1rem; border-radius: var(--radius-sm); margin-bottom: 1rem; font-weight: 500; }
.flash-notice { background: var(--success-soft); color: var(--success); }
.flash-alert { background: var(--danger-soft); color: var(--danger); }

/* ---------- Badges ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--paper-deep); color: var(--muted); }

/* ---------- Setup wizard ---------- */
.setup-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background: linear-gradient(160deg, var(--brand-soft) 0%, var(--bg) 55%);
}
.setup-card {
  width: 100%;
  max-width: 520px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 2.5rem;
}
.setup-emoji { font-size: 2.75rem; line-height: 1; }
.setup-card h1 { font-size: 1.7rem; margin-top: 0.75rem; }
.setup-lead { color: var(--muted); font-size: 1.05rem; margin-bottom: 1.75rem; }
.setup-steps {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}
.setup-steps .dot {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: var(--border);
}
.setup-steps .dot.active { background: var(--brand); }
.setup-steps .dot.done { background: var(--brand-dark); }

/* ---------- Dashboard (brand-site app shell) ---------- */
.dash {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
  background: var(--bg);
}
.dash-sidebar {
  background: var(--paper);
  color: var(--soft);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}
.dash-brand {
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.05em;
  padding: 0 0.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
}
.dash-brand-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.dash-brand img {
  width: 28px;
  height: 28px;
  display: block;
}
.dash-brand-logo {
  height: 36px;
  width: auto;
  max-width: 48px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  flex-shrink: 0;
}
.dash-brand .fg-mark {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.05em;
  line-height: 1;
}
.dash-brand .fg-mark span { color: var(--red); }
.dash-brand .org-name {
  font-family: var(--font);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0;
  color: var(--soft);
  line-height: 1.25;
}
.brand-preview {
  display: flex;
  align-items: center;
  min-height: 64px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.brand-preview-logo {
  max-height: 72px;
  max-width: 220px;
  width: auto;
  object-fit: contain;
}
.brand-preview-empty { color: var(--muted); font-size: 0.9rem; }
.dash-nav { display: flex; flex-direction: column; gap: 0.25rem; flex: 1; margin-top: 0.5rem; }
.dash-nav a {
  color: var(--soft);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.95rem;
}
.dash-nav a:hover {
  background: rgba(226, 61, 42, 0.06);
  color: var(--ink);
  text-decoration: none;
}
.dash-nav a.active {
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
}
.dash-sidebar .dash-footer {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--soft);
}
.dash-sidebar .dash-footer a,
.dash-sidebar .dash-footer .btn-ghost { color: var(--soft); }
.dash-sidebar .dash-footer b {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 0.15rem;
}

.dash-main { padding: 28px 32px 32px; max-width: 1100px; }
.dash-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.dash-header h1 { margin: 0; font-size: 2rem; letter-spacing: -0.04em; }
.page-subtitle {
  color: var(--soft);
  margin: 0.25rem 0 0;
  font-family: var(--font-display);
  font-style: italic;
}

/* ---------- Stats ---------- */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  box-shadow: var(--shadow);
}
.stat .label {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.stat .value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 0.35rem;
  letter-spacing: -0.03em;
}

/* ---------- Overview weekly giving (#C-WEEK) ---------- */
.week-giving { margin-bottom: 1.5rem; }
.week-giving-head { margin-bottom: 0.85rem; align-items: flex-start; }
.week-giving-meta {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.week-chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 0.4rem;
  align-items: end;
  height: 11.5rem;
  padding: 0.25rem 0.1rem 0;
}
.week-col {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  height: 100%;
  min-width: 0;
}
.week-col-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.week-bar-track {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
}
.week-bar-spacer {
  width: 1px;
  min-height: 0;
  pointer-events: none;
}
.week-bar {
  width: 70%;
  max-width: 2.25rem;
  border-radius: 5px 5px 2px 2px;
  background: var(--red-soft);
  border-bottom: 2px solid var(--red);
  min-height: 4px;
  transition: background 0.15s ease, transform 0.15s ease;
}
.week-col-btn:hover .week-bar,
.week-col.is-focus .week-bar {
  background: rgba(226, 61, 42, 0.28);
  transform: translateY(-2px);
}
.week-col.is-current .week-bar {
  background: rgba(226, 61, 42, 0.45);
  border-bottom-color: var(--red-dark);
}
.week-col.is-selected .week-bar {
  background: rgba(226, 61, 42, 0.55);
  border-bottom-color: var(--red-dark);
}
.week-col.is-selected .week-label {
  color: var(--ink);
  font-weight: 600;
}
.week-label {
  font-size: 0.68rem;
  color: var(--soft);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.week-readout {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: baseline;
  font-size: 0.9rem;
}
.week-readout-amt {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.week-readout-hint {
  margin-top: 0.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}
@media (max-width: 560px) {
  .week-label { font-size: 0.6rem; }
}

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 0.75rem 0.85rem; border-bottom: 1px solid var(--border); }
.table th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  font-weight: 500;
  background: var(--paper-deep);
}
.table tr:last-child td { border-bottom: none; }

/* ---------- Empty states ---------- */
.empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--muted);
}
.empty .emoji { font-size: 2.5rem; }

/* ---------- Public giving ---------- */
.give-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1rem 3rem;
  background: var(--bg);
}
.give-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1rem 0 2rem;
  width: 100%;
  max-width: 680px;
}
.give-mark { font-size: 1.6rem; }
.give-logo { height: 40px; width: auto; }
.give-orgname {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  letter-spacing: -0.03em;
}
.give-orgname:hover { text-decoration: none; }
.give-nav { margin-left: auto; display: flex; gap: 0.75rem; align-items: center; }
.give-navlink { font-weight: 600; font-size: 0.9rem; color: var(--muted); }
.give-navlink:hover { color: var(--text); }
.give-main { width: 100%; max-width: 480px; }
.give-main--wide { max-width: 680px; }
.text-right { text-align: right; }
.checkbox-row { display: flex; align-items: center; gap: 0.5rem; font-size: 0.9rem; color: var(--muted); }
.auth-links { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; padding-top: 0.5rem; }
.give-footer { margin-top: 2rem; font-size: 0.85rem; }
.give-footer .powered {
  color: var(--soft);
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.04em;
}
.give-footer .powered span { color: var(--red); }
.give-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  padding: 2rem;
}
.give-card h1 { font-size: 1.5rem; }

.fund-list { margin-top: 1.25rem; display: flex; flex-direction: column; gap: 0.6rem; }
.fund-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.fund-item:hover { border-color: var(--brand); background: var(--brand-soft); text-decoration: none; }
.fund-name { font-weight: 600; }
.give-arrow { color: var(--brand); font-size: 1.2rem; }

.seg {
  display: flex;
  gap: 0.4rem;
  background: var(--paper-deep);
  padding: 0.3rem;
  border-radius: 999px;
  margin: 1.25rem 0;
}
.seg-btn {
  flex: 1;
  padding: 0.55rem 1rem;
  border: none;
  background: transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--muted);
  cursor: pointer;
}
.seg-btn.selected { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.amount-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.1rem;
}
.amount-btn {
  padding: 0.7rem 0.5rem;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.amount-btn:hover { border-color: var(--brand); }
.amount-btn.selected { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-dark); }

/* ---------- Utilities ---------- */
.stack > * + * { margin-top: 1rem; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.muted { color: var(--muted); }
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.gap { gap: 0.75rem; }

@media (max-width: 720px) {
  .dash { grid-template-columns: 1fr; }
  .dash-sidebar { border-right: none; border-bottom: 1px solid var(--line); }
  .dash-main { padding: 1.25rem 1rem 2rem; }
}

/* ---------- Giving dashboards (#F-DASH) ---------- */
.gfd-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  max-width: 22rem;
}
.gfd-tab {
  display: block;
  text-align: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.gfd-tab.active {
  background: var(--red-soft);
  border-color: rgba(226, 61, 42, 0.35);
  color: var(--red-dark);
}
.gfd-filters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
  margin-bottom: 1.25rem;
}
.gfd-filters label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gfd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.gfd-kpi {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  box-shadow: var(--shadow);
}
.gfd-kpi .label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.gfd-kpi .value {
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  margin: 0.25rem 0 0.15rem;
}
.gfd-kpi .delta { font-size: 0.82rem; color: var(--muted); }
.gfd-kpi .delta.up { color: var(--success); }
.gfd-kpi .delta.down { color: var(--red-dark); }
.gfd-panel-grid,
.gfd-lists {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.85rem;
  margin-bottom: 0.85rem;
}
.gfd-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem 1.1rem 1.15rem;
  box-shadow: var(--shadow);
}
.gfd-panel--wide { grid-column: 1 / -1; }
.gfd-panel h2 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
  font-weight: 600;
  font-family: var(--font);
  letter-spacing: 0;
}
.gfd-q {
  margin: 0 0 0.85rem;
  font-size: 0.84rem;
  color: var(--muted);
}
.gfd-chart {
  width: 100%;
  height: 11.5rem;
  min-height: 11.5rem;
}
.gfd-status-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.gfd-status-list li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
  align-items: center;
  font-size: 0.9rem;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.gfd-status-list li:last-child { border-bottom: 0; }
.gfd-sub {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.1rem;
}
.gfd-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.2rem 0.45rem;
  border-radius: 6px;
  background: rgba(26, 21, 16, 0.06);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.gfd-pill--warn {
  background: var(--warning-soft);
  color: var(--warning);
}
@media (max-width: 900px) {
  .gfd-kpi-grid,
  .gfd-panel-grid,
  .gfd-lists,
  .gfd-filters { grid-template-columns: 1fr 1fr; }
  .gfd-panel--wide { grid-column: auto; }
}
@media (max-width: 560px) {
  .gfd-kpi-grid,
  .gfd-panel-grid,
  .gfd-lists,
  .gfd-filters,
  .gfd-tabs { grid-template-columns: 1fr; }
}
