/* ============================================================================
   FinBiz — official brand tokens (SINGLE SOURCE OF TRUTH for the stylesheet side)
   Green · White · Blue.  Loaded by the Next.js layout, public/app.html, the Coop
   legacy page and standalone pages.  JS/PDF/e-mail code reads the same values
   from lib/brand.cjs (scripts/check-brand-tokens.mjs fails if the two drift).
   Everything below is a CSS custom property: change a colour HERE only.
   ============================================================================ */
:root {
  /* --- brand palette --- */
  --fb-green: #078568;
  --fb-blue: #2164E8;
  --fb-white: #FFFFFF;
  --fb-navy: #030719;
  --fb-green-light: #E7F6F0;
  --fb-blue-light: #EAF1FF;
  --fb-text: #172033;
  --fb-muted: #667085;
  --fb-border: #E3E8EF;
  --fb-warning: #F4B400;
  --fb-danger: #DC3545;

  /* --- derived (hover/active/disabled) --- */
  --fb-green-hover: #06705A;
  --fb-green-active: #055E4C;
  --fb-blue-hover: #1A52C4;
  --fb-blue-active: #1644A3;
  --fb-disabled-bg: #E3E8EF;
  --fb-disabled-text: #98A2B3;
  --fb-focus-ring: #2164E8;
  --fb-page: #F6F8FB;           /* light-theme page background behind white cards */

  /* --- signature gradient (banners, heroes, premium highlights ONLY) --- */
  --fb-gradient: linear-gradient(120deg, #078568 0%, #117F91 48%, #2164E8 100%);

  /* --- semantic aliases: components should use THESE --- */
  --fb-primary: var(--fb-green);
  --fb-primary-hover: var(--fb-green-hover);
  --fb-on-primary: #FFFFFF;
  --fb-secondary: var(--fb-blue);
  --fb-link: var(--fb-blue);
  --fb-surface: var(--fb-white);
  --fb-surface-alt: var(--fb-page);
  --fb-text-primary: var(--fb-text);
  --fb-text-secondary: var(--fb-muted);
  --fb-success: var(--fb-green);
  --fb-success-bg: var(--fb-green-light);
  --fb-info: var(--fb-blue);
  --fb-info-bg: var(--fb-blue-light);
  --fb-warn: var(--fb-warning);
  --fb-error: var(--fb-danger);

  /* --- charts: green + blue first, then distinguishable extras --- */
  --fb-chart-1: #078568;  /* revenue / positive */
  --fb-chart-2: #2164E8;  /* neutral analytical */
  --fb-chart-3: #F4B400;  /* warning / pending  */
  --fb-chart-4: #DC3545;  /* expenses / negative */
  --fb-chart-5: #7C5CDB;
  --fb-chart-6: #0EA5B7;

  --fb-radius: 10px;
  --fb-shadow: 0 1px 2px rgba(3, 7, 25, .04), 0 1px 3px rgba(3, 7, 25, .08);
}

/* Dark theme: navy shell, white-ish text, brighter brand tints for contrast (WCAG AA on #030719). */
:root.dark, [data-theme="dark"] {
  --fb-surface: #0B1226;
  --fb-surface-alt: var(--fb-navy);
  --fb-text-primary: #F2F5FA;
  --fb-text-secondary: #98A2B3;
  --fb-border: #1D2740;
  --fb-link: #6C9BFF;
  --fb-success-bg: rgba(7, 133, 104, .18);
  --fb-info-bg: rgba(33, 100, 232, .18);
  --fb-disabled-bg: #1D2740;
  --fb-disabled-text: #667085;
  --fb-focus-ring: #6C9BFF;
}

/* Reusable helpers (opt-in; nothing here restyles existing pages by itself). */
.fb-gradient { background: var(--fb-gradient); color: #fff; }
.fb-btn-primary { background: var(--fb-primary); color: var(--fb-on-primary); border: 1px solid var(--fb-primary); }
.fb-btn-primary:hover { background: var(--fb-primary-hover); }
.fb-btn-secondary { background: var(--fb-surface); color: var(--fb-primary); border: 1px solid var(--fb-primary); }
.fb-card { background: var(--fb-surface); border: 1px solid var(--fb-border); border-radius: var(--fb-radius); box-shadow: var(--fb-shadow); }

/* Accessibility: visible keyboard focus everywhere, reduced motion respected. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 2px solid var(--fb-focus-ring);
  outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
