/* FSD Kenya grants management system
   Type scale: 16px base body text, with the ramp stepping up from 12px
   (smallest supporting label) through 14.5px (tables), 16px (body) to 29px
   (page title). Nothing sits below 12px.
   Palette: FSD Blue #244289, FSD Sky Blue #6BC4EA, FSD Navy #122454,
   FSD Orange #F18903, pale blue-grey #DDE4ED, light grey #D0D3D5,
   deep red #A31F34. No colour outside the brand palette is introduced; the
   chart series use in-band tints of the brand hues so that the categorical
   palette passes colour-vision-deficiency separation checks.

   Typography: Graphik is the brand face. It is a licensed font and is not
   embedded here, so the stack falls back to Century Gothic (the brand's
   documented secondary face) and then to the system geometric sans. */

:root {
  --fsd-navy: #122454;
  --fsd-blue: #244289;
  --fsd-sky: #6BC4EA;
  --fsd-orange: #F18903;
  --fsd-pale: #DDE4ED;
  --fsd-grey: #D0D3D5;
  --fsd-red: #A31F34;

  /* Chart series: fixed order, never cycled */
  --series-1: #3559AE;   /* tint of FSD Blue */
  --series-2: #F18903;   /* FSD Orange */
  --series-3: #4EAFDC;   /* shade of FSD Sky Blue */
  --series-4: #A31F34;   /* deep red */

  --ink: #16203a;
  --ink-2: #45506b;
  --ink-3: #6d7793;
  --surface: #ffffff;
  --surface-2: #f6f8fb;
  --surface-3: #eef2f8;
  --line: #e2e8f1;
  --line-strong: #c9d4e4;

  --ok: #1f6b46;
  --ok-bg: #e8f3ed;
  --warn: #8a5200;
  --warn-bg: #fdf1de;
  --bad: #A31F34;
  --bad-bg: #fbeaed;
  --info-bg: #eaf1fb;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(18,36,84,.06), 0 8px 24px rgba(18,36,84,.06);
  --shadow-sm: 0 1px 2px rgba(18,36,84,.08);
  --font: "Graphik", "Century Gothic", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--surface-2);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--fsd-blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { color: var(--fsd-navy); margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 29px; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 10px; }
.mono { font-family: var(--mono); font-size: 13.5px; }
.muted { color: var(--ink-3); }
.fine { font-size: 13.5px; color: var(--ink-3); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: 268px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--fsd-navy);
  color: #fff;
  display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.brandmark { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; }
.brandmark strong { display: block; color: #fff; font-size: 17px; letter-spacing: .01em; }
.brandmark small { display: block; color: var(--fsd-sky); font-size: 12px; letter-spacing: .02em; }
.diamond { width: 22px; height: 22px; background: #fff; flex: none;
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.sidebar nav { padding: 6px 10px; flex: 1; }
.nav-group { margin: 16px 0 5px; padding: 0 9px; font-size: 12px; text-transform: uppercase;
  letter-spacing: .12em; color: rgba(255,255,255,.45); }
.sidebar nav a {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: rgba(255,255,255,.82); font-size: 15px; text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--fsd-blue); color: #fff; font-weight: 500; }
.sidebar nav a .count {
  background: rgba(255,255,255,.16); border-radius: 20px; padding: 0 7px;
  font-size: 12.5px; font-variant-numeric: tabular-nums;
}
.sidebar nav a.active .count { background: rgba(255,255,255,.25); }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.12); font-size: 12.5px; color: rgba(255,255,255,.55); }
.sidebar-foot .tagline { color: var(--fsd-sky); margin-bottom: 6px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  background: var(--surface); border-bottom: 1px solid var(--line);
  padding: 14px 28px; display: flex; align-items: center; gap: 14px;
  position: sticky; top: 0; z-index: 20;
}
.topbar .who { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--fsd-blue); color: #fff;
  display: grid; place-items: center; font-size: 13.5px; font-weight: 600; flex: none;
}
.content { padding: 24px 28px 60px; max-width: 1640px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .lede { color: var(--ink-2); max-width: 78ch; margin: 4px 0 0; }
.page-head .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- cards ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-head { padding: 16px 18px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head .actions { margin-left: auto; display: flex; gap: 6px; }
.card-body { padding: 18px; }
.card-body.tight { padding: 10px 16px; }
.grid { display: grid; gap: 14px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-2-1 { grid-template-columns: 2fr 1fr; }
.g-1-2 { grid-template-columns: 1fr 2fr; }
@media (max-width: 1320px) { .g4 { grid-template-columns: repeat(2, minmax(0,1fr)); } .g-2-1, .g-1-2, .g3 { grid-template-columns: 1fr; } }
@media (max-width: 900px) { .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } .g2, .g4 { grid-template-columns: 1fr; } }

/* ---------- stat tiles ---------- */
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); }
.tile .label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); }
.tile .value { font-size: 32px; font-weight: 600; color: var(--fsd-navy); letter-spacing: -.02em;
  font-variant-numeric: tabular-nums; margin-top: 4px; }
