/* =============================================================================
   AGRICIRCLE — Corporate design system
   A clean, institutional interface for a regulated financial platform.
   Neutral surfaces, a single restrained green identity, Inter throughout.

   Note: legacy design tokens (--paper, --clay, --font-display, …) are kept as
   aliases that now resolve to the corporate palette, so the many templates that
   reference them inline render on-brand without per-file edits.
   ============================================================================= */

/* ── Inter, self-hosted ────────────────────────────────────────────────────
   Variable woff2, latin subset, from @fontsource-variable/inter 5.3.0 (SIL OFL
   1.1, see ../fonts/inter/OFL.txt). Served from our origin so a page view
   doesn't hand the visitor's IP to a font CDN, and so the CSP's font-src 'self'
   covers it. Glyphs outside the range (e.g. ₵) fall back to the system stack. */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter/inter-latin-wght-normal.260c81a4759b.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
  src: url("../fonts/inter/inter-latin-wght-italic.0a81fe197e0d.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* ── Surfaces ─────────────────────────────────────────────────────────── */
  --canvas:       #F7F8F9;  /* page background */
  --surface:      #FFFFFF;  /* cards, header, inputs */
  --surface-2:    #F1F3F5;  /* subtle fills, row hover */
  --surface-3:    #E9EDF0;

  /* ── Text ─────────────────────────────────────────────────────────────── */
  --ink:          #16211C;  /* primary text — near-black, faint slate-green */
  --ink-soft:     #38444C;
  --ink-muted:    #69747C;  /* secondary text */
  --ink-faint:    #6F7983;  /* lightest readable grey (labels, placeholders) */

  /* ── Borders ──────────────────────────────────────────────────────────── */
  --border:       #E3E7EB;  /* hairline */
  --border-strong:#CFD6DC;

  /* ── Brand ────────────────────────────────────────────────────────────── */
  --primary:      #1F5132;  /* deep green */
  --primary-deep: #163C25;
  --primary-hover:#19472B;
  --primary-tint: #E9F1EC;  /* light green fill */

  /* ── Semantic ─────────────────────────────────────────────────────────── */
  --success:      #167C3E;  --success-tint: #E7F4EC;
  --danger:       #B42318;  --danger-tint:  #FBEAE8;
  --warning:      #B54708;  --warning-tint: #FBF0E6;
  --info:         #155E9C;  --info-tint:    #E8F1F8;

  /* ── Legacy aliases (resolve to corporate values) ─────────────────────── */
  --paper:        var(--canvas);
  --paper-deep:   var(--surface);
  --paper-edge:   var(--border);
  --ink-soft-2:   var(--ink-soft);
  --moss:         var(--primary);
  --moss-deep:    var(--primary-deep);
  --moss-soft:    #5B7A66;
  --clay:         var(--primary);     /* neutralises the old terracotta accent */
  --clay-soft:    var(--primary-tint);
  --gold:         var(--ink);         /* currency now reads in ink, not gold */
  --gold-soft:    var(--ink-muted);

  /* ── Typography ───────────────────────────────────────────────────────── */
  --font-sans:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --font-display: var(--font-sans);   /* headings are sans now */
  --font-body:    var(--font-sans);
  --font-mono:    'Inter', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;

  /* ── Spacing (4px baseline) ───────────────────────────────────────────── */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4rem;   --sp-9: 6rem;

  /* ── Edges & shadows ──────────────────────────────────────────────────── */
  --rule-fine:    1px solid var(--border);
  --rule-med:     1px solid var(--border-strong);
  --rule-thick:   2px solid var(--ink);
  --radius-sm:    4px;
  --radius:       8px;
  --radius-lg:    12px;
  --shadow-sm:    0 1px 2px rgba(16, 24, 40, 0.04);
  --shadow:       0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.08);
  --shadow-hi:    0 4px 12px rgba(16, 24, 40, 0.08), 0 12px 28px -12px rgba(16, 24, 40, 0.18);

  /* ── Motion ───────────────────────────────────────────────────────────── */
  --ease-smooth:  cubic-bezier(0.22, 1, 0.36, 1);
  --ease-spring:  cubic-bezier(0.22, 1, 0.36, 1);
}

