/* =====================================================================
   CHC Affiliates — Emerald Horizon theme.
   Pure black canvas with a single dramatic horizon arc at the bottom:
   a bright hairline curve with a deep emerald + neon green halo
   glowing upward into the dark. Inspired by the Bolt hero treatment.
   ===================================================================== */

:root {
  /* Surface — near-black with a faint emerald hue (not pure #000) */
  --bg:           #040a07;
  --bg-elev:      rgba(14, 18, 16, 0.72);
  --bg-elev-2:    rgba(255, 255, 255, 0.04);
  --bg-input:     rgba(255, 255, 255, 0.03);

  /* Borders */
  --border:       rgba(255, 255, 255, 0.08);
  --border-2:     rgba(255, 255, 255, 0.14);
  --border-emerald: rgba(95, 255, 167, 0.30);

  /* Text */
  --text:         #e8eee9;
  --text-2:       #98a39c;
  --text-3:       #6b7570;

  /* Emerald ramp + neon highlight */
  --emerald-deep: #064e3b;
  --emerald:      #059669;
  --emerald-2:    #10b981;
  --emerald-3:    #34d399;
  --neon:         #4ade80;
  --neon-bright:  #5fffa7;
  --neon-glow:    rgba(95, 255, 167, 0.55);

  /* Status */
  --warn:         #fbbf24;
  --error:        #ff6b6b;
  --success:      #5fffa7;
  --link:         #5fffa7;

  --radius:       12px;
  --radius-lg:    14px;

  --font-serif:   ui-serif, "Cormorant Garamond", Georgia, "Times New Roman", serif;
  --font-mono:    ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* =====================================================================
   THE HORIZON — the signature visual.

   Two stacked layers, both fixed to the viewport so the arc stays in
   the corner of the eye while you scroll:

   1. body::before  — a wide ellipse that sits mostly below the
      viewport. Its TOP edge is rendered as a bright 1px hairline,
      and a stack of green/emerald box-shadows above it create the
      haloed glow that fades up into the black.

   2. body::after   — a softer secondary halo, broader and dimmer,
      to extend the glow further up the page.

   The result: a single, unmistakable curved horizon with a white-hot
   hairline and a deep emerald-to-neon halo, on pure black. No tile,
   no card backgrounds compete with it.
   ===================================================================== */

body::before {
  content: "";
  position: fixed;
  /* Bolt-style horizon arc.
     The ellipse is just slightly wider than the viewport with a near-
     circular aspect, so the visible top arc bows up at the center and
     descends to meet the bottom-left and bottom-right corners. The
     bulk of the ellipse sits below the fold; we only see the curved
     top hairline + halo. */
  left: -2vw; right: -2vw;
  bottom: -70vh;
  height: 100vh;
  border-radius: 50% / 50%;
  background: #040a07;
  border-top: 1px solid rgba(255, 255, 255, 0.95);
  pointer-events: none;
  z-index: 0;
  box-shadow:
    /* Razor-sharp white-hot core right above the line */
    0 -1px 0    rgba(255, 255, 255, 0.85),
    0 -2px 4px  rgba(255, 255, 255, 0.55),
    /* Bright neon emerald halo */
    0 -8px  28px  rgba(95, 255, 167, 0.55),
    0 -22px 60px  rgba(95, 255, 167, 0.40),
    /* Deeper emerald falloff */
    0 -55px  140px rgba(16, 185, 129, 0.30),
    0 -110px 240px rgba(5, 150, 105, 0.20),
    0 -180px 340px rgba(6, 78, 59, 0.14);
}
/* A second, broader halo to give the glow more headroom on tall pages. */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse 90% 35% at 50% 95%, rgba(95, 255, 167, 0.22) 0%, rgba(16, 185, 129, 0.07) 38%, transparent 68%);
  mix-blend-mode: screen;
}
body > * { position: relative; z-index: 1; }