.tile .sub { font-size: 13.5px; color: var(--ink-2); margin-top: 3px; }
.tile.accent { border-left: 3px solid var(--fsd-orange); }
.tile.accent-blue { border-left: 3px solid var(--fsd-blue); }
.tile.accent-sky { border-left: 3px solid var(--fsd-sky); }
.tile.accent-red { border-left: 3px solid var(--fsd-red); }

/* ---------- pills & badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 20px;
  font-size: 12.5px; font-weight: 500; white-space: nowrap; border: 1px solid transparent; }
.pill-ok { background: var(--ok-bg); color: var(--ok); border-color: #c7e3d5; }
.pill-warn { background: var(--warn-bg); color: var(--warn); border-color: #f4dcb4; }
.pill-bad { background: var(--bad-bg); color: var(--bad); border-color: #eecdd3; }
.pill-info { background: var(--info-bg); color: var(--fsd-blue); border-color: #cadcf5; }
.pill-neutral { background: var(--surface-3); color: var(--ink-2); border-color: var(--line); }
.pill-sky { background: #e6f6fd; color: #17627f; border-color: #bfe6f6; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.pill.no-dot::before { display: none; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 15px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; cursor: pointer; }
.btn:hover { background: var(--surface-3); }
.btn-primary { background: var(--fsd-blue); border-color: var(--fsd-blue); color: #fff; }
.btn-primary:hover { background: #1c3570; }
.btn-accent { background: var(--fsd-orange); border-color: var(--fsd-orange); color: #22160a; font-weight: 500; }
.btn-accent:hover { background: #d97c02; }
.btn-danger { background: var(--surface); border-color: #e3bec6; color: var(--fsd-red); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--fsd-blue); }
.btn-ghost:hover { background: var(--info-bg); }
.btn-sm { padding: 5px 11px; font-size: 13.5px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.nowrap { flex-wrap: nowrap; }
.row.between { justify-content: space-between; }

/* ---------- tables ---------- */
table.data { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.data th {
  text-align: left; font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em;
  color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-2); position: sticky; top: 0;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.data tbody tr:hover { background: var(--surface-2); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .strong { font-weight: 600; color: var(--fsd-navy); }
.table-wrap { overflow-x: auto; }
table.data.wide { min-width: 1440px; }
table.data th, table.data td { overflow-wrap: break-word; }
/* Figures, references and status pills never break across lines. */
table.data td.num, table.data th.num { white-space: nowrap; }
table.data .mono, table.data .pill { white-space: nowrap; }
.table-wrap.scroll-y { max-height: 460px; overflow-y: auto; }

/* ---------- forms ---------- */
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; padding: 9px 12px; font: inherit; font-size: 15px; color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--fsd-sky); outline-offset: -1px; border-color: var(--fsd-blue); }
textarea { min-height: 84px; resize: vertical; }
.checkbox { display: flex; align-items: flex-start; gap: 8px; font-size: 15px; margin-bottom: 8px; }
.checkbox input { margin-top: 3px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin: 0 0 14px; }
legend { font-size: 13.5px; font-weight: 600; color: var(--fsd-blue); padding: 0 5px; }