/* =============================================================================
   RESET + BASE
   ============================================================================= */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  /* Sticky-footer column: main grows to fill the viewport so the footer sits
     at the bottom instead of floating mid-page with bare canvas beneath it on
     short pages (e.g. sign-in). */
  display: flex;
  flex-direction: column;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
}

#main-content { flex: 1 0 auto; }

img, svg { max-width: 100%; display: block; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color .15s var(--ease-smooth);
}
a:hover { color: var(--primary-deep); text-decoration: underline; text-underline-offset: 2px; }

/* =============================================================================
   TYPOGRAPHY
   ============================================================================= */
h1, h2, h3, h4, h5, .display, .display-sm {
  font-family: var(--font-display);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.018em;
  margin: 0 0 var(--sp-4);
}
h1 { font-size: clamp(1.9rem, 3vw + 0.8rem, 2.6rem); letter-spacing: -0.022em; }
h2 { font-size: clamp(1.5rem, 2vw + 0.7rem, 2rem);   letter-spacing: -0.02em; }
h3 { font-size: clamp(1.25rem, 1vw + 0.85rem, 1.5rem); }
h4 { font-size: 1.15rem; }
h5 { font-size: 1rem; font-weight: 650; }

.display     { font-size: clamp(2.25rem, 5vw + 1rem, 3.75rem); font-weight: 700; letter-spacing: -0.03em; }
.display-sm  { font-size: clamp(1.75rem, 3vw + 0.75rem, 2.5rem); font-weight: 700; letter-spacing: -0.025em; }

/* Legacy decorative class — neutralised to a calm medium-weight run of text. */
.italic-serif { font-family: var(--font-sans); font-style: normal; font-weight: 600; }

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink-muted);
}

.lede {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 400;
  font-size: clamp(1.05rem, 0.6vw + 0.95rem, 1.25rem);
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 64ch;
}

.num, .figure, .tabular {
  font-family: var(--font-mono);
  font-feature-settings: 'tnum';
  font-variant-numeric: tabular-nums;
}

.figure-lg {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 3vw + 0.5rem, 2.75rem);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
  line-height: 1.05;
}

.ampersand { font-family: var(--font-sans); font-style: normal; font-weight: 600; }

/* =============================================================================
   LAYOUT PRIMITIVES
   ============================================================================= */
.wrap {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--sp-5);
}
.wrap-narrow { max-width: 820px; }
.stack > * + * { margin-top: var(--sp-5); }

.rule      { border: 0; border-top: var(--rule-med);  margin: var(--sp-6) 0; }
.rule-fine { border: 0; border-top: var(--rule-fine); margin: var(--sp-5) 0; }

/* =============================================================================
   HEADER (public + authed share the same shell)
   ============================================================================= */
.ac-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: var(--rule-fine);
}
.ac-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-5);
  height: 64px;
  padding: 0 var(--sp-5);
  max-width: 1200px;
  margin: 0 auto;
}
.ac-brand {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}
.ac-brand:hover { color: var(--ink); text-decoration: none; }
.ac-brand-mark { color: var(--primary); }

.ac-nav {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
}
/* Plain text nav links only — button-styled links (.ac-btn) keep their own
   colour/padding, otherwise this rule's `color` (specificity 0,1,1) would
   override .ac-btn's white text and render "Create account" invisible on the
   green button. */
.ac-nav a:not(.ac-btn) {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.93rem;
  position: relative;
  padding: var(--sp-2) 0;
}
.ac-nav a:not(.ac-btn).active,
.ac-nav a:not(.ac-btn):hover {
  color: var(--primary);
  text-decoration: none;
}
.ac-nav a:not(.ac-btn).active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--primary);
}