a { color: var(--link); text-decoration: none; }
a:hover {
  color: var(--neon-bright);
  text-shadow: 0 0 10px rgba(95, 255, 167, 0.55);
}

/* ----- Topbar ------------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: rgba(4, 10, 7, 0.78);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  position: sticky; top: 0; z-index: 50;
}
.topbar .brand {
  display: flex; align-items: center; gap: 12px;
  font-weight: 500; color: #fff;
}
.topbar .brand .dot {
  width: 28px; height: 28px;
  background: transparent;
  display: inline-flex; align-items: center; justify-content: center;
}
.topbar .brand img {
  height: 32px; width: auto; display: block;
  filter: drop-shadow(0 0 14px rgba(95, 255, 167, 0.30));
  transition: filter 200ms ease;
}
.topbar .brand:hover img {
  filter: drop-shadow(0 0 22px rgba(95, 255, 167, 0.65));
}
.topbar .brand .name {
  font-size: 14px; font-weight: 500; color: #fff; letter-spacing: 0.2px;
  padding-left: 12px; border-left: 1px solid var(--border);
}
.topbar nav { display: flex; align-items: center; gap: 22px; }
.topbar nav a {
  color: var(--text-2); margin: 0; font-size: 13px; padding: 6px 0;
  position: relative;
}
.topbar nav a:hover { color: #fff; }
.topbar nav a.active {
  color: #fff;
  text-shadow: 0 0 12px rgba(95, 255, 167, 0.40);
}
.topbar nav a.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -8px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--neon-bright), transparent);
  box-shadow: 0 0 8px rgba(95, 255, 167, 0.7);
  border-radius: 2px;
}

/* ----- Layout ------------------------------------------------------- */
.container { max-width: 1180px; margin: 0 auto; padding: 32px 22px 96px; }
.container.narrow { max-width: 480px; }

h1 {
  /* Big, bold sans-serif hero — matches the Bolt proportions. */
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: clamp(34px, 5.4vw, 60px);
  font-weight: 700;
  margin: 0 0 12px;
  color: #fff;
  letter-spacing: -1.2px;
  line-height: 1.05;
}
h1 em, h2 em {
  /* Italic sans-serif (NOT serif) to match the Bolt "build" treatment.
     Slight optical adjustment — italic glyphs lean ~10°, so we add a
     hair more horizontal padding on the right to keep kerning even. */
  font-family: inherit;
  font-style: italic;
  font-weight: 700;
  padding-right: 0.04em;
  background: linear-gradient(180deg, #c9ffe2 0%, var(--neon-bright) 55%, var(--emerald) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(95, 255, 167, 0.38));
}
h2 {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 22px; font-weight: 600; margin: 32px 0 12px; color: #fff;
  letter-spacing: -0.4px;
}
h3 {
  font-size: 11px; font-weight: 500; margin: 18px 0 8px;
  color: var(--neon-bright); text-transform: uppercase; letter-spacing: 2.5px;
  text-shadow: 0 0 10px rgba(95, 255, 167, 0.25);
}
.muted { color: var(--text-2); }
.right { text-align: right; }

/* ----- Cards -------------------------------------------------------- */
.card {
  background:
    linear-gradient(180deg, rgba(14, 18, 16, 0.78) 0%, rgba(8, 10, 9, 0.55) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  margin-bottom: 16px;
  position: relative;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.05) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.6);
}