/* ---------- notices ---------- */
.notice { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 15px; margin-bottom: 14px;
  border-left: 3px solid var(--fsd-blue); background: var(--info-bg); color: #1b3363; }
.notice-ok { border-color: var(--ok); background: var(--ok-bg); color: var(--ok); }
.notice-warn { border-color: var(--fsd-orange); background: var(--warn-bg); color: var(--warn); }
.notice-error { border-color: var(--fsd-red); background: var(--bad-bg); color: var(--bad); }
.notice-policy { border-color: var(--fsd-orange); background: var(--warn-bg); color: #6c4100; }
.notice strong { font-weight: 600; }

/* ---------- grant cycle stepper ---------- */
.cycle { display: flex; gap: 0; overflow-x: auto; padding: 4px 0 10px; }
.cycle-step { flex: 1 1 0; min-width: 88px; position: relative; padding: 0 6px; }
.cycle-step .bar { height: 5px; border-radius: 3px; background: var(--fsd-pale); margin-bottom: 8px; }
.cycle-step.complete .bar { background: var(--fsd-blue); }
.cycle-step.current .bar { background: var(--fsd-orange); }
.cycle-step .name { font-size: 12.5px; font-weight: 500; color: var(--ink-2); line-height: 1.3; }
.cycle-step.complete .name, .cycle-step.current .name { color: var(--fsd-navy); }
.cycle-step.current .name { font-weight: 600; }
.cycle-step .when { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

/* ---------- pipeline board ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.board-col { flex: 0 0 320px; background: var(--surface-3); border-radius: var(--radius); padding: 12px; }
.board-col > header { margin-bottom: 10px; }
.board-col h3 { font-size: 15px; }
.board-col .col-meta { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.board-card { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--fsd-blue);
  border-radius: var(--radius-sm); padding: 10px; margin-bottom: 9px; box-shadow: var(--shadow-sm); cursor: pointer; }
.board-card:hover { border-color: var(--fsd-sky); }
.board-card.blocked { border-left-color: var(--fsd-orange); }
.board-card h4 { font-size: 15px; line-height: 1.35; margin-bottom: 4px; }
.board-card .meta { font-size: 12.5px; color: var(--ink-3); }
.board-card .amount { font-weight: 600; color: var(--fsd-navy); font-variant-numeric: tabular-nums; }

/* ---------- progress meters ---------- */
.meter { height: 7px; background: var(--fsd-pale); border-radius: 4px; overflow: hidden; display: flex; }
.meter > span { display: block; height: 100%; }
.meter .m1 { background: var(--series-1); }
.meter .m2 { background: var(--series-2); }
.meter .m3 { background: var(--series-3); }
.meter .m4 { background: var(--series-4); }
.meter-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12.5px; color: var(--ink-2); margin-top: 6px; }
.meter-legend i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; margin-right: 5px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button { background: none; border: none; border-bottom: 2px solid transparent; padding: 11px 15px;
  font: inherit; font-size: 15px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.tabs button:hover { color: var(--fsd-navy); }
.tabs button.active { color: var(--fsd-navy); border-bottom-color: var(--fsd-orange); font-weight: 600; }

/* ---------- key/value ---------- */
dl.kv { display: grid; grid-template-columns: minmax(170px, auto) 1fr; gap: 8px 18px; margin: 0; font-size: 15px; }
dl.kv dt { color: var(--ink-3); font-size: 13.5px; }
dl.kv dd { margin: 0; color: var(--ink); }

/* ---------- charts ---------- */
.chart { width: 100%; }
.chart text { font-family: var(--font); fill: var(--ink-2); }
.chart .axis-label { font-size: 12px; fill: var(--ink-3); }
.chart .value-label { font-size: 12.5px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13.5px; color: var(--ink-2); margin-top: 8px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 10px; height: 10px; border-radius: 2px; }
.chart-tooltip {
  position: fixed; pointer-events: none; z-index: 90; background: var(--fsd-navy); color: #fff;
  padding: 6px 9px; border-radius: var(--radius-sm); font-size: 13.5px; box-shadow: var(--shadow);
  opacity: 0; transition: opacity .1s; max-width: 260px;
}
.chart-tooltip.on { opacity: 1; }
.chart-tooltip b { color: var(--fsd-sky); }
.chart-wrap .toggle-table { font-size: 12.5px; }

/* ---------- drawer & modal ---------- */
.scrim { position: fixed; inset: 0; background: rgba(18,36,84,.35); z-index: 50; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(620px, 96vw); background: var(--surface);
  z-index: 60; box-shadow: -12px 0 40px rgba(18,36,84,.18); display: flex; flex-direction: column; }
.drawer > header { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; }
.drawer > header .close { margin-left: auto; }
.drawer .drawer-body { padding: 20px; overflow-y: auto; flex: 1; }
.drawer > footer { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- toast ---------- */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: var(--fsd-navy); color: #fff; padding: 11px 14px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow); font-size: 15px; max-width: 420px; border-left: 3px solid var(--fsd-sky); }
.toast.error { border-left-color: var(--fsd-orange); }
.toast.ok { border-left-color: #6fce9f; }

/* ---------- sign-in ---------- */
.signin-page { min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr; }
@media (max-width: 900px) { .signin-page { grid-template-columns: 1fr; } .signin-hero { display: none; } }
.signin-hero { background: var(--fsd-navy); color: #fff; padding: 40px 42px; display: flex; flex-direction: column;
  position: relative; overflow: hidden; }
/* No heading and no prose on the splash: the photograph and the brandmark carry
   it. Rules kept for the brandmark alone. */
.waves { position: absolute; inset: auto -10% -12% -10%; height: 320px; opacity: .95; }
.signin-panel { display: grid; place-items: center; padding: 40px 24px; }
.signin-card { width: min(430px, 100%); }
.signin-card h2 { font-size: 23px; margin-bottom: 6px; }
.divider { display: flex; align-items: center; gap: 10px; margin: 20px 0; color: var(--ink-3); font-size: 12.5px;
  text-transform: uppercase; letter-spacing: .08em; }
.divider::before, .divider::after { content: ""; height: 1px; background: var(--line); flex: 1; }
.sso-btn { width: 100%; justify-content: center; padding: 11px; font-size: 16px; }

/* ---------- signing ceremony page ---------- */
body.ceremony { background: var(--surface-2); }
.ceremony-head { background: var(--fsd-navy); padding: 14px 24px; display: flex; align-items: center; gap: 16px; }
.ceremony-head .pill { margin-left: auto; }
.ceremony-main { max-width: 720px; margin: 32px auto; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.ceremony-main h1 { font-size: 24px; }
.ceremony-main .lede { color: var(--ink-2); margin-top: 4px; }
.ceremony-meta { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 20px 0; }
.ceremony-meta dt { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }
.ceremony-meta dd { margin: 2px 0 0; font-size: 15px; }
.ceremony-form { border-top: 1px solid var(--line); padding-top: 18px; }
.ceremony-form label { display: block; font-size: 13.5px; font-weight: 500; color: var(--ink-2); margin-bottom: 5px; }
.ceremony-form input { max-width: 340px; font-family: "Segoe Script", "Bradley Hand", cursive; font-size: 21px; }
.ceremony-foot { text-align: center; color: var(--ink-3); font-size: 13.5px; padding: 20px; }

/* ---------- misc ---------- */
.empty { padding: 28px; text-align: center; color: var(--ink-3); font-size: 15px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--fsd-pale); border-top-color: var(--fsd-blue);
  border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px; }
.mode-chip { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3);
  color: var(--ink-3); border: 1px solid var(--line); text-transform: uppercase; letter-spacing: .06em; }
.mode-chip.live { background: var(--ok-bg); color: var(--ok); border-color: #c7e3d5; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.timeline li:last-child { border-bottom: none; }
.timeline .when { font-size: 12.5px; color: var(--ink-3); }
.attention-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line); }
.attention-item:last-child { border-bottom: none; }
.attention-item .val { margin-left: auto; font-weight: 600; color: var(--fsd-navy); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dd-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.dd-row:last-child { border-bottom: none; }
.dd-cat { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-3); }

/* ---------- environment banner ----------
   Outside production, on every screen. Deliberately loud: the cost of somebody
   mistaking a training system for the live one is higher than the cost of an
   ugly stripe. */
.env-banner {
  background: var(--fsd-orange); color: #22160a; padding: 8px 22px;
  font-size: 14px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap;
  border-bottom: 1px solid #d97c02;
}
.env-banner strong { font-weight: 600; }
.env-banner .fine { color: rgba(34,22,10,.72); }

/* ---------- report builder ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  font: inherit; font-size: 13.5px; padding: 5px 11px; border-radius: 20px; cursor: pointer;
  background: var(--surface); color: var(--ink-2); border: 1px solid var(--line-strong);
}
.chip:hover { border-color: var(--fsd-blue); color: var(--fsd-blue); }
.chip.on { background: var(--fsd-blue); border-color: var(--fsd-blue); color: #fff; }
.chip:focus-visible { outline: 2px solid var(--fsd-sky); outline-offset: 2px; }

.filter-row {
  display: flex; gap: 8px; align-items: center; flex-wrap: wrap;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.filter-row:last-child { border-bottom: none; }
.filter-row select, .filter-row input { width: auto; min-width: 130px; }

/* The generated SQL, shown so a figure can be traced to how it was arrived at. */
details > summary { cursor: pointer; }
details > summary:hover { color: var(--fsd-navy); }

/* ---------- accents used by the newer tiles ---------- */
.tile.accent-orange { border-left: 3px solid var(--fsd-orange); }


/* ---------- sign-in splash ----------
   Photographs of the sector the grants serve, cross-fading behind the navy.
   The scrim is what keeps the type legible over a photograph rather than
   trusting any one image to be dark enough. */
.splash-images { position: absolute; inset: 0; overflow: hidden; }
.splash-slide {
  position: absolute; inset: 0;
  background-size: cover; background-position: center;
  opacity: 0; transition: opacity 1.6s ease-in-out;
}
.splash-slide.on { opacity: 1; }
.splash-scrim {
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, rgba(18,36,84,.86) 0%, rgba(18,36,84,.72) 40%, rgba(18,36,84,.94) 100%),
    linear-gradient(90deg, rgba(18,36,84,.55) 0%, rgba(18,36,84,0) 70%);
}
.splash-body {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  flex: 1; min-height: 0;
}
/* The brand at the top, everything else pushed to the bottom, and the
   photograph left to do the work in between. */
.splash-foot { margin-top: auto; }

/* One line, not a notice. It has to be read, and a paragraph of legal text on a
   sign-in page is not read — it is skipped as furniture. */
.private-line {
  margin: 0 0 14px; max-width: 46ch;
  font-size: 13.5px; line-height: 1.5; color: rgba(255,255,255,.72);
}
.private-line strong { color: #fff; }

.splash-caption { font-size: 12px; color: rgba(255,255,255,.5); letter-spacing: .02em; }
.splash-credit { margin-top: 5px; font-size: 11px; color: rgba(255,255,255,.38); max-width: 62ch; line-height: 1.5; }
.splash-credit a { color: rgba(255,255,255,.55); }

/* ---------- the sign-in steps ----------
   The address is asked for first and the password only once it is known to be
   able to work, so the card grows a step at a time rather than showing every
   field at once. */
.signin-status { margin-top: 14px; }
.signin-step { margin-top: 14px; }
.signin-step .field { margin-top: 12px; }

/* The address already given, with a way back to it. */
.signed-as {
  display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
  padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--surface-3); border: 1px solid var(--line);
  font-size: 14px; color: var(--ink-1);
}

button.linklike {
  background: none; border: 0; padding: 0; margin-top: 10px;
  font: inherit; font-size: 13.5px; color: var(--fsd-blue);
  text-decoration: underline; cursor: pointer;
}
.signed-as button.linklike { margin-top: 0; margin-left: auto; font-size: 13px; }
button.linklike:hover { color: var(--fsd-navy); }
button.linklike:disabled { color: var(--ink-3); cursor: default; text-decoration: none; }

/* On a narrow screen the photograph is hidden, so the one line that must not be
   missed appears beside the form instead. */
@media (max-width: 900px) {
  .signin-panel::before {
    content: "Private system. Authorised users only. Every sign-in attempt is recorded.";
    display: block; max-width: 46ch; margin: 0 auto 18px;
    font-size: 13px; line-height: 1.5; color: var(--ink-2);
  }
}
@media (prefers-reduced-motion: reduce) {
  .splash-slide { transition: none; }
}

/* ---------- onboarding lights ----------
   Red and green, and the rule is the same everywhere: red is blocking now, amber
   is not yet due, green is done, grey does not apply. Colour is never the only
   signal — every row carries the verdict in words beside the lamp, because a
   reader who cannot distinguish red from green must still be able to read it. */
.lamp {
  width: 12px; height: 12px; border-radius: 50%; flex: none;
  margin-top: 4px; box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}
.lamp-green { background: var(--ok); }
.lamp-amber { background: var(--fsd-orange); }
.lamp-red   { background: var(--fsd-red); }
.lamp-grey  { background: var(--ink-3); box-shadow: none; }

.onboarding-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
}
.onboarding-head.tone-green { border-left-color: var(--ok); background: var(--ok-bg); }
.onboarding-head.tone-amber { border-left-color: var(--fsd-orange); background: var(--warn-bg); }
.onboarding-head.tone-red   { border-left-color: var(--fsd-red); background: var(--bad-bg); }
.onboarding-head strong { font-size: 15.5px; }
.onboarding-head > div:first-of-type { flex: 1; }

.onboarding-tally { display: flex; gap: 6px; }
.tally {
  min-width: 26px; text-align: center; padding: 2px 7px; border-radius: 20px;
  font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.tally-green { background: var(--ok-bg); color: var(--ok); }
.tally-amber { background: var(--warn-bg); color: var(--warn); }
.tally-red   { background: var(--bad-bg); color: var(--bad); }

.onboarding-rows { display: flex; flex-direction: column; }
.onboarding-row {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  border-left: 4px solid transparent;
}
.onboarding-row:last-child { border-bottom: none; }
/* Only a blocking row is tinted. Tinting all of them would make the one that
   matters no easier to find, which is the entire purpose. */
.onboarding-row.tone-red { border-left-color: var(--fsd-red); background: var(--bad-bg); }
.onboarding-row.tone-amber { border-left-color: var(--fsd-orange); }
.onboarding-row.tone-green { border-left-color: var(--ok); }
.onboarding-what { flex: 1; min-width: 0; }
.onboarding-label { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 3px; }
.onboarding-next {
  margin-top: 5px; font-size: 13px; color: var(--ink-1);
  padding-left: 10px; border-left: 2px solid var(--fsd-orange);
}
.onboarding-row .btn-small { flex: none; margin-top: 2px; }
.onboarding .notice { margin: 12px 16px 14px; }
.card-flush .card-body { padding: 0; }

@media (max-width: 640px) {
  .onboarding-row { flex-wrap: wrap; }
  .onboarding-row .btn-small { margin-left: 24px; }
}

/* A row somebody was sent to by following a link, so the destination is obvious
   rather than left to be hunted for. */
@keyframes rowFlash { from { background: var(--warn-bg); } to { background: transparent; } }
.row-flash { animation: rowFlash 2s ease-out; }

.problem-row { padding: 10px 0; border-bottom: 1px solid var(--line); }
.problem-row:last-child { border-bottom: none; }
.problem-row ul { margin: 4px 0 0; padding-left: 18px; color: var(--ink-1); font-size: 13.5px; }
.problem-row li { margin-bottom: 3px; }
a.linklike {
  font-size: 13px; color: var(--fsd-blue); text-decoration: underline; cursor: pointer;
}
a.linklike:hover { color: var(--fsd-navy); }


/* Registering a grant in Business Central. Scoped, because the panel sits inside
   a flush card and needs its own padding back. */
.erp-reg { display: flex; flex-direction: column; gap: 12px; padding: 16px; }
.erp-reg .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.erp-reg ul.fine { margin: 4px 0 0 18px; }
.erp-reg h4 { margin: 12px 0 4px; }

/* Which of the ERP's two budgets a figure is on. Sits above the tiles, because
   "the budget" is ambiguous once there are two of them. */
.basis-choose { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.basis-choose .row { gap: 6px; }

/* ---------------------------------------------------------------------------
   The executive overview.

   A dense page that has to stay readable: five headline figures across the top,
   then panels in a 2:1 and a 3-up grid. The grids collapse rather than scroll —
   a dashboard that scrolls sideways is a dashboard nobody reads the right-hand
   third of.
   --------------------------------------------------------------------------- */
.overview-head .select { min-width: 260px; }

.kpi-strip {
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px;
}
.kpi {
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; border-top: 3px solid var(--fsd-pale);
}
.kpi-ok   { border-top-color: var(--ok); }
.kpi-warn { border-top-color: var(--fsd-orange); }
.kpi-bad  { border-top-color: var(--fsd-red); }
.kpi-label {
  font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2); font-weight: 600;
}
.kpi-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; margin: 6px 0 2px; }
.kpi-value { font-size: 27px; font-weight: 600; color: var(--fsd-navy); letter-spacing: -.02em; line-height: 1.1; }
.kpi-sub { font-size: 12.5px; color: var(--ink-2); }
.sparkline { flex: none; }

/* minmax(0, …) rather than a bare fr: a grid track sized in fr will not shrink
   below the intrinsic width of its content, so a wide table in the second column
   squeezes the first one to nothing. */
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 14px; margin-bottom: 14px; align-items: stretch; }
/* Both cards take the row's height, so a short chart beside a long list does not
   leave a band of empty page under it. */