/* Hamburger (mobile only) */
.ac-burger {
  display: none;
  background: transparent;
  border: 1px solid var(--border-strong);
  width: 42px; height: 42px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.ac-burger:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.ac-burger span,
.ac-burger span::before,
.ac-burger span::after {
  display: block;
  width: 18px; height: 2px; background: var(--ink);
  position: relative;
  transition: transform .25s var(--ease-smooth);
}
.ac-burger span::before { content: ""; position: absolute; top: -6px; left: 0; }
.ac-burger span::after  { content: ""; position: absolute; top:  6px; left: 0; }

.ac-drawer {
  display: none;
  padding: var(--sp-4) var(--sp-5);
  border-top: var(--rule-fine);
  background: var(--surface);
}
.ac-drawer a {
  display: block;
  padding: var(--sp-3) 0;
  border-bottom: var(--rule-fine);
  color: var(--ink);
  text-decoration: none;
  font-size: 1rem;
}

/* =============================================================================
   BUTTONS
   ============================================================================= */
.btn, .ac-btn {
  --_bg: var(--primary);
  --_fg: #fff;
  --_bd: var(--primary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.94rem;
  letter-spacing: 0;
  text-decoration: none !important;
  padding: 0.625rem 1.1rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--_bd);
  background: var(--_bg);
  color: var(--_fg);
  cursor: pointer;
  transition: background-color .15s var(--ease-smooth), border-color .15s var(--ease-smooth), box-shadow .15s var(--ease-smooth);
  line-height: 1.2;
}
.btn:hover, .ac-btn:hover { filter: brightness(0.96); color: var(--_fg); }
.btn:active, .ac-btn:active { filter: brightness(0.92); }
.btn:focus-visible, .ac-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.btn-primary, .ac-btn--primary { --_bg: var(--primary); --_bd: var(--primary); --_fg: #fff; }
.btn-primary:hover, .ac-btn--primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-secondary, .ac-btn--ghost  { --_bg: var(--surface); --_bd: var(--border-strong); --_fg: var(--ink); }
.btn-secondary:hover, .ac-btn--ghost:hover { --_bg: var(--surface-2); filter: none; }
.btn-clay, .ac-btn--clay        { --_bg: var(--primary); --_bd: var(--primary); --_fg: #fff; }
.ac-btn--sm { padding: 0.45rem 0.85rem; min-height: 38px; font-size: 0.875rem; }

.btn-outline-primary { --_bg: transparent; --_bd: var(--primary); --_fg: var(--primary); }
.btn-outline-primary:hover { background: var(--primary); color: #fff; filter: none; }

/* =============================================================================
   CARDS
   ============================================================================= */
.card, .ac-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: var(--sp-5);
  position: relative;
}
.ac-card--flush { background: var(--surface); box-shadow: none; }
.ac-card--ledger { background: var(--surface); border: 1px solid var(--border); background-image: none; }

.bootstrap-sink .card {
  box-shadow: var(--shadow-sm) !important;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

/* Stat block — dashboard KPIs */
.ac-stat {
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
  padding: var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.ac-stat__label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-muted);
}
.ac-stat__value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 1.5vw + 1rem, 2.1rem);
  letter-spacing: -0.025em;
  line-height: 1.1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum';
}
.ac-stat__meta  { font-size: 0.85rem; color: var(--ink-muted); }
.ac-stat__corner {
  position: absolute;
  top: var(--sp-4); right: var(--sp-4);
  color: var(--ink-faint);
  font-size: 1.1rem;
  opacity: 0.9;
}

/* =============================================================================
   HERO (landing)
   ============================================================================= */
.ac-hero {
  padding: var(--sp-8) 0 var(--sp-7);
  border-bottom: var(--rule-fine);
  position: relative;
}
.ac-hero__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: var(--sp-7);
  align-items: center;
}
.ac-hero__title {
  font-size: clamp(2.25rem, 4vw + 1rem, 3.75rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin-bottom: var(--sp-4);
}
.ac-hero__title em {
  font-style: normal;
  color: var(--primary);
}
.ac-hero__lede { max-width: 52ch; margin-bottom: var(--sp-5); }
.ac-hero__side {
  border-left: 3px solid var(--primary);
  padding: var(--sp-2) 0 var(--sp-2) var(--sp-5);
  font-family: var(--font-body);
  font-style: normal;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.ac-hero__cta-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* Feature cards row */
.ac-features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--sp-5);
  padding: var(--sp-8) 0;
}
.ac-feature {
  border-top: 2px solid var(--primary);
  padding-top: var(--sp-4);
  position: relative;
}
.ac-feature__num {
  font-family: var(--font-body);
  font-weight: 700;
  color: var(--ink-muted);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.ac-feature h3 { margin-top: var(--sp-3); margin-bottom: var(--sp-3); font-weight: 650; }
.ac-feature p { color: var(--ink-soft); margin: 0; max-width: 40ch; }

/* Section of figures */
.ac-numbers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin: var(--sp-7) 0;
  overflow: hidden;
}
.ac-numbers > div {
  padding: var(--sp-5);
  border-right: var(--rule-fine);
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.ac-numbers > div:last-child { border-right: 0; }
.ac-numbers__fig {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.85rem, 2.5vw + 1rem, 2.75rem);
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.ac-numbers__label { font-size: 0.88rem; color: var(--ink-muted); }

/* =============================================================================
   ALERTS / MESSAGES
   ============================================================================= */
.ac-alert {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--ink-muted);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  margin-bottom: var(--sp-4);
  font-size: 0.94rem;
}
.ac-alert--success { border-left-color: var(--success); background: var(--success-tint); color: var(--ink); }
.ac-alert--error, .ac-alert--danger { border-left-color: var(--danger); background: var(--danger-tint); color: var(--ink); }
.ac-alert--warning { border-left-color: var(--warning); background: var(--warning-tint); color: var(--ink); }
.ac-alert--info { border-left-color: var(--info); background: var(--info-tint); color: var(--ink); }