/* ----- KPIs --------------------------------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px; margin-bottom: 26px;
}
.kpi {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, rgba(14, 18, 16, 0.72) 0%, rgba(8, 10, 9, 0.50) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  backdrop-filter: blur(10px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 20px 40px -20px rgba(0, 0, 0, 0.55);
  transition: transform 200ms ease, box-shadow 200ms ease, border-color 200ms ease;
}
.kpi:hover {
  transform: translateY(-1px);
  border-color: var(--border-emerald);
  box-shadow:
    0 1px 0 rgba(95, 255, 167, 0.18) inset,
    0 0 30px -8px rgba(95, 255, 167, 0.30),
    0 24px 48px -20px rgba(0, 0, 0, 0.7);
}
.kpi .label {
  color: var(--text-3); font-size: 11px;
  text-transform: uppercase; letter-spacing: 2px;
}
.kpi .value {
  font-size: 30px; font-weight: 600; margin-top: 8px; color: #fff;
  font-feature-settings: "tnum";
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  letter-spacing: -0.6px;
}
.kpi:nth-child(2) .value {
  background: linear-gradient(180deg, #c9ffe2 0%, var(--neon-bright) 50%, var(--emerald) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(95, 255, 167, 0.35));
}
.kpi .delta {
  font-family: var(--font-mono);
  font-size: 11px; color: var(--neon); margin-top: 6px;
  text-shadow: 0 0 8px rgba(95, 255, 167, 0.30);
}

/* ----- Tables ------------------------------------------------------- */
table {
  width: 100%; border-collapse: collapse; font-size: 13px;
  table-layout: fixed;
}
table thead tr {
  background: rgba(255, 255, 255, 0.025);
}
th {
  color: var(--text-3); font-weight: 500;
  text-transform: uppercase; font-size: 10px; letter-spacing: 2px;
  padding: 12px 14px; text-align: left;
  border-bottom: 1px solid var(--border);
}
td {
  padding: 12px 14px; text-align: left; vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
td.right, th.right { text-align: right; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background 120ms ease; }
tbody tr:hover {
  background: linear-gradient(90deg, transparent 0%, rgba(95, 255, 167, 0.05) 50%, transparent 100%);
}

/* ----- Forms -------------------------------------------------------- */
label {
  display: block; font-size: 11px; color: var(--text-2);
  margin: 14px 0 6px; text-transform: uppercase; letter-spacing: 1.5px;
}
input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg-input);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, select:hover, textarea:hover { border-color: var(--border-2); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--neon-bright);
  background: rgba(95, 255, 167, 0.05);
  box-shadow: 0 0 0 3px rgba(95, 255, 167, 0.18), 0 0 22px rgba(95, 255, 167, 0.20);
}