.grid-2-1 > .card { display: flex; flex-direction: column; }
.grid-2-1 > .card > *:last-child { flex: 1; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; align-items: start; }

/* Programme performance, as a list rather than a table: five columns do not fit
   a third of the page, and a table that scrolls sideways loses its last column. */
.prog-list { display: flex; flex-direction: column; }
.prog-row { display: flex; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.prog-row:last-child { border-bottom: 0; }
.prog-what { flex: 1; min-width: 0; }
/* Compact progress figures: two thin bars to a row, no circular gauges. */
.prog-stats { display: flex; gap: 14px; align-items: center; flex: none; }
.prog-stat { min-width: 74px; }
.prog-stat-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.prog-stat-head .fine { text-transform: uppercase; letter-spacing: .03em; font-size: 10px; }
.prog-pct { font-weight: 700; font-size: 13px; }
.prog-bar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; margin-top: 3px; }
.prog-bar > i { display: block; height: 100%; background: var(--series-1); border-radius: 2px; }
.prog-stat:nth-child(2) .prog-bar > i { background: var(--series-2); }

/* A panel with nothing behind it. Deliberately not an empty chart: an empty
   chart is read as a chart of zero. */
.panel-absent {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 18px 4px; color: var(--ink-2);
}
.panel-absent-mark {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  border: 1.5px dashed var(--ink-3); color: var(--ink-3);
  display: grid; place-items: center; font-size: 15px;
}