/* =============================================================================
   DASHBOARD LAYOUT
   ============================================================================= */
.ac-shell { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }
.ac-shell__side {
  border-right: var(--rule-fine);
  padding: var(--sp-5) var(--sp-3) 120px;
  position: sticky; top: 64px; align-self: start;
  height: calc(100vh - 64px);
  overflow-y: auto;
  background: var(--surface);
}
.ac-shell__main { padding: var(--sp-6) var(--sp-6) var(--sp-9); min-width: 0; }
.ac-sidenav { display: flex; flex-direction: column; gap: 2px; }
.ac-sidenav a {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.93rem;
  font-weight: 500;
}
.ac-sidenav a:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.ac-sidenav a.active {
  background: var(--primary-tint);
  color: var(--primary-deep);
  font-weight: 600;
}
.ac-sidenav__group-label {
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: var(--sp-5) var(--sp-3) var(--sp-2);
  font-weight: 700;
}

/* Dashboard page header */
.ac-pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--sp-5);
  padding-bottom: var(--sp-5);
  border-bottom: var(--rule-fine);
  margin-bottom: var(--sp-6);
}
.ac-pagehead h1 { margin: 0; font-size: clamp(1.6rem, 1.5vw + 1rem, 2.1rem); }
.ac-pagehead__meta { color: var(--ink-muted); font-size: 0.95rem; }

.ac-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5); }
.ac-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); }
.ac-grid-2 { display: grid; grid-template-columns: 1.4fr 1fr; gap: var(--sp-5); }

/* Quick action bar */
.ac-pill-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-5);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.ac-pill-row__title {
  font-family: var(--font-body);
  font-style: normal;
  font-weight: 650;
  font-size: 1rem;
  margin-right: var(--sp-3);
  align-self: center;
}

/* =============================================================================
   TABLES
   ============================================================================= */
.ac-table, .card .table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-body);
  font-size: 0.93rem;
}
.ac-table thead th, .card .table thead th {
  font-family: var(--font-body);
  font-weight: 600;
  text-align: left;
  padding: var(--sp-3);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  border-bottom: 1px solid var(--border-strong);
}
.ac-table tbody td, .card .table tbody td {
  padding: var(--sp-3);
  border-bottom: var(--rule-fine);
  vertical-align: middle;
}
.ac-table tbody tr:hover, .card .table tbody tr:hover { background: var(--surface-2); }

/* =============================================================================
   FORMS
   ============================================================================= */
