/* Layout and components. Colours come only from theme.css variables. */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: var(--font-body); color: var(--text); background: var(--page-bg); font-size: 15px; line-height: 1.45; }
a { color: var(--accent-ink); }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; margin: 0; }
h1 { font-size: 32px; line-height: 1.15; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 0.75rem; }

/* ---- shell ---- */
.topbar { background: var(--header-bg); color: var(--header-text); display: flex; align-items: center;
  justify-content: space-between; padding: 0 28px; height: 64px; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--header-text); text-decoration: none; }
/* pass 13 (Q11): the Your Focus logo, on a light chip 36px high */
.logo { display: inline-flex; align-items: center; height: 36px; padding: 7px 10px; background: var(--logo-bg);
  border-radius: var(--radius-sm); }
.logo img { display: block; height: 22px; width: auto; }
.logo-slot { width: 34px; height: 34px; border: 1px dashed var(--header-muted); border-radius: 6px; display: flex;
  align-items: center; justify-content: center; font-size: 8px; letter-spacing: .06em; color: var(--header-muted); }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 21px; }
.brand-sub { color: var(--header-muted); font-size: 13px; margin-left: 2px; }
.who { display: flex; align-items: center; gap: 18px; font-size: 13px; }
.who .org { color: var(--header-muted); }
.who .user { font-weight: 700; }
.who form { margin: 0; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--header-muted); font: inherit; font-size: 13px;
  cursor: pointer; text-decoration: underline; }
.shell { display: flex; min-height: calc(100vh - 64px); }
.sidebar { width: 210px; flex: 0 0 210px; background: var(--sidebar-bg); padding: 22px 14px; }
.sidebar a { display: block; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none;
  font-size: 15px; margin-bottom: 2px; }
.sidebar a:hover { background: rgba(0,0,0,.04); }
.sidebar a.active { background: var(--accent); color: var(--accent-contrast); font-weight: 700; }
.sidebar .nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-soft);
  margin: 22px 12px 6px; font-weight: 700; }
.main { flex: 1; padding: 28px 36px 60px; min-width: 0; }
.content { max-width: 1120px; }

/* ---- page head ---- */
.backlink { display: inline-block; font-size: 13px; color: var(--text-muted); text-decoration: none; margin-bottom: 10px; font-weight: 600; }
.backlink:hover { color: var(--text); }
.pagehead { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 20px; }
.pagehead .sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.title-row { display: flex; align-items: center; gap: 12px; }

/* ---- buttons ---- */
.btn { display: inline-block; border-radius: var(--radius-sm); padding: 10px 16px; font: inherit; font-weight: 700;
  font-size: 14px; text-decoration: none; cursor: pointer; border: 1px solid transparent; line-height: 1.2; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--card-bg); color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--text-soft); }
.btn-small { padding: 6px 10px; font-size: 13px; }
.btn[disabled], .btn.disabled { opacity: .5; cursor: not-allowed; }

/* ---- cards ---- */
.card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; }
.card-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 700; margin: 0 0 14px; }
.section-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-muted); font-weight: 700; margin: 22px 0 10px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-2 > div > .card:last-child { margin-bottom: 0; }
.stub-note { font-size: 12px; color: var(--text-soft); font-style: italic; }
.muted { color: var(--text-muted); }
.small { font-size: 13px; }

/* ---- needs attention ---- */
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.tile { border-radius: var(--radius-sm); padding: 14px 16px; min-height: 96px; }
.tile .n { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; margin-bottom: 8px; }
.tile .t { font-weight: 700; font-size: 14px; }
.tile .s { font-size: 12px; margin-top: 2px; opacity: .85; }
.tile.bad { background: var(--bad-bg); color: var(--bad-text); }
.tile.warn { background: var(--warn-bg); color: var(--warn-text); }
.tile.muted { background: var(--muted-bg); color: var(--muted-text); }
.tile.zero { background: var(--muted-bg); color: var(--muted-text); }