/* Indicators wanting attention. The bar is progress; the marker is where the
   period has reached. The gap between them is the finding. */
.ind-list { display: flex; flex-direction: column; }
.ind-row { padding: 11px 0; border-bottom: 1px solid var(--line); }
.ind-row:last-child { border-bottom: 0; }
.ind-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 7px; }
.ind-track { position: relative; height: 8px; margin: 0 0 6px; }
.ind-bar { position: absolute; inset: 0; background: var(--fsd-pale); border-radius: 4px; overflow: hidden; }
.ind-bar i { display: block; height: 100%; background: var(--fsd-orange); border-radius: 4px; }
.ind-mark {
  position: absolute; top: -3px; width: 2px; height: 14px; background: var(--fsd-navy);
  border-radius: 1px;
}
.ind-mark::after {
  content: ''; position: absolute; top: -3px; left: -2px;
  border: 3px solid transparent; border-top-color: var(--fsd-navy);
}

/* Reach. */
.reach-total { padding-bottom: 6px; }
.reach-total .value { font-size: 30px; font-weight: 600; color: var(--fsd-navy); letter-spacing: -.02em; }
.disagg { margin-top: 12px; }
.disagg-parts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 6px; }
.disagg-part { min-width: 0; }
.disagg-value { font-size: 16px; font-weight: 600; color: var(--fsd-navy); }
.disagg-bar { height: 4px; background: var(--fsd-pale); border-radius: 2px; margin-top: 5px; overflow: hidden; }
.disagg-bar i { display: block; height: 100%; background: var(--series-1); }