.form-control, .form-select,
input[type="text"], input[type="email"], input[type="password"],
input[type="tel"], input[type="number"], input[type="search"],
textarea, select {
  width: 100%;
  font: inherit;
  font-size: 0.97rem;
  padding: 0.6rem 0.8rem;
  min-height: 44px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease-smooth), box-shadow .15s var(--ease-smooth);
}
.form-control::placeholder, input::placeholder, textarea::placeholder { color: var(--ink-faint); }
.form-control:focus, .form-select:focus, input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(31, 81, 50, 0.14);
}
label { display: block; font-weight: 600; font-size: 0.875rem; color: var(--ink-soft); margin-bottom: var(--sp-2); }
.form-text, .help-text, small.text-muted { color: var(--ink-muted); font-size: 0.84rem; }

/* =============================================================================
   FOOTER
   ============================================================================= */
.ac-footer {
  border-top: var(--rule-fine);
  background: var(--surface);
  padding: var(--sp-6) 0;
  margin-top: var(--sp-9);
  font-size: 0.9rem;
  color: var(--ink-muted);
}
.ac-footer .wrap { display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between; align-items: center; }
.ac-footer .italic-serif { color: var(--ink-soft); font-weight: 600; }

/* =============================================================================
   MOBILE BOTTOM NAV (authenticated users, <= 880px)
   ============================================================================= */
.ac-bottom-nav {
  display: none;
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: var(--rule-fine);
  z-index: 40;
  padding: var(--sp-2) var(--sp-3) calc(var(--sp-2) + env(safe-area-inset-bottom));
  justify-content: space-around;
  box-shadow: 0 -1px 3px rgba(16, 24, 40, 0.06);
}
.ac-bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: var(--sp-2);
  color: var(--ink-muted);
  text-decoration: none;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  border-radius: var(--radius-sm);
  position: relative;
}
.ac-bottom-nav a.active { color: var(--primary); }
.ac-bottom-nav a.active::before {
  content: "";
  position: absolute;
  top: 0; left: 50%; transform: translateX(-50%);
  width: 22px; height: 3px;
  background: var(--primary);
  border-radius: 0 0 2px 2px;
}
.ac-bottom-nav svg { width: 22px; height: 22px; stroke-width: 1.75; }

/* =============================================================================
   UTILITIES
   ============================================================================= */
.text-muted { color: var(--ink-muted) !important; }
.text-ink { color: var(--ink); }
.text-moss { color: var(--primary); }
.text-clay { color: var(--primary); }
.text-gold { color: var(--ink); }

.badge, .ac-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--sp-2);
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
  background: var(--surface-2);
  color: var(--ink-soft);
}
.ac-badge--moss { background: var(--primary-tint); border-color: var(--primary-tint); color: var(--primary-deep); }
.ac-badge--clay { background: var(--primary-tint); border-color: var(--primary-tint); color: var(--primary-deep); }

/* =============================================================================
   ENTRANCE ANIMATION (subtle staggered reveal)
   ============================================================================= */
@keyframes ac-rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.reveal > * {
  opacity: 0;
  animation: ac-rise 0.45s var(--ease-smooth) forwards;
}
.reveal > *:nth-child(1) { animation-delay: 0.03s; }
.reveal > *:nth-child(2) { animation-delay: 0.08s; }
.reveal > *:nth-child(3) { animation-delay: 0.13s; }
.reveal > *:nth-child(4) { animation-delay: 0.18s; }
.reveal > *:nth-child(5) { animation-delay: 0.23s; }
.reveal > *:nth-child(6) { animation-delay: 0.28s; }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* =============================================================================
   RESPONSIVE BREAKPOINTS
   ============================================================================= */
@media (max-width: 1080px) {
  .ac-hero__grid { grid-template-columns: 1fr; gap: var(--sp-5); }
  .ac-hero__side { border-left: 3px solid var(--primary); border-top: 0; padding-left: var(--sp-5); }
  .ac-numbers    { grid-template-columns: repeat(2, 1fr); }
  .ac-numbers > div:nth-child(2) { border-right: 0; }
  .ac-numbers > div:nth-child(-n+2) { border-bottom: var(--rule-fine); }
  .ac-grid-4     { grid-template-columns: repeat(2, 1fr); }
  .ac-grid-2     { grid-template-columns: 1fr; }
  .ac-shell      { grid-template-columns: 1fr; }
  .ac-shell__side { display: none; }
  .ac-shell__main { padding: var(--sp-5) var(--sp-4) calc(var(--sp-8) + 72px); }
}