/* ---- group cards ---- */
.groups { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.gcard { display: block; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; text-decoration: none; color: var(--text); }
.gcard:hover { border-color: var(--border-strong); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.gcard .gt { font-weight: 700; font-size: 16px; }
.gcard .gd { color: var(--text-muted); font-size: 13px; margin-top: 2px; }
.gcard .gorg { color: var(--text-soft); font-size: 12px; margin-top: 2px; }
.gcard .gb { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-weight: 700; font-size: 14px; }

/* ---- pills ---- */
.pill { display: inline-block; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.pill.good { background: var(--good-bg); color: var(--good-text); }
.pill.warn { background: var(--warn-bg); color: var(--warn-text); }
.pill.bad { background: var(--bad-bg); color: var(--bad-text); }
.pill.muted { background: var(--muted-bg); color: var(--muted-text); }
.pill.private { background: var(--private-bg); color: var(--private-text); }

/* ---- banner ---- */
.banner { border-radius: var(--radius-sm); padding: 12px 18px; display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 18px; font-weight: 600; font-size: 14px; }
.banner.bad { background: var(--bad-bg); color: var(--bad-text); }
.banner.info { background: var(--accent-pale); color: var(--accent-ink); }
.banner.warn { background: var(--warn-bg); color: var(--warn-text); }

/* ---- tables ---- */
.tablewrap { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.tablewrap .scroll { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 14px; }
table.data th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-muted);
  font-weight: 700; padding: 13px 14px; background: var(--page-bg); border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr.flag td { background: var(--flag-row-bg); }
table.data td.name { white-space: nowrap; }
/* Pass 30: a wide table whose headings, and the words in its number columns ("Nothing billed in CMS to pay on",
   "lead pays the co-facilitator", "Rate not set (5 sessions)"; track-c.css keeps td.num on one line), may wrap,
   so it fits its box at desk width instead of scrolling inside it. Amounts have no spaces, so they never break. */
table.data.fit-box th { white-space: normal; vertical-align: bottom; }
table.data.fit-box td.num { white-space: normal; }
table.data td.name a { font-weight: 700; color: var(--text); text-decoration: none; }
table.data td.name a:hover { text-decoration: underline; }
td .c-good { color: var(--good-text); font-weight: 600; }
td .c-warn { color: var(--warn-text); font-weight: 600; }
td .c-bad { color: var(--bad-text); font-weight: 700; }
td .c-muted { color: var(--text-soft); }
td .c-plain { color: var(--text-muted); }
td .c-strong { font-weight: 700; }
.tablefoot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 18px;
  background: var(--page-bg); border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.tablefoot strong { color: var(--text); }

/* ---- key/value lists (client record) ---- */
dl.kv { display: grid; grid-template-columns: auto 1fr; gap: 9px 16px; margin: 0; font-size: 14px; }
dl.kv dt { color: var(--text-muted); }
dl.kv dd { margin: 0; text-align: right; font-weight: 600; }
dl.kv dd.good { color: var(--good-text); }
dl.kv dd.warn { color: var(--warn-text); }
dl.kv dd.bad { color: var(--bad-text); }
dl.kv dd.muted { color: var(--text-soft); font-weight: 500; }
.measures { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.measure { background: var(--page-bg); border-radius: var(--radius-sm); padding: 12px 14px; }
.measure .ml { font-size: 12px; color: var(--text-muted); }
.measure .mv { font-family: var(--font-display); font-size: 28px; font-weight: 700; margin: 4px 0; }
.measure .ms { font-size: 12px; color: var(--text-muted); }
.squares { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.sq { width: 40px; height: 40px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; background: var(--muted-bg); color: var(--text-soft); }
.sq.att { background: var(--good-bg); color: var(--good-text); }
.sq.dna { background: var(--bad-bg); color: var(--bad-text); }
.lines { list-style: none; margin: 0; padding: 0; font-size: 14px; }
.lines li { display: flex; justify-content: space-between; padding: 5px 0; }
.lines .good { color: var(--good-text); font-weight: 600; }
.lines .warn { color: var(--warn-text); font-weight: 700; }
.lines .bad { color: var(--bad-text); font-weight: 700; }
.foot-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; }

/* ---- forms ---- */
.form { max-width: 860px; }
.field { margin-bottom: 14px; }
.field label, .label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; }
.field .hint { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=time], input[type=number],
input[type=search], select, textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: 15px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-focus); outline-offset: 0; border-color: var(--accent-focus); }
textarea { min-height: 80px; }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.row-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; }
.row-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-bottom: 8px; }
.check input { margin-top: 3px; }
.errors { background: var(--bad-bg); color: var(--bad-text); border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 18px; font-size: 14px; }
.errors ul { margin: 6px 0 0; padding-left: 18px; }
.flash { border-radius: var(--radius-sm); padding: 11px 16px; margin-bottom: 16px; font-size: 14px; font-weight: 600; }
.flash.info { background: var(--good-bg); color: var(--good-text); }
.flash.error { background: var(--bad-bg); color: var(--bad-text); }
.flash.warn { background: var(--warn-bg); color: var(--warn-text); }
/* Pass 29 (M-117): the idle time-out warning, over the page, bottom right. */
.idle-warn { position: fixed; right: 16px; bottom: 16px; z-index: 50; max-width: 380px; background: var(--warn-bg);
  color: var(--warn-text); border-radius: var(--radius-sm); padding: 14px 16px; box-shadow: 0 4px 18px rgba(0,0,0,.18);
  font-size: 14px; font-weight: 600; }
