/* Cohort Board - the admin side of the PDQ platform.
 *
 * Deliberately light-only.  This is the approved direction and staff use it in an
 * office; a second theme is a choice to make later, not an omission.
 *
 * No Cambridge mark, shield, wordmark or palette appears anywhere in this file.
 * Cambridge's Associate guidelines name class registers and financial documents
 * as places their logo may not be used, and this app is both.  The teal below is
 * derived from their #00BCB4 but darkened and desaturated so it reads as a GenEx
 * choice rather than a borrowed asset.
 */

:root {
  --ink:     #171A21;
  --ground:  #FCFCFD;
  --panel:   #FFFFFF;
  --rule:    #E3E5EA;
  --rule-2:  #EEEFF2;
  --soft:    #69707E;
  --softer:  #98A0AE;

  --accent:    #0F7A72;
  --accent-lo: #E7F4F2;
  --accent-hi: #0B615A;

  /* Status colour is separate from the accent and never used for chrome. */
  --good:    #10774A;  --good-lo: #E4F3EB;
  --warn:    #8A5A00;  --warn-lo: #FBF0DA;
  --bad:     #A5231F;  --bad-lo:  #FBE6E4;
  --off:     #69707E;  --off-lo:  #EEEFF2;

  --shadow: 0 1px 2px rgba(23, 26, 33, .05), 0 4px 16px rgba(23, 26, 33, .06);
  --radius: 6px;

  --f: system-ui, "Segoe UI", -apple-system, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

.tnum { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- top bar */

.topbar {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .8rem 1.25rem;
  background: var(--panel);
  border-bottom: 1px solid var(--rule);
}
.brand {
  font-weight: 700; letter-spacing: -.025em; font-size: 1rem;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand span { color: var(--accent); }

.nav { display: flex; gap: .25rem; }
.nav a {
  font-size: .82rem; font-weight: 500; padding: .32rem .65rem;
  border-radius: 4px; color: var(--soft);
}
.nav a:hover { background: var(--rule-2); color: var(--ink); text-decoration: none; }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }

.topbar .who {
  margin-left: auto; display: flex; align-items: center; gap: .75rem;
  font-size: .8rem; color: var(--soft);
}

/* ------------------------------------------------------------------ shell */

.page { padding: 1.25rem; max-width: 1440px; margin-inline: auto; }
.page > * + * { margin-top: 1rem; }

.page-head { display: flex; align-items: baseline; gap: .75rem; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 1.35rem; font-weight: 650; letter-spacing: -.02em; }
.page-head .count { color: var(--soft); font-size: .85rem; }
.page-head .spacer { margin-left: auto; }

/* --------------------------------------------------------- summary strip */

.strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1px; background: var(--rule);
  border: 1px solid var(--rule); border-radius: var(--radius); overflow: hidden;
}
.strip > div { background: var(--panel); padding: .85rem 1.1rem; }
.strip dt {
  margin: 0 0 .1rem; font-size: .7rem; font-weight: 600;
  color: var(--soft); letter-spacing: .03em;
}
.strip dd {
  margin: 0; font-size: 1.3rem; font-weight: 650;
  letter-spacing: -.03em; font-variant-numeric: tabular-nums;
}
.strip .is-bad dd { color: var(--bad); }
.strip .sub { font-size: .7rem; color: var(--softer); font-weight: 400; letter-spacing: 0; }

/* ----------------------------------------------------------------- panel */

.panel {
  background: var(--panel); border: 1px solid var(--rule);
  border-radius: var(--radius); overflow: hidden;
}
.panel > header {
  padding: .7rem 1.1rem; border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: .75rem;
}
.panel > header h2 { margin: 0; font-size: .9rem; font-weight: 650; }
.panel .empty { padding: 2.5rem 1.1rem; text-align: center; color: var(--soft); font-size: .88rem; }
.panel .empty strong { display: block; color: var(--ink); font-size: .95rem; margin-bottom: .3rem; }

/* --------------------------------------------------------------- filters */

.filters {
  display: flex; gap: .4rem; flex-wrap: wrap; align-items: center;
  padding: .7rem 1.1rem; border-bottom: 1px solid var(--rule);
}
.chip {
  font-size: .76rem; padding: .28rem .62rem; border: 1px solid var(--rule);
  border-radius: 999px; color: var(--soft); background: var(--panel);
  white-space: nowrap;
}
.chip:hover { border-color: var(--softer); color: var(--ink); text-decoration: none; }
.chip[aria-current] {
  border-color: var(--accent); color: var(--accent);
  background: var(--accent-lo); font-weight: 600;
}
.filters .sep { width: 1px; height: 1.1rem; background: var(--rule); margin: 0 .25rem; }
.filters select, .filters input[type="search"] {
  font: inherit; font-size: .78rem; padding: .26rem .5rem;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--panel);
  color: var(--ink);
}
.filters input[type="search"] { min-width: 13rem; }

/* ----------------------------------------------------------------- table */

.scroll-x { overflow-x: auto; }