/* Counties, ranked. Not a map — see the note on the panel. */
.county-list { display: flex; flex-direction: column; gap: 7px; margin: 10px 0; }
.county-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: 10px; align-items: center; }
.county-name { display: flex; flex-direction: column; min-width: 0; }
.county-name span:first-child { font-size: 13.5px; }
.county-bar { height: 8px; background: var(--fsd-pale); border-radius: 4px; overflow: hidden; }
.county-bar i { display: block; height: 100%; background: var(--series-1); border-radius: 4px; }
.county-value { font-size: 13px; font-weight: 600; color: var(--fsd-navy); white-space: nowrap; }

/* Deliverables. */
.deliv-counts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { text-align: center; padding: 10px 4px; border-radius: 8px; background: var(--surface-2, #f7f8fa); }
.stat-value { font-size: 22px; font-weight: 600; color: var(--fsd-navy); }
.stat.tone-ok    { background: #eaf4ee; }
.stat.tone-warn  { background: var(--warn-bg); }
.stat.tone-bad   { background: #fbeaec; }
.deliv-group { margin-top: 12px; }
.deliv-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 8px 0 8px 10px; border-left: 3px solid var(--fsd-pale); margin-top: 6px;
}
.deliv-row.tone-bad  { border-left-color: var(--fsd-red); }
.deliv-row.tone-warn { border-left-color: var(--fsd-orange); }
.deliv-row.tone-ok   { border-left-color: var(--ok); }

/* Data quality, and what wants a person. */
.quality-row {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.quality-row:last-child { border-bottom: 0; }
.attention { display: flex; flex-direction: column; }
.attention-row {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  padding: 11px 0 11px 11px; border-left: 3px solid var(--fsd-pale); margin-bottom: 8px;
  border-radius: 0 6px 6px 0;
}
.attention-row.tone-bad  { border-left-color: var(--fsd-red); background: #fdf6f7; }
.attention-row.tone-warn { border-left-color: var(--fsd-orange); background: var(--warn-bg); }

.page-foot { margin: 8px 2px 24px; }

@media (max-width: 1200px) {
  .kpi-strip { grid-template-columns: repeat(3, 1fr); }
  .grid-2-1, .grid-3 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .kpi-strip, .grid-2-1, .grid-3 { grid-template-columns: 1fr; }
  .disagg-parts { grid-template-columns: repeat(2, 1fr); }
}

/* A row somebody was linked to. Held for as long as they are on the page rather
   than fading, because a highlight that has gone by the time the eye arrives is
   worse than none. */
tr.row-focus > td { background: var(--warn-bg); }
tr.row-focus > td:first-child { box-shadow: inset 3px 0 0 var(--fsd-orange); }

/* Anything on the overview that opens something else. The affordance is the same
   wherever it appears: the row lifts, and an arrow shows on the tiles. */
.kpi-link, .is-link { cursor: pointer; position: relative; }
.kpi-link:hover, .is-link:hover { background: var(--surface-2); }
.kpi-link:focus-visible, .is-link:focus-visible { outline: 2px solid var(--fsd-blue); outline-offset: 2px; }
.kpi-go {
  position: absolute; top: 12px; right: 13px; color: var(--ink-3);
  font-size: 14px; opacity: 0; transition: opacity .12s ease, transform .12s ease;
}
.kpi-link:hover .kpi-go { opacity: 1; transform: translateX(2px); }
.ind-row.is-link, .county-row.is-link, .prog-row.is-link { border-radius: 6px; }
.ind-row.is-link:hover, .prog-row.is-link:hover { padding-left: 8px; margin-left: -8px; padding-right: 8px; margin-right: -8px; }
.county-row.is-link:hover { box-shadow: 0 0 0 8px var(--surface-2); }

/* The access log. Signals first — each one shows the arithmetic it rests on, so
   a reader can judge it rather than trust it. */
.signals { display: flex; flex-direction: column; gap: 10px; }
.signal { border-left: 3px solid var(--fsd-pale); padding: 11px 0 11px 12px; border-radius: 0 6px 6px 0; }
.signal.tone-bad { border-left-color: var(--fsd-red); background: #fdf6f7; }
.signal.tone-warn { border-left-color: var(--fsd-orange); background: var(--warn-bg); }
.signal.tone-neutral { border-left-color: var(--ink-3); background: var(--surface-2); }
.signal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.signal-counted {
  display: flex; gap: 16px; flex-wrap: wrap; margin-top: 7px;
  padding-top: 7px; border-top: 1px dashed var(--line);
}
label.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13.5px; color: var(--ink-2); }

/* The change since the previous quarter, under each headline figure. Up is the
   wanted direction on all five tiles, so up is green and down red — the
   convention the reference dashboards use. */
.kpi-delta { display: flex; align-items: baseline; gap: 4px; font-size: 12.5px; margin: 2px 0 4px; }
.kpi-delta strong { font-weight: 600; }
.kpi-delta .delta-mark { font-size: 10px; }
.kpi-delta.delta-up { color: var(--ok); }
.kpi-delta.delta-down { color: var(--fsd-red); }
.kpi-delta.delta-flat { color: var(--ink-3); }
.kpi-delta .fine { color: var(--ink-3); }

/* Segmented control — "My projects" against "All grants" on the Grants list.
   One control, two mutually exclusive scopes, so a lead sees at a glance which
   they are on. */
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); overflow: hidden; flex: none; }
.seg-btn { border: 0; background: var(--surface); color: var(--ink-2); font: inherit; font-size: 13.5px; padding: 6px 12px; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn.is-on { background: var(--series-1); color: #fff; }
.seg-btn:not(.is-on):hover { background: var(--surface-3); }

/* Due diligence matrix — the pillar → area layout in the assessment drawer. */
.dd-pillar { border: 1px solid var(--line); border-radius: 8px; padding: 6px 14px 8px; margin: 14px 0; }
.dd-pillar > legend { padding: 0 6px; font-size: 14.5px; }
.dd-area { padding: 11px 0; border-top: 1px solid var(--line); }
.dd-area:first-of-type { border-top: 0; }
.dd-area > p.fine { margin: 3px 0 9px; }
.dd-area .row { gap: 12px; align-items: flex-end; }
.dd-breakdown > summary { cursor: pointer; padding: 4px 0; }

/* Financial ratios analysis — the input grid and the trend colours. */
.fin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; margin: 4px 0 2px; }
.fin-table th, .fin-table td { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: right; }
.fin-table th:first-child, .fin-table td:first-child { text-align: left; color: var(--ink-2); }
.fin-table tr.fin-group td { background: var(--surface-2); font-weight: 600; text-align: left; color: var(--ink); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
.fin-in { width: 100%; max-width: 120px; text-align: right; padding: 4px 6px; }
.fin-yr { width: 100%; max-width: 110px; text-align: right; padding: 4px 6px; font-weight: 600; }
.fin-ratios { margin-top: 8px; }
.fin-ratios .card { margin-bottom: 12px; }
.fin-up { color: var(--ok); font-weight: 700; }
.fin-down { color: var(--fsd-red, var(--bad)); font-weight: 700; }
.fin-flat { color: var(--ink-3); }

/* Interactive dashboard — the active-filter chip, programme cross-filter, drill link. */
.filter-chip { display: inline-flex; align-items: center; gap: 7px; cursor: pointer;
  background: var(--accent-soft, #eaf1fb); border: 1px solid var(--series-1); border-radius: 999px;
  padding: 5px 10px 5px 12px; color: var(--ink); font: inherit; font-size: 13px; margin-right: 8px; }
.filter-chip:hover { background: #dfeafb; }
.filter-chip .chip-x { font-size: 15px; line-height: 1; color: var(--series-1); font-weight: 700; }
.filter-chip .strong { font-weight: 600; }
.prog-row.is-active { background: var(--accent-soft, #eaf1fb); box-shadow: inset 3px 0 0 var(--series-1); border-radius: 6px; }
.prog-drill { display: inline-block; margin-top: 3px; color: var(--series-1); text-decoration: none; }
.prog-drill:hover { text-decoration: underline; }