.idle-warn[hidden] { display: none; }
.idle-warn p { margin: 0 0 10px; }
.idle-warn [hidden] { display: none; }
.idle-warn .idle-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.main.idle-hidden .content { visibility: hidden; }   /* pass 30 (L-130): typing kept on the page, out of sight */
.topbar .who[hidden] { display: none; }   /* pass 32 (L-137): signed out or someone else: no name, no Sign out */
@media (max-width: 600px) { .idle-warn { left: 16px; right: 16px; max-width: none; } .idle-warn .btn { width: 100%; } }
@media print { .idle-warn { display: none !important; } }
.formfoot { display: flex; gap: 10px; margin-top: 18px; }
table.matrix td, table.matrix th { text-align: center; }
table.matrix td:first-child, table.matrix th:first-child { text-align: left; }
table.matrix input[type=text] { width: 80px; padding: 6px 8px; }
table.matrix select { width: auto; padding: 6px 8px; }

/* ---- sign-in pages ---- */
.authwrap { min-height: calc(100vh - 64px); display: flex; align-items: flex-start; justify-content: center; padding: 70px 16px; }
.authcard { width: 100%; max-width: 420px; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px 32px; }
.authcard h1 { font-size: 26px; margin-bottom: 6px; }
.authcard .btn { width: 100%; }
.authcard .alt { text-align: center; margin-top: 14px; font-size: 13px; }

.term-picker { display: flex; gap: 8px; align-items: center; }
.term-picker select { width: auto; padding: 9px 10px; font-size: 14px; }
.empty { padding: 28px; text-align: center; color: var(--text-muted); }

@media (max-width: 900px) {
  .shell { flex-direction: column; }
  .sidebar { width: auto; flex: none; display: flex; flex-wrap: wrap; gap: 4px; padding: 10px; }
  .sidebar .nav-label { display: none; }
  .main { padding: 20px 16px; }
  .tiles, .groups, .grid-2, .row, .row-2, .row-4, .measures { grid-template-columns: 1fr; }
  .pagehead { flex-direction: column; }
  .pagehead .actions { flex-wrap: wrap; }
  .topbar { padding: 0 16px; }
  .brand-sub, .who .org { display: none; }
}

/* ---- phone-width menu (pass 07) ----
 * At 600 px and narrower the left nav folds behind a "Menu" button
 * (static/js/nav.js adds .js-nav to <html> and toggles .open). Without
 * JavaScript the nav stacks above the content as before. Layout only:
 * colours come from the existing theme variables. */