@media (max-width: 880px) {
  body { font-size: 15.5px; }
  .wrap { padding: 0 var(--sp-4); }
  .ac-header-inner { height: 58px; padding: 0 var(--sp-4); }
  .ac-brand { font-size: 1.2rem; }
  .ac-nav { display: none; }
  .ac-burger { display: inline-flex; }
  .ac-hero { padding: var(--sp-6) 0; }
  .ac-features { grid-template-columns: 1fr; gap: var(--sp-5); padding: var(--sp-6) 0; }
  .ac-pagehead { flex-direction: column; align-items: flex-start; gap: var(--sp-3); }
  /* Summary cards stay a compact 2-up grid on phones (more scannable than one
     long column); values scale down so amounts never overflow the card. */
  .ac-grid-3 { grid-template-columns: 1fr; }
  .ac-grid-4 { grid-template-columns: repeat(2, 1fr); gap: var(--sp-3); }
  .ac-stat { padding: var(--sp-4); }
  .ac-stat__value { font-size: clamp(1.3rem, 5.5vw, 1.7rem); }
  .ac-pill-row { padding: var(--sp-4); }
  body.authed .ac-bottom-nav { display: flex; }
  body.authed .ac-footer { margin-bottom: 72px; }
}

@media (max-width: 480px) {
  .ac-hero__title { font-size: clamp(2rem, 9vw, 2.75rem); }
  .ac-numbers { grid-template-columns: 1fr; }
  .ac-numbers > div { border-right: 0; border-bottom: var(--rule-fine); }
  .ac-numbers > div:last-child { border-bottom: 0; }
  .ac-footer .wrap { flex-direction: column; gap: var(--sp-2); text-align: left; align-items: flex-start; }
}

/* =============================================================================
   BOOTSTRAP OVERRIDES — keep the 30+ inner page templates on-brand
   ============================================================================= */
.container, .container-fluid { max-width: 1200px; }
.navbar { background: transparent !important; border: 0 !important; box-shadow: none; }
.navbar-agricircle { display: none !important; }

.card { box-shadow: var(--shadow-sm) !important; background: var(--surface); border: 1px solid var(--border) !important; border-radius: var(--radius) !important; }
.card-header { background: transparent !important; border-bottom: 1px solid var(--border) !important; font-family: var(--font-display); font-weight: 650; font-size: 1.05rem; }
.shadow-sm { box-shadow: var(--shadow-sm) !important; }
.shadow { box-shadow: var(--shadow) !important; }