table.grid { width: 100%; border-collapse: collapse; }
table.grid th {
  text-align: left; font-size: .7rem; font-weight: 600; color: var(--soft);
  padding: .55rem 1.1rem; border-bottom: 1px solid var(--rule);
  white-space: nowrap; letter-spacing: .02em;
}
table.grid td {
  padding: .65rem 1.1rem; border-bottom: 1px solid var(--rule-2);
  font-size: .84rem; vertical-align: middle;
}
table.grid tbody tr:last-child td { border-bottom: 0; }
table.grid tbody tr:hover td { background: #FBFCFC; }
table.grid .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 550; white-space: nowrap; }
table.grid .nm { font-weight: 600; }
table.grid .nm a { color: var(--ink); }
table.grid .nm a:hover { color: var(--accent); }
table.grid .meta { color: var(--soft); font-size: .74rem; font-weight: 400; }
table.grid .shrink { width: 1%; white-space: nowrap; }

/* ------------------------------------------------------------ status pill */

.pill {
  display: inline-block; font-size: .68rem; font-weight: 650;
  padding: .2rem .5rem; border-radius: 3px; white-space: nowrap;
}
.pill.good { background: var(--good-lo); color: var(--good); }
.pill.warn { background: var(--warn-lo); color: var(--warn); }
.pill.bad  { background: var(--bad-lo);  color: var(--bad); }
.pill.off  { background: var(--off-lo);  color: var(--off); }

/* --------------------------------------------- five-instalment segmented bar
 * The product's signature device.  One segment per instalment, so a payment
 * plan reads at a glance without a number being parsed.
 */
.seg { display: inline-flex; gap: 2px; width: 92px; vertical-align: middle; }
.seg i { flex: 1; height: 7px; border-radius: 1px; background: var(--off-lo); display: block; }
.seg i.is-paid     { background: var(--good); }
.seg i.is-promised { background: var(--warn); }
.seg i.is-overdue  { background: var(--bad); }
.seg i.is-invoiced { background: var(--softer); }
.seg i.is-credited { background: repeating-linear-gradient(45deg, var(--off-lo) 0 2px, var(--softer) 2px 3px); }
.seg i.is-flagged  { background: repeating-linear-gradient(45deg, var(--bad-lo) 0 2px, var(--bad) 2px 3px); }

/* --------------------------------------------------------------- buttons */

.btn {
  font: inherit; font-size: .8rem; font-weight: 600;
  padding: .42rem .85rem; border-radius: 4px;
  border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--softer); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); }
.btn.small { font-size: .72rem; padding: .25rem .55rem; }

/* ----------------------------------------------------------------- flash */

.flashes { display: flex; flex-direction: column; gap: .5rem; }
.flash {
  padding: .6rem 1rem; border-radius: var(--radius); font-size: .84rem;
  border: 1px solid var(--rule); background: var(--panel);
}
.flash.success { border-color: #BFE3CE; background: var(--good-lo); color: var(--good); }
.flash.error   { border-color: #F2C7C4; background: var(--bad-lo);  color: var(--bad); }
.flash.info    { border-color: #C6E4E0; background: var(--accent-lo); color: var(--accent-hi); }

/* ------------------------------------------------------------ candidate */

.cols { display: grid; grid-template-columns: minmax(0, 2.2fr) minmax(15rem, 1fr); gap: 1rem; align-items: start; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }

.facts { margin: 0; padding: .85rem 1.1rem; display: grid; gap: .7rem; }
.facts > div { display: grid; gap: .1rem; }
.facts dt { font-size: .7rem; font-weight: 600; color: var(--soft); letter-spacing: .02em; }
.facts dd { margin: 0; font-size: .86rem; word-break: break-word; }
.facts dd.muted { color: var(--softer); }

/* Sensitive fields stay hidden until asked for.  These are collected on a public
 * form and there is no reason for them to sit on screen during a payment chase. */
.reveal summary {
  cursor: pointer; font-size: .74rem; color: var(--accent); list-style: none;
}
.reveal summary::-webkit-details-marker { display: none; }
.reveal summary::before { content: "Show "; }
.reveal[open] summary::before { content: "Hide "; }

.timeline { margin: 0; padding: .5rem 0; list-style: none; }
.timeline li {
  padding: .45rem 1.1rem; font-size: .78rem; color: var(--soft);
  border-left: 2px solid var(--rule); margin-left: 1.1rem;
}
.timeline b { color: var(--ink); font-weight: 600; }
.timeline time { color: var(--softer); }

.note-flag {
  display: inline-block; font-size: .68rem; font-weight: 650; color: var(--warn);
  background: var(--warn-lo); padding: .12rem .4rem; border-radius: 3px;
}

/* ------------------------------------------------------------------ login */

.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 1.5rem;
  background: var(--ground);
}
.login {
  width: 100%; max-width: 22rem; background: var(--panel);
  border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 1.75rem; box-shadow: var(--shadow);
}
.login h1 { margin: 0 0 .2rem; font-size: 1.15rem; font-weight: 700; letter-spacing: -.02em; }
.login h1 span { color: var(--accent); }
.login p.sub { margin: 0 0 1.25rem; font-size: .82rem; color: var(--soft); }
.field { display: grid; gap: .3rem; margin-bottom: .85rem; }
.field label { font-size: .76rem; font-weight: 600; color: var(--soft); }
.field input {
  font: inherit; font-size: .9rem; padding: .5rem .65rem;
  border: 1px solid var(--rule); border-radius: 4px; background: var(--panel); color: var(--ink);
}
.field input:focus { border-color: var(--accent); }
.login .btn { width: 100%; justify-content: center; padding: .55rem; }