.nav-toggle { display: none; }
@media (max-width: 600px) {
  .js-nav .nav-toggle { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start;
    margin: 10px 16px 0; padding: 9px 14px; min-height: 44px; border: 1px solid var(--border);
    border-radius: var(--radius-sm); background: var(--sidebar-bg); color: var(--text); font: inherit;
    font-size: 15px; font-weight: 700; cursor: pointer; }
  .js-nav .nav-toggle:focus-visible { outline: 3px solid var(--accent-focus); outline-offset: 2px; }
  .nav-toggle-icon, .nav-toggle-icon::before, .nav-toggle-icon::after { display: block; width: 18px; height: 2px;
    background: currentColor; border-radius: 1px; }
  .nav-toggle-icon { position: relative; }
  .nav-toggle-icon::before, .nav-toggle-icon::after { content: ""; position: absolute; left: 0; }
  .nav-toggle-icon::before { top: -6px; }
  .nav-toggle-icon::after { top: 6px; }
  .js-nav .sidebar { display: none; }
  .js-nav .sidebar.open { display: flex; flex-direction: column; flex-wrap: nowrap; gap: 0;
    margin: 8px 16px 0; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .js-nav .sidebar.open a { padding: 11px 12px; }
  .js-nav .sidebar.open .nav-label { display: block; margin: 14px 12px 4px; }
}
@media print { .nav-toggle { display: none !important; } }
/* Pass 33 (STATUS 02/12 "Odd, small"): at phone width a facilitator's longer
 * name and "Sign out" each wrapped onto two lines in the header. The logo is
 * a little smaller, the name stays on one line (cut short with "..." only
 * if it still can't fit; the full name is still read out), and "Sign out"
 * never wraps. */
@media (max-width: 600px) {
  .topbar { gap: 10px; }
  .topbar .brand { flex: 0 0 auto; }
  .topbar .logo { height: 32px; padding: 6px 8px; }
  .topbar .logo img { height: 18px; }
  .topbar .who { gap: 10px; min-width: 0; font-size: 12px; }
  .topbar .who .user { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .topbar .who .linkbtn { white-space: nowrap; font-size: 12px; }
}

/* ---- small additions ---- */
.check select { width: auto; padding: 4px 8px; margin-left: 8px; font-size: 13px; }
td.actions { white-space: nowrap; }
td.actions form { display: inline; margin: 0; }
pre { white-space: pre-wrap; font-family: var(--font-body); background: var(--page-bg); padding: 12px; border-radius: var(--radius-sm); margin: 10px 0 0; }
.card .card { margin-bottom: 12px; }
.card .pagehead { margin-bottom: 10px; }
.card .tablewrap { margin-bottom: 0; }
.scroll { overflow-x: auto; }
.pagehead .actions { flex-shrink: 0; flex-wrap: nowrap; }
table.matrix th { white-space: normal; }
table.matrix select { padding: 6px 8px; }
table.matrix input[type=text] { width: 64px; }

/* ---- Track B (build 02): readiness, sessions, billing ---- */
a.tile { display: block; text-decoration: none; }
a.tile:hover { box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.tiles.five { grid-template-columns: repeat(5, 1fr); }
.charging { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; font-size: 13px; }
.charging .cl { color: var(--text-muted); }
.charging .cv { font-weight: 700; font-size: 14px; margin-top: 2px; }
.totals { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.totals strong { font-size: 14px; }
table.data td.money, table.data th.money { text-align: right; white-space: nowrap; }
td.money.total { font-weight: 700; }
tr.dna td { background: var(--flag-row-bg); }
.att-choice { display: flex; gap: 6px; }
.att-choice label { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 6px 12px; font-size: 14px; cursor: pointer; background: var(--card-bg); }
.att-choice input { margin: 0; }
.linkbox { display: block; width: 100%; font-family: monospace; font-size: 13px; background: var(--page-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; word-break: break-all; }
.inline-forms { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-top: 12px; }
.inline-forms form { display: flex; gap: 8px; align-items: flex-end; margin: 0; flex-wrap: wrap; }
.inline-forms .field { margin: 0; }
.inline-forms input[type=date], .inline-forms input[type=datetime-local], .inline-forms select { width: auto; padding: 7px 9px; font-size: 14px; }
input[type=datetime-local], input[type=url] { width: 100%; padding: 10px 12px; font: inherit; font-size: 15px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: #fff; color: var(--text); }
.action-block { border-top: 1px solid var(--border); padding-top: 12px; margin-top: 12px; }
.action-block:first-of-type { border-top: 0; padding-top: 0; margin-top: 0; }
.action-block .ab-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.sessions-strip { display: flex; flex-wrap: wrap; gap: 8px; }
.sessions-strip a, .sessions-strip span { display: inline-flex; flex-direction: column; align-items: center; min-width: 74px;
  padding: 8px 10px; border-radius: var(--radius-sm); background: var(--muted-bg); color: var(--muted-text);
  text-decoration: none; font-size: 12px; font-weight: 600; }
.sessions-strip .sn { font-size: 15px; font-weight: 700; }
.sessions-strip .good { background: var(--good-bg); color: var(--good-text); }
.sessions-strip .warn { background: var(--warn-bg); color: var(--warn-text); }
.sessions-strip .bad { background: var(--bad-bg); color: var(--bad-text); }
.qa { border-bottom: 1px solid var(--border); padding: 9px 0; font-size: 14px; }
.qa:last-child { border-bottom: 0; }
.qa .q { color: var(--text-muted); }
.qa .a { font-weight: 600; white-space: pre-wrap; margin-top: 2px; }
.qa .a.yes { color: var(--bad-text); }
/* public (no-login) pages */
.public-top .note { color: var(--header-muted); font-size: 13px; }
.public-main { max-width: 900px; margin: 0 auto; padding: 32px 16px 60px; }
.public-main h1 { margin-bottom: 6px; }
.public-main .sub { color: var(--text-muted); margin-bottom: 22px; }
.yesno { display: flex; gap: 10px; margin-top: 6px; }
.yesno label { display: inline-flex; gap: 6px; align-items: center; font-weight: 500; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); padding: 6px 14px; background: var(--card-bg); cursor: pointer; }
.qblock { margin-bottom: 16px; }
.qblock .qlabel { font-size: 14px; font-weight: 600; }
.qblock .hint { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.req { color: var(--bad-text); }
.message-card { max-width: 620px; margin: 40px auto; }
.message-card.good h1 { color: var(--good-text); }
.message-card.bad h1 { color: var(--bad-text); }
@media print {
  .topbar, .sidebar, .noprint { display: none !important; }
  body { background: #fff; }
  .main { padding: 0; }
}
@media (max-width: 900px) {
  .charging, .tiles.five { grid-template-columns: 1fr 1fr; }
}
/* ---- build 02 track A: requests, PO register, public request form ---- */
.tiles { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
a.tile.link { text-decoration: none; display: block; }
a.tile.link:hover { box-shadow: inset 0 0 0 2px rgba(0,0,0,.08); }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--border); margin: -4px 0 20px; }
.tabs a { padding: 9px 14px; font-size: 14px; font-weight: 600; color: var(--text-muted); text-decoration: none;
  border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 4px; border-radius: 999px;
  font-size: 11px; line-height: 18px; text-align: center; background: var(--muted-bg); color: var(--muted-text); }
.tabs .count.bad { background: var(--bad-bg); color: var(--bad-text); }
.tabs .count.warn { background: var(--warn-bg); color: var(--warn-text); }
.filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.filters a.chip { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; text-decoration: none;
  color: var(--text-muted); background: var(--card-bg); border: 1px solid var(--border); }
.filters a.chip.active { background: var(--accent-pale); color: var(--accent-ink); border-color: var(--accent); }
.filters form { margin-left: auto; display: flex; gap: 6px; }
.filters input[type=search] { width: 220px; padding: 7px 10px; font-size: 14px; }
.copyfield { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: var(--page-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; word-break: break-all; }
.forms-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.inline-form { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .field { margin-bottom: 0; }
.radio-list label { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); margin-bottom: 6px; font-weight: 500; font-size: 14px; }
.radio-list label input { margin-top: 3px; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
pre.mail { font-family: var(--font-body); font-size: 14px; white-space: pre-wrap; background: var(--page-bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; margin: 0; }
textarea.mail { min-height: 280px; font-size: 14px; }
dl.kv.kv-left dd { text-align: left; }

/* public request form (track A) on the shared public layout */
.public-main > h1 { font-size: 34px; }
.ask { background: var(--muted-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 20px; }
.ask .card-label { margin-bottom: 10px; }
.ask-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 10px; }
.ask-grid .l { font-size: 13px; color: var(--text-muted); }
.ask-grid .v { font-weight: 700; font-size: 14px; }
.ask p { font-size: 13px; color: var(--text-muted); margin: 0; }
.public-main .card { padding: 22px 24px; }
.public-main .field input.missing, .public-main .field select.missing { border-color: var(--bad-text); background: var(--missing-bg); }
.pub-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.pub-foot .need { color: var(--bad-text); font-weight: 600; font-size: 14px; }
.pub-foot .btns { display: flex; gap: 10px; flex-wrap: wrap; }
@media (max-width: 900px) {
  .forms-2, .ask-grid { grid-template-columns: 1fr 1fr; }
  .filters form { margin-left: 0; width: 100%; }
  .filters input[type=search] { width: 100%; }
}
@media (max-width: 600px) { .forms-2, .ask-grid { grid-template-columns: 1fr; } }
.mb { margin-bottom: 14px; }
.mt { margin-top: 14px; }
.mt-xs { margin-top: 6px; }
.grow { flex: 1; }
.nowrap { white-space: nowrap; }

/* ---- build 02 integration: classes replacing inline styles (blocked by the CSP) ---- */
.wide { max-width: none; }
.mt-s { margin-top: 10px; }
.w55 { width: 55%; }
.maxw-420 { max-width: 420px; }
body.print-page { background: #fff; }
/* fix pass 02: a growing field in an inline form takes the space it is given */
.inline-form .field.grow input[type=text] { width: 100%; }

/* ---- pass 10: confirmation step (views/confirm.py) ---- */
.confirm-card { max-width: 640px; }
.confirm-card h1 { font-size: 26px; margin-bottom: 12px; }
.confirm-details { margin: 0 0 14px; padding-left: 20px; font-size: 15px; }
.confirm-details li { margin-bottom: 6px; }
.confirm-warn { color: var(--bad-text); }

/* ---- pass 10: screen-reader-only text ---- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* ---- pass 10: phone card pattern for lists (review 08 B3) ----
 * A table marked class="data stack" becomes one card per row at phone
 * width: no sideways scrolling, every column still there with its label
 * (each cell carries data-label, set in the template, so no JavaScript is
 * needed). The first cell is the card's title.
 *
 * Pass 11 (review 09 M2): a cell is an ordinary block whose label sits in
 * a fixed left column (floated in its padding) and whose content flows in the
 * rest of the width, so a cell with several children (a name and a small
 * line under it, two pills, a date and "4 days waiting") reads top to
 * bottom as it does on a desk, instead of being split into side-by-side
 * columns that broke words mid-way. */
@media (max-width: 600px) {
  table.data.stack, table.data.stack tbody, table.data.stack tr, table.data.stack td { display: block; width: 100%; }
  table.data.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
  table.data.stack tr { padding: 12px 14px; border-bottom: 1px solid var(--border); }
  table.data.stack tr:last-child { border-bottom: 0; }
  /* the label floats in the cell's left padding; flow-root makes the cell
     as tall as a two-line label, so rows never overlap */
  table.data.stack td { border: 0; display: flow-root; padding: 3px 0 3px 140px; min-height: 22px;
    text-align: left; white-space: normal; overflow-wrap: break-word; }
  table.data.stack td::before { content: attr(data-label); float: left; width: 128px; margin: 2px 0 0 -140px;
    text-align: left; font-size: 12px; line-height: 1.35; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .05em; overflow-wrap: break-word; }
  table.data.stack td[data-label=""], table.data.stack td:not([data-label]) { padding-left: 0; min-height: 0; }
  table.data.stack td[data-label=""]::before, table.data.stack td:not([data-label])::before { content: none; }
  table.data.stack td:first-child { padding: 0 0 6px; min-height: 0; font-size: 16px; }
  table.data.stack td:first-child::before { content: none; }
  table.data.stack td > div, table.data.stack td > .small { overflow-wrap: break-word; }
  table.data.stack td.name { white-space: normal; }
  table.data.stack td.num, table.data.stack td.money { text-align: left; }
  table.data.stack td.actions { padding: 8px 0 0; min-height: 0; white-space: normal; }
  table.data.stack td.actions::before { float: none; display: block; width: auto; margin: 0 0 2px; }
  table.data.stack td.actions .btn { margin: 4px 6px 0 0; }
  table.data.stack td.empty { padding-left: 0; text-align: center; }
  table.data.stack td.empty::before { content: none; }
  table.data.stack tr.flag, table.data.stack tr.dna { background: var(--flag-row-bg); }
  .tablefoot { flex-direction: column; align-items: flex-start; }
}

/* ---- pass 10: roll entry, one card per client (review 08 B1) ----
 * Every attendance choice is a full-width button on a phone, so "Did not
 * attend" is always visible and easy to tap. */
.roll-entry { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 18px; padding: 4px 18px 10px; }
.roll-row { border: 0; border-bottom: 1px solid var(--border); margin: 0; padding: 12px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; min-width: 0; }
.roll-row:last-of-type { border-bottom: 0; }
.roll-row legend { float: left; padding: 0; font-weight: 600; font-size: 15px; }
.roll-row .att-choice { flex-wrap: wrap; }
.roll-row .att-choice label { min-height: 44px; padding: 8px 14px; }
.roll-row .att-choice label:has(input:checked) { border-color: var(--accent-focus); background: var(--accent-pale); font-weight: 700; }
.roll-readonly { list-style: none; margin: 0; padding: 0; }
.roll-readonly li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.roll-readonly li:last-child { border-bottom: 0; }
.req-note { margin: 0 0 10px; }
@media (max-width: 600px) {
  .roll-row { display: block; }
  .roll-row legend { float: none; display: block; margin-bottom: 8px; }
  .roll-row .att-choice { display: grid; grid-template-columns: 1fr; gap: 8px; }
  .roll-row .att-choice label { width: 100%; justify-content: flex-start; font-size: 16px; }
  .formfoot { flex-wrap: wrap; }
  .formfoot .btn { width: 100%; text-align: center; }
}

/* ---- pass 10: PO register fits a 1400 px screen (review 08 B2) ---- */
table.po-register td { vertical-align: top; }
table.po-register td.po-ref a { font-weight: 700; white-space: nowrap; }
/* pass 11 (review 09 L11): a PO number never wraps at its hyphen, for any role */
table.po-register td.po-ref .mono { white-space: nowrap; }
table.po-register th { white-space: normal; }

/* ---- pass 10: required fields (review 08 3.2 #7) ----
 * One marker everywhere: a field whose input is required gets a red * after
 * its label, and each form says once what the * means. */
.field:has(:required) > label:not(:has(.req))::after, .field:has([aria-required="true"]) > label:not(:has(.req))::after {
  content: " *"; color: var(--bad-text); font-weight: 700; }
.req-legend { font-size: 13px; color: var(--text-muted); margin: 0 0 12px; }
.req-acc { font-size: 11px; font-weight: 600; color: var(--text-muted); }
@media (max-width: 600px) { .print-link { display: none; } }

/* ---- pass 10: the one neutral line on the test system (review 08 3.2 #1) ---- */
.testline { background: var(--muted-bg); color: var(--muted-text); font-size: 13px; font-weight: 600;
  text-align: center; padding: 6px 16px; border-bottom: 1px solid var(--border); }
/* pass 28 (D-12): production still on a stub */
.testline.prodwarn { background: var(--warn-bg, #fdf1d8); color: var(--warn-text, #6b4a00); }
@media print { .testline { display: none; } }

/* ---- pass 10: no sideways page scroll (review 08 B4) ---- */
.grid-2 > *, .row > *, .row-2 > *, .row-4 > *, .forms-2 > *, .pagehead > * { min-width: 0; }
.report-table td.name { white-space: normal; }
@media (max-width: 1500px) { .report-grid { grid-template-columns: 1fr; } }
@media (max-width: 600px) {
  .inline-form, .inline-forms form { flex-direction: column; align-items: stretch; }
  .inline-form .field, .inline-forms .field { width: 100%; }
  .inline-form .btn, .inline-forms .btn { align-self: flex-start; }
  .pagehead .actions { flex-wrap: wrap; }
  dl.kv dd { overflow-wrap: anywhere; }
  .tabs { margin-left: 0; margin-right: 0; }
  table.data:not(.stack) td.name { white-space: normal; }
}

/* pass 10: a select never wider than the phone screen (the PO page's chaser) */
@media (max-width: 600px) { select, .inline-forms select, .inline-form select { max-width: 100%; } }

/* ---- pass 11 (review 09 L7a): a count badge on a filter chip ---- */
.filters a.chip .count { display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px; border-radius: 999px;
  font-size: 12px; text-align: center; }
.filters a.chip .count.bad { background: var(--bad-bg); color: var(--bad-text); }
.filters a.chip .count.warn { background: var(--warn-bg); color: var(--warn-text); }

/* ---- pass 11 (review 09 L11): a message line never runs its subject into its status ---- */
.lines li.msg-line { gap: 14px; align-items: flex-start; }
.lines li.msg-line .msg-main { display: flex; flex-direction: column; min-width: 0; overflow-wrap: break-word; }
.lines li.msg-line .msg-status { flex: 0 0 auto; text-align: right; white-space: nowrap; }
@media (max-width: 600px) { .lines li.msg-line { flex-direction: column; gap: 2px; }
  .lines li.msg-line .msg-status { text-align: left; } }
/* pass 11: report tables, a header sits over its numbers (review 09 L11) */
.report-table th.num, table.data th.num, table.data th.money { text-align: right; }
/* pass 11 (review 09 N5): long links in an email body wrap */
.mail-body, pre.mail-body, .outbox-body { white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- pass 11 (review 08 3.2 #9): phone menu as a drawer, compact tiles ----
 * At 600 px and narrower the open menu slides over the page from the left
 * (it no longer pushes the page down), with a shaded backdrop; tapping the
 * backdrop, the close button or Escape shuts it (static/js/nav.js). The
 * attention tiles sit two to a row. Theme variables only. */
@media (max-width: 600px) {
  .js-nav .sidebar.open { position: fixed; top: 0; left: 0; bottom: 0; z-index: 60; width: min(300px, 86vw);
    margin: 0; border-radius: 0; border-width: 0 1px 0 0; overflow-y: auto; background: var(--sidebar-bg);
    padding: 10px 8px 24px; }
  .js-nav body.nav-open::after { content: ""; position: fixed; inset: 0; z-index: 55; background: var(--text);
    opacity: .35; }
  .js-nav body.nav-open { overflow: hidden; }
  .js-nav .sidebar.open .nav-close { display: block; align-self: flex-end; margin: 0 4px 6px; min-height: 44px;
    padding: 8px 14px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg);
    color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tile { min-height: 0; padding: 10px 12px; }
  .tile .n { font-size: 22px; margin-bottom: 4px; }
  .tile .t { font-size: 13px; }
  .tile .s { font-size: 11px; }
}
/* the drawer's close button exists only on a phone, inside the open menu */
.nav-close { display: none; }
/* pass 11 (review 08 3.2 #11): things that open something look like it */
a.tile.link { text-decoration: none; transition: box-shadow .12s; }
/* pass 15 (review 12 L-g): a white gap first, so the ring never touches a
   tile's own fill (2.94:1 on the red "bad" tile); it sits on white or the page */
a.tile.link:hover, a.tile.link:focus-visible { box-shadow: 0 0 0 2px var(--card-bg), 0 0 0 4px var(--accent-focus); }
a.tile.link .t::after { content: " ›"; }
table.data td.name a, table.data td a.rowlink { text-decoration: underline; text-underline-offset: 2px; }
/* pass 11 (review 08 3.2 #14): client list filters */
.client-filters select, .client-filters input[type=search] { width: auto; padding: 7px 10px; font-size: 14px; }
.status-key { margin: -6px 0 12px; }
.status-key ul { margin: 6px 0 0; padding-left: 18px; }
@media (max-width: 600px) { .client-filters select, .client-filters input[type=search] { width: 100%; } }
/* pass 11 (review 08 3.2 #18): one programme's templates per fold */
details.tpl-group { margin-bottom: 12px; }
details.tpl-group > summary { cursor: pointer; padding: 12px 16px; background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); }
details.tpl-group[open] > summary { margin-bottom: 8px; }
.next-step { margin-bottom: 14px; }
/* pass 11 (review 08 3.2 #21): the account form shows the one link the role needs */
.form:has(#role option[value="facilitator"]:checked) .role-links .only-org-admin,
.form:has(#role option[value="org_admin"]:checked) .role-links .only-facilitator,
.form:has(#role option[value="coordinator"]:checked) .role-links,
.form:has(#role option[value="management"]:checked) .role-links,
.form:has(#role option[value=""]:checked) .role-links { display: none; }
.form:has(#role option[value="facilitator"]:checked) .role-links,
.form:has(#role option[value="org_admin"]:checked) .role-links { grid-template-columns: 1fr; }
/* pass 11 (review 08 3.2 #23): attendance marks and their key */
.sq { position: relative; }
.sq .sq-mark { position: absolute; right: 3px; bottom: 1px; font-size: 11px; font-weight: 700; }
.attendance-key { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0 0 6px; color: var(--text-muted); }
.sq-key { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 4px;
  background: var(--muted-bg); color: var(--muted-text); font-size: 12px; font-weight: 700; margin-left: 6px; }
.sq-key:first-child { margin-left: 0; }
.sq-key.att { background: var(--good-bg); color: var(--good-text); }
.sq-key.dna { background: var(--bad-bg); color: var(--bad-text); }
/* pass 11 (review 08 3.2 #25): the document title is an h2 (one h1 per page) */
.doc h2.doc-title { font-size: 28px; margin: 0 0 4px; }
input[type=file] { font: inherit; font-size: 14px; max-width: 100%; }
input[type=file]::file-selector-button { font: inherit; font-weight: 700; padding: 7px 12px; margin-right: 10px;
  border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--card-bg); cursor: pointer; }
/* pass 11 (smoke): a card whose first cell is only a tick box shows the
   box at its top right, so the client's name is the card's title */
@media (max-width: 600px) {
  table.data.stack tr:has(> td.select) { position: relative; }
  table.data.stack td.select { position: absolute; top: 10px; right: 14px; width: auto; padding: 0; min-height: 0; }
  table.data.stack td.select::before { content: none; }
  table.data.stack td.select + td { padding: 0 44px 6px 0; min-height: 0; font-size: 16px; }
  table.data.stack td.select + td::before { content: none; }
}
/* pass 13 (S-23): phone polish. 16px inputs (iOS doesn't zoom), 40px tap
   targets for the small buttons and the header's Sign out link. */
@media (max-width: 600px) {
  input[type=text], input[type=email], input[type=password], input[type=date], input[type=time],
  input[type=number], input[type=search], input[type=datetime-local], select, textarea { font-size: 16px !important; }
  .btn-small { min-height: 40px; padding: 8px 12px; }
  .linkbtn { display: inline-flex; align-items: center; min-height: 40px; padding: 0 6px; }
  .backlink { display: inline-flex; align-items: center; min-height: 40px; }
}
/* pass 13 (S-27): the message subject wraps instead of being cut off */
textarea.subject-box { min-height: 0; resize: vertical; }
/* pass 13 (S-25): outcome measures pages */
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0; }
/* pass 13 (S-34): long unbroken names and addresses wrap on a phone */
pre.mail, .mail-body, .copyfield { overflow-wrap: anywhere; word-break: break-word; }
/* pass 13 (Q11): a smaller logo chip on a phone, so the header fits 390px */
@media (max-width: 600px) {
  .logo { height: 32px; padding: 6px 8px; }
  .logo img { height: 18px; }
}
/* pass 13 (Q16): the folded "By lead facilitator" table and the card's facilitator line */
details.by-fac > summary { cursor: pointer; list-style: none; display: flex; align-items: baseline; gap: 8px; }
details.by-fac > summary::-webkit-details-marker { display: none; }
details.by-fac > summary .card-label { margin: 0; }
details.by-fac[open] > summary .small { visibility: hidden; }
details.by-fac .tablewrap { margin-top: 12px; }
.gcard .gfac { margin-top: 4px; }
/* pass 14 (review 11 L12): an element with the hidden attribute stays hidden,
   whatever display its classes give it (the done page's Copy button is shown
   by copy.js only where the clipboard works) */
[hidden] { display: none !important; }
/* pass 14 (review 11 L4, L20): on a phone the public header's note sits apart
   from the logo chip (and wraps under itself if it must); phone and web
   address inputs get the 16px text too */
@media (max-width: 600px) {
  .public .topbar { gap: 12px; }
  .public .topbar .brand { flex: 0 0 auto; }
  /* pass 15 (review 12 L-f): specific enough to win over track-c.css's 13px */
  .public .topbar .public-note { min-width: 0; text-align: right; line-height: 1.3; font-size: 12px; }
  input[type=tel], input[type=url] { font-size: 16px !important; }
}

/* Pass 19 (review 16 L-17c): a cell of several pills wraps them, so a long
   pill ("1 held until the PO is in CMS") is never clipped at the table edge. */
td.pills-wrap { white-space: normal; }
td.pills-wrap .pill { white-space: normal; margin: 1px 0; }

/* Pass 21 (review 18 L-31): the fee page's share make-up keeps its dollar
   figures on screen at phone width: the row labels wrap (they were one long
   upper-case line each) and the amounts never do. */
table.data.make-up th[scope="row"] { white-space: normal; overflow-wrap: break-word; text-transform: none;
  letter-spacing: 0; font-size: 13px; background: none; }
table.data.make-up td.money { width: 1%; }
@media (max-width: 600px) {
  table.data.make-up th[scope="row"], table.data.make-up td { padding: 10px 8px; }
}