.btn { border-radius: var(--radius-sm) !important; font-weight: 600; padding: 0.6rem 1.05rem; border-width: 1px; }
.btn-primary { background: var(--primary) !important; border-color: var(--primary) !important; color: #fff !important; }
.btn-primary:hover { background: var(--primary-hover) !important; border-color: var(--primary-hover) !important; }
.btn-success { background: var(--success) !important; border-color: var(--success) !important; color: #fff !important; }
.btn-danger { background: var(--danger) !important; border-color: var(--danger) !important; color: #fff !important; }
.btn-secondary { background: var(--surface) !important; border-color: var(--border-strong) !important; color: var(--ink) !important; }
.btn-light { background: var(--surface-2) !important; border-color: var(--border-strong) !important; color: var(--ink) !important; }
.btn-outline-primary { background: transparent !important; border-color: var(--primary) !important; color: var(--primary) !important; }
.btn-outline-primary:hover { background: var(--primary) !important; color: #fff !important; }
/* Outline variants must clear the base .btn background (--_bg defaults to
   --primary): without this they rendered dark text on solid green, which made
   the cookie banner's "Reject optional" all but unreadable. */
.btn-outline-success, .btn-outline-danger, .btn-outline-secondary, .btn-outline-info { --_bg: transparent; background: transparent !important; }
.btn-outline-success { border-color: var(--success) !important; color: var(--success) !important; }
.btn-outline-success:hover { background: var(--success) !important; color: #fff !important; }
.btn-outline-danger { border-color: var(--danger) !important; color: var(--danger) !important; }
.btn-outline-danger:hover { background: var(--danger) !important; color: #fff !important; }
.btn-outline-secondary { border-color: var(--border-strong) !important; color: var(--ink-soft) !important; }
.btn-outline-secondary:hover { background: var(--surface-2) !important; color: var(--ink) !important; filter: none; }
.btn-outline-info { border-color: var(--info) !important; color: var(--info) !important; }
.btn-outline-info:hover { background: var(--info) !important; color: #fff !important; }
/* Same trap as the outline variants: without a reset, .btn-link ("Resend
   code", the cookie banner's "Choose") rendered as a solid green button, and
   .btn-outline-light (Withdraw, on the green wallet card) lost its outline. */
.btn-link { --_bg: transparent; --_bd: transparent; background: transparent !important; border-color: transparent !important; color: var(--primary) !important; }
.btn-link:hover { color: var(--primary-hover) !important; text-decoration: underline !important; filter: none; }
.btn-outline-light { --_bg: transparent; background: transparent !important; border-color: rgba(255, 255, 255, 0.7) !important; color: #fff !important; }
.btn-outline-light:hover { background: rgba(255, 255, 255, 0.15) !important; filter: none; }

.nav-pills .nav-link { color: var(--primary); border-radius: var(--radius-sm); }
.nav-pills .nav-link.active, .nav-pills .show > .nav-link { background: var(--primary); color: #fff; }
.btn-sm { padding: 0.4rem 0.8rem; }

.display-4, .display-6 { font-family: var(--font-display) !important; font-weight: 700 !important; letter-spacing: -0.025em; }
.text-primary { color: var(--primary) !important; }
.text-success { color: var(--success) !important; }
.text-danger  { color: var(--danger) !important; }
.text-info    { color: var(--info) !important; }
.text-warning { color: var(--warning) !important; }

/* Drive Bootstrap contextual utilities from the brand palette so .bg-*,
   .text-*, and .bg-opacity-* tints all derive readable colours. */
:root {
  --bs-primary-rgb: 31, 81, 50;
  --bs-success-rgb: 22, 124, 62;
  --bs-info-rgb: 21, 94, 156;
  --bs-danger-rgb: 180, 35, 24;
  --bs-secondary-rgb: 105, 116, 124;
}
.bg-light   { background-color: var(--surface-2) !important; }
.bg-white   { background-color: var(--surface) !important; }
.bg-warning { background-color: #E2A036 !important; }   /* muted amber, pairs with dark text */

.btn-info    { background: var(--info) !important; border-color: var(--info) !important; color: #fff !important; }
.btn-warning { background: #E2A036 !important; border-color: #E2A036 !important; color: #3A2406 !important; }

/* Badges: dark fills carry white text; light/amber fills carry dark text. */
.badge.bg-primary, .badge.bg-success, .badge.bg-danger,
.badge.bg-info, .badge.bg-secondary { color: #fff !important; }
.badge.bg-secondary { background-color: var(--ink-muted) !important; }
.badge.bg-warning { background-color: var(--warning) !important; color: #fff !important; }
.badge.bg-light   { background-color: var(--surface-2) !important; color: var(--ink) !important; }

.alert { border-radius: var(--radius-sm) !important; border-width: 1px !important; }
.alert-success { background: var(--success-tint) !important; border-color: var(--success) !important; color: var(--ink) !important; }
.alert-danger  { background: var(--danger-tint) !important; border-color: var(--danger) !important; color: var(--ink) !important; }
.alert-warning { background: var(--warning-tint) !important; border-color: var(--warning) !important; color: var(--ink) !important; }
.alert-info    { background: var(--info-tint) !important; border-color: var(--info) !important; color: var(--ink) !important; }

.breadcrumb { background: transparent; padding: 0; font-family: var(--font-body); font-style: normal; font-size: 0.9rem; color: var(--ink-muted); }
.breadcrumb a { color: var(--ink-muted); }
.breadcrumb a:hover { color: var(--primary); }
.table thead { background: transparent; }
.table-light, .table-light th { background: var(--surface-2) !important; }
.table-responsive { border-radius: var(--radius); }
.form-label { font-weight: 600; color: var(--ink-soft); }
.text-decoration-none { text-decoration: none !important; }
