@font-face { font-family: "Archivo Black"; src: url("assets/fonts/archivo-black.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Archivo"; src: url("assets/fonts/archivo.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url("assets/fonts/instrument-sans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  color-scheme: light;
  --surface: #ffffff;
  --surface-alt: #f6f7f5;
  --ink: #22282b;
  --ink-soft: #3d464a;
  --ink-muted: #5b6569;
  --line: #e2e6e3;
  --line-strong: #8a9097;
  --navy: #0e3350;
  --on-navy: #ffffff;
  --on-navy-muted: #cddfeb;
  --navy-accent: #8bb8de;
  --link: #2165a3;
  --link-hover: #1a5083;
  --red: #ec2023;
  --cwfr-blue: #4a90ce;
  --madp-green: #7ac144;
  --focus: #2165a3;
  --radius-sm: 6px;
  --radius-md: 7px;
  --radius-lg: 10px;
  --space-1: 8px;
  --space-2: 16px;
  --space-3: 24px;
  --space-4: 48px;
  --page-max: 72rem;
  --font-display: "Archivo Black", Archivo, system-ui, sans-serif;
  --font-heading: Archivo, system-ui, sans-serif;
  --font-sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font: 400 16px/24px var(--font-sans);
}
a { color: var(--link); }
a:hover { color: var(--link-hover); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* Side gutters only, so sections keep their own top/bottom padding */
.wrap { width: 100%; max-width: var(--page-max); margin: 0 auto; padding-left: var(--space-3); padding-right: var(--space-3); }

/* Brand bar: both logos on white, with clear space of space-3 around each */
.brandbar { background: #fff; border-bottom: 1px solid var(--line); }
.brandbar__inner { display: flex; align-items: center; gap: var(--space-3); padding-top: var(--space-3); padding-bottom: var(--space-3); }
.logo { display: block; height: 80px; width: auto; }
.logo--madp { height: 70px; }
.brandbar__rule { width: 1px; align-self: stretch; background: var(--line); }

/* Hero */
.hero { position: relative; overflow: hidden; background: var(--navy); color: var(--on-navy); }
.hero__inner { position: relative; z-index: 1; padding-top: 40px; padding-bottom: 44px; }
/* Hero label flanked by one red stripe on each side, cut at the same slant as the logo's stripes */
.hero .eyebrow { display: flex; align-items: center; gap: 14px; width: fit-content; margin-bottom: 16px; font-size: 16px; line-height: 22px; letter-spacing: 0.14em; white-space: nowrap; }
.hero .eyebrow::before, .hero .eyebrow::after { content: ""; flex: none; width: 30px; height: 20px; background: var(--red); clip-path: polygon(18px 0, 100% 0, 12px 100%, 0 100%); }
@media (max-width: 420px) {
  .hero .eyebrow { gap: 10px; font-size: 13px; line-height: 18px; letter-spacing: 0.12em; }
  .hero .eyebrow::before, .hero .eyebrow::after { width: 24px; height: 16px; clip-path: polygon(14px 0, 100% 0, 10px 100%, 0 100%); }
}
@media (max-width: 359px) {
  .hero .eyebrow { gap: 8px; font-size: 12px; letter-spacing: 0.1em; }
  .hero .eyebrow::before, .hero .eyebrow::after { width: 20px; height: 14px; clip-path: polygon(12px 0, 100% 0, 8px 100%, 0 100%); }
}
.eyebrow { margin: 0 0 10px; font: 700 12px/16px var(--font-sans); letter-spacing: 0.16em; text-transform: uppercase; color: var(--on-navy-muted); }
.hero__title { margin: 0; font: 400 clamp(32px, 5.2vw, 52px)/1.02 var(--font-display); letter-spacing: -0.03em; max-width: 22ch; }
.hero__company { margin: 8px 0 0; font: 600 18px/26px var(--font-sans); color: var(--navy-accent); }
.hero__lead { margin: 14px 0 0; font-size: 19px; line-height: 30px; color: var(--on-navy-muted); max-width: 68ch; }
.hero__lead strong { color: var(--on-navy); font-weight: 600; }

/* Main */
.main { padding-top: var(--space-3); padding-bottom: var(--space-4); }
.h2 { margin: 0 0 12px; font: 700 20px/1.24 var(--font-heading); color: var(--ink); }

.range { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px var(--space-3); padding: 16px 0 20px; border-bottom: 1px solid var(--line); }
.range__label { font: 700 20px/1.24 var(--font-heading); color: var(--ink); }
.range__controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }

.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font: 600 13px/18px var(--font-sans); color: var(--ink-muted); }
.field select, .field input {
  height: 42px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: #fff; color: var(--ink); font: 500 15px/1 var(--font-sans);
}
.field select { padding-right: 34px; appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%233d464a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; }
.field--preset select { min-width: 190px; }
.field--date input { width: 158px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); margin-top: var(--space-3); }
.stat { margin: 0; padding: 20px 22px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.stat--lead { border-top: 3px solid var(--red); padding-top: 18px; }
.stat__label { margin: 0; font: 600 14px/20px var(--font-sans); color: var(--ink-soft); }
.stat__value { margin: 6px 0 2px; font: 700 34px/1.1 var(--font-heading); letter-spacing: -0.02em; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat__note { margin: 0; font-size: 14px; line-height: 20px; color: var(--ink-muted); }

.referrers { margin-top: 36px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: #fff; color: var(--ink); font: 500 14.5px/1 var(--font-sans); cursor: pointer; }
.chip b { font-weight: 700; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.chip:hover { border-color: var(--line-strong); }
.chip.is-active { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip.is-active b { color: var(--on-navy-muted); }

.jobs { margin-top: 36px; }
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); overflow-x: auto; overflow-y: hidden; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; display: inline-flex; align-items: center; gap: 8px; padding: 12px 16px 14px; border: 0; background: none; color: var(--ink-muted); font: 700 16px/1.2 var(--font-heading); cursor: pointer; white-space: nowrap; }
.tab__sub { font: 500 14px/1 var(--font-sans); color: var(--ink-muted); }
.tab__count { display: inline-block; min-width: 26px; padding: 3px 8px; border-radius: 999px; background: var(--surface-alt); border: 1px solid var(--line); color: var(--ink-soft); font: 700 12.5px/1.2 var(--font-sans); text-align: center; }
.tab.is-active { color: var(--ink); }
.tab.is-active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: 0; height: 3px; background: var(--navy); border-radius: 3px 3px 0 0; }
.ppp-intro { margin: 16px 0 0; padding: 12px 16px; border-left: 3px solid var(--madp-green); background: var(--surface-alt); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-soft); }

.filters { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.filters.no-by { grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); }
.showing { margin: 16px 0 10px; font-size: 14px; color: var(--ink-muted); }

.table-wrap { border: 1px solid var(--line); border-radius: var(--radius-lg); overflow: hidden; background: #fff; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { padding: 12px 16px; background: var(--surface-alt); border-bottom: 1px solid var(--line); text-align: left; font: 700 12px/16px var(--font-sans); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-soft); white-space: nowrap; }
.table th button { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.table th button:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.table th .arrow { font-size: 10px; color: var(--ink-muted); }
.table th.num, .table td.num { text-align: right; }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafbfa; }
.td-date { white-space: nowrap; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.td-name { font-weight: 600; color: var(--ink); }
.td-shared { display: block; margin-top: 2px; font-weight: 500; font-size: 13.5px; color: var(--ink-muted); }
.td-type { color: var(--ink-soft); }
.co { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 4px; font: 700 10.5px/16px var(--font-sans); letter-spacing: 0.06em; vertical-align: 1px; }
.co--CWFR { background: #e6f0f9; color: #1a5083; }
.co--MADP { background: #ecf5e3; color: #3c6b17; }
.td-fee { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.td-fee.is-none { color: var(--line-strong); font-weight: 500; }

.pill { display: inline-block; padding: 4px 10px; border-radius: 999px; font: 600 13px/18px var(--font-sans); white-space: nowrap; background: #f1f2f3; color: #3d464a; }
.pill[data-s="Received"] { background: #eef1f4; color: #3d464a; }
.pill[data-s="Assessing"] { background: #e8f1fa; color: #1a5083; }
.pill[data-s="In Progress"] { background: #dce9f6; color: #0e3350; }
.pill[data-s="Billing"] { background: #fdf3dc; color: #7a5300; }
.pill[data-s="Paid"] { background: #e7f3dc; color: #33601a; }
.pill[data-s="Complete"] { background: #e7f3dc; color: #33601a; }
.pill[data-s="Written Off"] { background: #f5ecec; color: #7a3b3b; }
.pill[data-s="Did Not Proceed"] { background: #f1f2f3; color: #5b6569; }

.empty { margin: 0; padding: 36px 16px; text-align: center; color: var(--ink-muted); }

.legend { margin-top: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-alt); }
.legend summary { padding: 14px 18px; cursor: pointer; font: 600 15px/22px var(--font-sans); color: var(--ink-soft); }
.legend dl { margin: 0; padding: 0 18px 16px; display: grid; gap: 10px; }
.legend dl > div { display: grid; grid-template-columns: 150px 1fr; gap: 12px; align-items: center; }
.legend dd { margin: 0; color: var(--ink-soft); font-size: 15px; }

.notice { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.notice p { max-width: 60ch; color: var(--ink-soft); }

.footer { background: #0b2438; color: #9fb6c6; font-size: 14px; line-height: 22px; }
.footer__inner { padding-top: 36px; padding-bottom: calc(40px + env(safe-area-inset-bottom)); }
.footer p { margin: 0 0 8px; }
.footer p:last-child { margin-bottom: 0; }
.footer a { color: #cddfeb; }

@media (max-width: 960px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters, .filters.no-by { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .field--search { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .wrap { padding-left: var(--space-2); padding-right: var(--space-2); }
  .brandbar__inner { gap: 20px; padding-top: 18px; padding-bottom: 18px; }
  .logo { height: 58px; }
  .logo--madp { height: 50px; }
  .main { padding-top: 20px; padding-bottom: 40px; }
  .referrers, .jobs { margin-top: 32px; }
  .footer__inner { padding-top: 32px; padding-bottom: calc(36px + env(safe-area-inset-bottom)); }
  .hero__inner { padding-top: 28px; padding-bottom: 34px; }
  .hero__lead { font-size: 17px; line-height: 26px; }
  .range { flex-direction: column; align-items: stretch; }
  .range__controls { display: grid; grid-template-columns: 1fr 1fr; }
  .field--preset { grid-column: 1 / -1; }
  .field--preset select, .field--date input { width: 100%; min-width: 0; }
  .stat { padding: 14px 16px; }
  .stat__value { font-size: 26px; }
  .tab { padding: 12px 10px 14px; font-size: 15px; }
  .tab__sub { display: none; }

  /* Rows become cards */
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table tr { position: relative; padding: 14px 16px; border-bottom: 1px solid var(--line); }
  .table tbody tr:last-child { border-bottom: 0; }
  .table td { padding: 0; border: 0; }
  .table tbody tr:hover td { background: none; }
  .table td.td-name { padding-right: 96px; font-size: 16px; }
  .table td.td-date, .table td.td-type, .table td.td-by { display: inline; font-size: 14px; color: var(--ink-muted); }
  .table td.td-type::before, .table td.td-by::before { content: " · "; }
  .table td.td-status { margin-top: 10px; }
  .table td.td-fee { position: absolute; top: 14px; right: 16px; text-align: right; }
  .table td.td-meta-break { display: block; height: 4px; }
  .legend dl > div { grid-template-columns: 1fr; gap: 4px; }
}

@media (max-width: 374px) {
  .brandbar__inner { gap: 14px; }
  .logo { height: 50px; }
  .logo--madp { height: 43px; }
}

/* Note shown when the selected dates hide some referrals */
.range-hint { margin: var(--space-2) 0 0; padding: 12px 16px; border-radius: var(--radius-sm); background: #e8f1fa; color: var(--ink-soft); font-size: 15px; line-height: 22px; }
.link-btn { padding: 0; border: 0; background: none; color: var(--link); font: 600 15px/22px var(--font-sans); text-decoration: underline; cursor: pointer; }
.link-btn:hover { color: var(--link-hover); }