/* ----- Buttons ------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: linear-gradient(135deg, var(--emerald-2) 0%, var(--emerald) 60%, var(--emerald-deep) 100%);
  color: #fff; border: 1px solid rgba(95, 255, 167, 0.35);
  font-weight: 500; padding: 10px 18px; border-radius: 10px;
  cursor: pointer; font-size: 13px; letter-spacing: 0.2px;
  transition: transform 100ms ease, box-shadow 200ms ease, filter 160ms ease;
  box-shadow:
    0 1px 0 rgba(255,255,255,0.18) inset,
    0 0 18px rgba(95, 255, 167, 0.30),
    0 8px 22px -10px rgba(5, 150, 105, 0.6);
}
.btn:hover {
  filter: brightness(1.10);
  box-shadow:
    0 1px 0 rgba(255,255,255,0.22) inset,
    0 0 32px rgba(95, 255, 167, 0.55),
    0 12px 28px -10px rgba(5, 150, 105, 0.7);
}
.btn:active { transform: translateY(1px); }
.btn.secondary {
  background: linear-gradient(180deg, rgba(95, 255, 167, 0.06) 0%, rgba(95, 255, 167, 0.02) 100%);
  color: var(--text); border: 1px solid var(--border);
  box-shadow: none;
}
.btn.secondary:hover {
  border-color: var(--border-emerald);
  box-shadow: 0 0 18px rgba(95, 255, 167, 0.18);
}
.btn.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border: 1px solid rgba(255, 107, 107, 0.4);
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.25);
}
.btn.small { font-size: 12px; padding: 7px 12px; border-radius: 8px; }
.btn[disabled] { opacity: 0.4; cursor: not-allowed; filter: none; }

/* ----- Badges (status pills) ---------------------------------------- */
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  font-size: 10px; text-transform: uppercase; letter-spacing: 1.5px;
  font-weight: 500; border: 1px solid transparent;
}
.badge.pending     { background: rgba(251, 191, 36, 0.10); color: var(--warn);     border-color: rgba(251, 191, 36, 0.30); }
.badge.approved,
.badge.paid,
.badge.active      { background: rgba(95, 255, 167, 0.10);  color: var(--neon-bright); border-color: rgba(95, 255, 167, 0.36); box-shadow: 0 0 14px rgba(95, 255, 167, 0.20); text-shadow: 0 0 8px rgba(95, 255, 167, 0.45); }
.badge.invoiced,
.badge.accrued     { background: rgba(20, 184, 166, 0.10); color: #5eead4;          border-color: rgba(20, 184, 166, 0.34); box-shadow: 0 0 10px rgba(20, 184, 166, 0.16); }
.badge.rejected,
.badge.suspended,
.badge.clawed_back,
.badge.void        { background: rgba(255, 107, 107, 0.10); color: var(--error);    border-color: rgba(255, 107, 107, 0.34); }
.badge.cancelled,
.badge.expired,
.badge.unknown     { background: rgba(255, 255, 255, 0.05); color: var(--text-3);   border-color: var(--border); }

/* ----- Alerts ------------------------------------------------------- */
.alert {
  padding: 13px 16px; border-radius: 10px; font-size: 13px;
  margin: 12px 0; border: 1px solid var(--border);
  background: var(--bg-elev);
  backdrop-filter: blur(10px);
}
.alert.error   { background: rgba(255, 107, 107, 0.08);  color: var(--error);       border-color: rgba(255, 107, 107, 0.30); }
.alert.success { background: rgba(95, 255, 167, 0.06);   color: var(--neon-bright); border-color: rgba(95, 255, 167, 0.36); box-shadow: 0 0 28px rgba(95, 255, 167, 0.10); }
.alert.info    { background: rgba(20, 184, 166, 0.05);   color: #5eead4;            border-color: rgba(20, 184, 166, 0.28); }

/* ----- Misc layout helpers ----------------------------------------- */
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

.copyable {
  display: flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 13px; color: var(--neon-bright);
  background: linear-gradient(180deg, rgba(95, 255, 167, 0.06) 0%, rgba(95, 255, 167, 0.02) 100%);
  padding: 11px 14px; border-radius: 10px;
  border: 1px solid rgba(95, 255, 167, 0.22);
  word-break: break-all;
  text-shadow: 0 0 10px rgba(95, 255, 167, 0.32);
  box-shadow: 0 0 22px rgba(95, 255, 167, 0.10) inset;
}

/* ----- Tabs (segmented control) ------------------------------------- */
.tabs {
  display: inline-flex; gap: 2px; padding: 4px;
  background:
    linear-gradient(180deg, rgba(14, 18, 16, 0.7) 0%, rgba(8, 10, 9, 0.5) 100%);
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 18px;
  backdrop-filter: blur(10px);
}
.tabs button {
  background: transparent; color: var(--text-2);
  border: none; padding: 8px 16px;
  font-size: 12px; cursor: pointer;
  border-radius: 8px;
  transition: background 160ms ease, color 160ms ease, box-shadow 200ms ease;
  letter-spacing: 0.5px;
}
.tabs button:hover { color: #fff; }
.tabs button.active {
  background: linear-gradient(180deg, rgba(95, 255, 167, 0.18) 0%, rgba(16, 185, 129, 0.08) 100%);
  color: #fff;
  border: 1px solid rgba(95, 255, 167, 0.35);
  box-shadow: 0 0 18px rgba(95, 255, 167, 0.28), 0 1px 0 rgba(255, 255, 255, 0.10) inset;
  text-shadow: 0 0 10px rgba(95, 255, 167, 0.32);
}

/* ----- Charts ------------------------------------------------------- */
.chart-wrap {
  background:
    linear-gradient(180deg, rgba(14, 18, 16, 0.72) 0%, rgba(8, 10, 9, 0.55) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  margin-bottom: 16px;
  backdrop-filter: blur(10px);
  box-shadow: 0 20px 40px -20px rgba(0, 0, 0, 0.55);
}
.chart-wrap h3 { margin-top: 0; }
.chart-wrap canvas { max-height: 260px; }

/* ----- Hero (landing page) ----------------------------------------- */
.hero {
  position: relative;
  max-width: 760px; margin: 0 auto;
  padding: 80px 22px 120px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center;
}
.hero h1 {
  font-size: clamp(38px, 6vw, 64px);
  margin-top: 8px; margin-bottom: 14px;
}
.hero-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px; margin-bottom: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 12px; color: var(--text-2);
}
.hero-pill-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--neon-bright);
  box-shadow: 0 0 12px var(--neon-bright);
}
.hero-sub {
  margin: 0 auto 36px; color: var(--text-2);
  font-size: 16px; max-width: 540px; line-height: 1.55;
}
.hero-sub strong { color: #fff; font-weight: 600; }

.hero-card {
  display: flex; align-items: center; gap: 14px;
  width: 100%; max-width: 560px;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(14, 18, 16, 0.78) 0%, rgba(8, 10, 9, 0.62) 100%);
  border: 1px solid var(--border);
  border-radius: 16px;
  text-decoration: none; color: inherit;
  backdrop-filter: blur(14px);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 30px 60px -20px rgba(0, 0, 0, 0.6);
  transition: border-color 200ms ease, box-shadow 200ms ease, transform 200ms ease;
}
.hero-card:hover {
  border-color: var(--border-emerald);
  box-shadow:
    0 1px 0 rgba(95, 255, 167, 0.18) inset,
    0 0 32px -8px rgba(95, 255, 167, 0.30),
    0 30px 60px -20px rgba(0, 0, 0, 0.6);
}
.hero-card-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: rgba(95, 255, 167, 0.10);
  border: 1px solid rgba(95, 255, 167, 0.22);
  border-radius: 8px;
  color: var(--neon-bright); font-size: 16px; font-weight: 500;
  flex-shrink: 0;
}
.hero-card-text { flex: 1; min-width: 0; text-align: left; }
.hero-card-label { display: block; color: #fff; font-size: 14px; font-weight: 500; }
.hero-card-hint  { display: block; color: var(--text-3); font-size: 12px; margin-top: 2px; }
.hero-card-cta { padding: 10px 16px; }

.hero-meta {
  display: flex; align-items: center; justify-content: center;
  gap: 10px; margin-top: 24px;
  font-size: 13px; color: var(--text-3);
}
.hero-meta-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  color: var(--text-2);
}
.hero-meta-chip:hover {
  color: #fff; border-color: var(--border-emerald);
  text-shadow: 0 0 10px rgba(95, 255, 167, 0.30);
}

@media (max-width: 600px) {
  .hero { padding: 56px 18px 80px; }
  .hero-card { flex-wrap: wrap; }
  .hero-card-cta { width: 100%; }
}

/* ----- Footer ------------------------------------------------------- */
footer {
  padding: 40px 22px 26px;
  text-align: center;
  color: var(--text-3);
  font-size: 12px;
  letter-spacing: 0.5px;
}

/* ----- Code / mono helpers ----------------------------------------- */
code {
  font-family: var(--font-mono); font-size: 12px;
  background: rgba(95, 255, 167, 0.08); color: var(--neon-bright);
  padding: 1px 7px; border-radius: 4px;
  border: 1px solid rgba(95, 255, 167, 0.16);
}

/* ----- Selection --------------------------------------------------- */
::selection { background: rgba(95, 255, 167, 0.40); color: #040a07; }

/* ----- Scrollbar (webkit) ----------------------------------------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(95, 255, 167, 0.18);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(95, 255, 167, 0.36); background-clip: content-box;
}
