/* apply.meetbunch.com
   Base: the BUNCH CEO dashboard (dark background, cards, borders, muted accents).
   Brand: www.meetbunch.com and the BUNCH Logo Guidelines (Aug 2024): white wordmark
   (never pink on black), uppercase page titles, pill buttons, Pink Paradise #f15958
   for actions, links, focus and progress. Dark only. Every colour is a token below.
   Text on pink is near-black: 6.1:1. White on pink is 3.3:1 and fails AA below 18.66px bold. */

:root {
  color-scheme: dark;

  /* CEO dashboard */
  --bg: #050505;
  --card: #111111;
  --card-hover: #161616;
  --border: rgba(255, 255, 255, .06);
  --border2: rgba(255, 255, 255, .12);
  --border3: rgba(255, 255, 255, .18);
  --t1: #e8e4df;
  --t2: #8a8580;
  --t3: #4a4540;
  --white: #ffffff;
  --green: #5d8a6b;
  --red: #c06060;
  --amber: #b8976a;
  --blue: #6882a6;

  /* Lighter versions of the accents, for text on a dark tint */
  --green-text: #8dba9a;
  --red-text: #e39292;
  --amber-text: #d8bb92;
  --blue-text: #9fb4d2;

  /* BUNCH brand. Pink Paradise is the main brand colour. */
  --brand: #f15958;                     /* rgb 241 89 88 */
  --brand-hover: #f47574;               /* 12 per cent towards white */
  --brand-tint: rgba(241, 89, 88, .14); /* selected chips, active tab wash */
  --brand-line: rgba(241, 89, 88, .5);  /* borders on brand-tinted boxes */
  --brand-wash: rgba(241, 89, 88, .07); /* large tinted areas */
  --on-brand: #050505;                  /* text on pink: 6.1:1 */
  --gold: #ffc98a;
  --orange: #ea7056;
  --turquoise: #005454;
  --brand-red: #f05657;
  --warm-gray: #eae8e4;

  /* Surfaces for reading and typing */
  --input: #1a1a1a;
  --input-hover: #1e1e1e;
  --input-border: rgba(255, 255, 255, .20);
  --placeholder: #77716b;
  --table-head: #151515;
  --overlay: rgba(0, 0, 0, .72);
  --header-bg: rgba(5, 5, 5, .9);
  --focus-ring: 0 0 0 3px rgba(241, 89, 88, .6);

  --radius: 16px;
  --radius-sm: 10px;
  --topbar-min: 64px;  /* fixed; --header-h below is measured from the real header by the page script */
  --header-h: 64px;
  --gutter: 16px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--t1);
  font: 400 16px/1.65 var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-underline-offset: 3px; }
a:hover { color: var(--white); }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 6px; }

p { margin: 0 0 14px; }
strong { font-weight: 600; color: var(--white); }
[hidden] { display: none !important; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border2); border-radius: 4px; }

/* ------------------------------------------------------------ header */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--header-bg);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}
.topbar .in {
  max-width: 1600px;
  margin: 0 auto;
  padding: 10px 24px;
  min-height: var(--topbar-min);
  display: flex;
  align-items: center;
  gap: 8px 18px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; min-width: 0; }
.logo { display: block; height: 22px; width: auto; flex: none; }
.brand-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.spacer { flex: 1 1 auto; }
.who { color: var(--t2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 16rem; }
.status { font-size: 13px; color: var(--t2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.status.saving { color: var(--amber-text); }
.status.saved { color: var(--green-text); }
.status.error { color: var(--red-text); }
.status.over { color: var(--amber-text); }
.topbar a.plain { color: var(--t2); font-size: 14px; text-decoration: none; }
.topbar a.plain:hover { color: var(--white); }

/* ------------------------------------------------------------ type */

h1, h2, h3 { margin: 0; color: var(--white); }
/* Heading scale. Uppercase is kept for page titles only.
   display     public page titles       24 to 46px, uppercase
   page-title  staff and message pages  17 to 21px, uppercase
   step-title  one per assessment step  19 to 21px, sentence case
   card titles 18px, question prompts 17px, body 16px, section labels 13px */
.display {
  font-size: clamp(24px, 4.2vw, 46px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  text-transform: uppercase;
  margin: 0 0 16px;
}
.page-title {
  font-size: clamp(17px, 2.1vw, 21px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.005em;
  text-transform: uppercase;
  margin: 0 0 12px;
}
.step-title {
  font-size: clamp(19px, 2vw, 21px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 18px;
}
.step-title:focus { outline: none; box-shadow: none; }
.section-title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t2);
  margin: 36px 0 14px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border2), transparent);
}
.eyebrow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--t2);
  margin: 0 0 12px;
}
.lead { font-size: 19px; line-height: 1.55; color: var(--t1); max-width: 44rem; margin: 0 0 12px; }
.muted { color: var(--t2); }
.small { font-size: 14px; }
.num, .tabular { font-variant-numeric: tabular-nums; }

.prose { max-width: 46rem; }
.prose p { margin: 0 0 14px; }
.prose ol, .prose ul { margin: 0 0 16px; padding-left: 1.5em; }
.prose li { margin: 0 0 10px; padding-left: 4px; }
.prose li::marker { color: var(--t2); font-variant-numeric: tabular-nums; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: 999px;
  border: 1px solid var(--border3);
  background: transparent;
  color: var(--t1);
  font: 600 15px/1.2 var(--font);
  text-decoration: none;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
  max-width: 100%;
}
.btn:hover { border-color: rgba(255, 255, 255, .34); background: rgba(255, 255, 255, .04); color: var(--white); }
.btn:focus-visible { box-shadow: var(--focus-ring); border-radius: 999px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.btn.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); color: var(--on-brand); }
.btn.light { background: var(--white); border-color: var(--white); color: var(--bg); }
.btn.light:hover { background: var(--warm-gray); border-color: var(--warm-gray); color: var(--bg); }
.btn.danger { border-color: rgba(192, 96, 96, .5); color: var(--red-text); }
.btn.danger:hover { background: rgba(192, 96, 96, .12); border-color: var(--red); }
.btn.sm { min-height: 34px; padding: 6px 14px; font-size: 14px; }
.btn.lg { min-height: 52px; padding: 14px 30px; font-size: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn .t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.linkbtn {
  background: none; border: 0; padding: 0; font: inherit; color: var(--brand);
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.linkbtn:hover { color: var(--white); }

/* ------------------------------------------------------------ fields */

label.field { display: block; font-weight: 600; margin: 0 0 8px; }

input[type="text"], input[type="email"], input[type="number"], input[type="search"],
textarea, select {
  width: 100%;
  font: 400 16px/1.5 var(--font);
  color: var(--t1);
  background: var(--input);
  border: 1px solid var(--input-border);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
textarea { resize: vertical; min-height: 5.5rem; line-height: 1.6; display: block; }
input:hover, textarea:hover, select:hover { border-color: rgba(255, 255, 255, .30); background: var(--input-hover); }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus-ring);
  background: var(--input-hover);
}
::placeholder { color: var(--placeholder); opacity: 1; }
select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%238a8580' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  cursor: pointer;
}
select option, select optgroup { background: var(--card); color: var(--t1); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--brand); width: 18px; height: 18px; margin: 0; flex: none; }

fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset:disabled input, fieldset:disabled textarea, fieldset:disabled select {
  background: transparent;
  border-color: var(--border2);
  color: var(--t1);
  -webkit-text-fill-color: var(--t1);
  opacity: 1;
  cursor: default;
  resize: none;
}
fieldset:disabled .rowdel, fieldset:disabled .addrow { display: none; }
fieldset:disabled .choice label { cursor: default; }

/* ------------------------------------------------------------ cards */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .03);
  transition: border-color .3s ease, background .3s ease, box-shadow .3s ease;
}
.card.hover:hover {
  border-color: var(--border2);
  background: var(--card-hover);
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .05), 0 8px 32px rgba(0, 0, 0, .3);
}
.note {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--brand);
  border-radius: var(--radius);
  padding: 18px 22px;
  margin: 0 0 20px;
}
.note > strong:first-child { display: block; margin-bottom: 6px; }
.note p:last-child { margin-bottom: 0; }

.banner { border-radius: var(--radius); padding: 16px 20px; margin: 0 0 24px; border: 1px solid var(--border2); background: var(--card); }
.banner p:last-child { margin-bottom: 0; }
.banner.done { border-color: rgba(93, 138, 107, .55); background: rgba(93, 138, 107, .09); }
.banner.bad { border-color: rgba(192, 96, 96, .6); background: rgba(192, 96, 96, .1); }
.banner.info { border-color: var(--brand-line); background: var(--brand-wash); }
.banner.warn { border-color: rgba(184, 151, 106, .55); background: rgba(184, 151, 106, .08); }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .3px;
  white-space: nowrap;
  line-height: 1.5;
}
.badge.green { background: rgba(93, 138, 107, .16); color: var(--green-text); }
.badge.amber { background: rgba(184, 151, 106, .16); color: var(--amber-text); }
.badge.red { background: rgba(192, 96, 96, .16); color: var(--red-text); }
.badge.blue { background: rgba(104, 130, 166, .18); color: var(--blue-text); }
.badge.muted { background: rgba(255, 255, 255, .05); color: var(--t2); }

/* ------------------------------------------------------------ public pages */

.page { max-width: 1180px; margin: 0 auto; padding: 64px 24px 96px; }
.page.narrow { max-width: 1060px; }
.hero { margin-bottom: 40px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 16px; }
.poscard { display: flex; flex-direction: column; gap: 12px; position: relative; overflow: hidden; }
.poscard::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: var(--brand); }
.poscard h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.3; }
.poscard .foot { margin-top: auto; padding-top: 8px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.backlink { display: inline-block; margin-bottom: 28px; color: var(--t2); text-decoration: none; font-size: 15px; }
.backlink:hover { color: var(--white); }

.pos-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 32px; align-items: start; margin-top: 12px; }
.stagelist { list-style: none; margin: 0 0 16px; padding: 0; }
.stagelist li {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--border);
}
.stagelist li:last-child { border-bottom: 0; }
.stagelist .mins { color: var(--t2); white-space: nowrap; font-variant-numeric: tabular-nums; }
.startcard { position: sticky; top: calc(var(--header-h) + 24px); }
.startcard form { display: grid; gap: 14px; margin-top: 8px; }
.formmsg { margin: 14px 0 0; min-height: 1.6em; }
.formmsg.bad { color: var(--red-text); }

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

.shell { display: grid; grid-template-columns: 272px minmax(0, 1fr); max-width: 1680px; margin: 0 auto; }
.shell.no-rail { grid-template-columns: minmax(0, 1fr); }  /* start and error screens have no step list */
.rail {
  position: sticky;
  top: var(--header-h);
  align-self: start;
  max-height: calc(100vh - var(--header-h));
  overflow-y: auto;
  padding: 28px 16px 48px 24px;
  border-right: 1px solid var(--border);
}
.rail-title { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--t2); margin: 0 12px 10px; }
.rail .group { margin: 0 0 14px; }
.rail .group-label {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--t2); padding: 8px 12px 4px;
}
.stepbtn {
  display: flex; gap: 12px; align-items: flex-start;
  width: 100%; text-align: left;
  background: none; border: 1px solid transparent; border-radius: 12px;
  padding: 10px 12px; margin: 2px 0;
  color: var(--t1); font: inherit; cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.stepbtn:hover { background: var(--card); }
.stepbtn[aria-current="step"] { background: var(--brand-wash); border-color: var(--brand-line); box-shadow: inset 3px 0 0 var(--brand); }
.stepbtn[aria-current="step"] .lbl { color: var(--white); }
.stepbtn .lbl { display: block; font-weight: 600; font-size: 15px; line-height: 1.35; }
.stepbtn .sub { display: block; font-size: 13px; color: var(--t2); line-height: 1.4; margin-top: 2px; }

.dot {
  flex: none; width: 12px; height: 12px; margin-top: 5px;
  border-radius: 50%; border: 2px solid var(--t2); background: transparent;
}
.dot.partial { border-color: var(--brand); background: linear-gradient(90deg, var(--brand) 50%, transparent 50%); }
.dot.done { border-color: var(--brand); background: var(--brand); }
.dot.info { border-radius: 3px; border-color: var(--border3); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 18px 12px 0; font-size: 13px; color: var(--t2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .dot { margin: 0; width: 10px; height: 10px; }

.stepmain { min-width: 0; padding: 36px 48px 120px; }
.stepmain .inner { max-width: 820px; margin: 0 auto; }
.mobile-steps { display: none; gap: 10px; align-items: center; margin: 0 0 24px; }
.mobile-steps select { flex: 1 1 auto; min-width: 0; font-weight: 600; }
.step-count { font-size: 13px; color: var(--t2); white-space: nowrap; font-variant-numeric: tabular-nums; }

.stepnav {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
  margin-top: 44px; padding-top: 24px; border-top: 1px solid var(--border);
}
.stepnav .btn { min-width: 0; }
.stepnav .next { margin-left: auto; }

/* ------------------------------------------------------------ questions */

.qcard {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  margin: 0 0 18px;
  box-shadow: inset 0 1px 1px rgba(255, 255, 255, .03);
  transition: border-color .2s ease;
}
.qcard:focus-within { border-color: var(--border3); }
.qprompt { display: block; font-size: 17px; font-weight: 600; line-height: 1.5; color: var(--white); margin: 0 0 10px; }
.help { color: var(--t2); margin: -2px 0 12px; }
.qsub { margin-top: 14px; }

.choice { display: flex; flex-wrap: wrap; gap: 10px; margin: 4px 0 12px; }
.choice label {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 18px; border: 1px solid var(--input-border); border-radius: 999px;
  background: var(--input); cursor: pointer; font-weight: 500; line-height: 1.35;
}
.choice label:hover { border-color: rgba(255, 255, 255, .34); }
.choice label:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); color: var(--white); }
.choice label:focus-within { box-shadow: var(--focus-ring); }

.gridwrap { overflow-x: auto; margin: 6px 0 12px; }
table.grid { width: 100%; border-collapse: separate; border-spacing: 0; }
table.grid th {
  font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: var(--t2); text-align: left; padding: 8px; white-space: nowrap;
  border-bottom: 1px solid var(--border2);
}
table.grid td { padding: 8px; vertical-align: top; border-bottom: 1px solid var(--border); }
table.grid tr:last-child td { border-bottom: 0; }
table.grid td.num input { text-align: right; font-variant-numeric: tabular-nums; }
table.grid td.itemlabel { padding-top: 16px; font-variant-numeric: tabular-nums; }
table.grid td.rowact { width: 1%; white-space: nowrap; padding-top: 12px; }
table.grid textarea { min-height: 3.2rem; }
.grid.journal col.c-acct { width: 24%; }
.grid.journal col.c-amt { width: 17%; }
.grid.journal col.c-co { width: 16%; }
.grid.bridge col.c-amt { width: 26%; }
.grid.findings col.c-emp { width: 20%; }
.grid.findings col.c-fig { width: 20%; }
.grid.classify col.c-item { width: 36%; }
.grid.classify col.c-choice { width: 24%; }
.rowdel { background: none; border: 0; color: var(--t2); font: inherit; font-size: 14px; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.rowdel:hover { color: var(--red-text); background: rgba(192, 96, 96, .1); }

.tally {
  display: flex; flex-wrap: wrap; gap: 4px 18px; align-items: baseline;
  padding: 12px 16px; border-radius: 12px; margin: 8px 0 14px;
  border: 1px solid var(--border2); font-variant-numeric: tabular-nums;
}
.tally.ok { border-color: rgba(93, 138, 107, .55); background: rgba(93, 138, 107, .1); }
.tally.off { border-color: rgba(184, 151, 106, .5); background: rgba(184, 151, 106, .08); }
.tally .verdict { font-weight: 700; }
.tally.ok .verdict { color: var(--green-text); }
.tally.off .verdict { color: var(--amber-text); }

.filelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 12px; margin: 0 0 20px; }
.fileitem { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.fileitem .name { font-weight: 600; line-height: 1.4; }
.fileitem .fn { font-size: 13px; color: var(--t2); word-break: break-all; }
.fileitem .acts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: auto; }

.checklist { list-style: none; margin: 0 0 20px; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .dot { margin-top: 6px; }
.checklist .what { flex: 1; }
.checklist .count { color: var(--t2); white-space: nowrap; font-variant-numeric: tabular-nums; }

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

.datapanel { display: none; }
body.data-open .datapanel {
  display: flex;
  flex-direction: column;
  position: sticky;
  top: var(--header-h);
  align-self: start;
  height: calc(100vh - var(--header-h));
  min-width: 0;
  background: var(--card);
  border-left: 1px solid var(--border2);
}
.dp-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.dp-title { font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--t2); flex: 1; }
.dp-body { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.viewer { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dp-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.dp-bar select { flex: 1 1 100%; }
.dp-bar input { flex: 1 1 180px; min-width: 0; }
.dp-count { font-size: 13px; color: var(--t2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dp-scroll { flex: 1; min-height: 0; overflow: auto; }
table.data { border-collapse: separate; border-spacing: 0; font-size: 15px; line-height: 1.45; font-variant-numeric: tabular-nums; width: max-content; min-width: 100%; }
table.data th {
  position: sticky; top: 0; z-index: 1;
  background: var(--table-head);
  border-bottom: 1px solid var(--border2);
  padding: 0; text-align: left; white-space: nowrap;
}
table.data th button {
  display: block; width: 100%; text-align: inherit;
  background: none; border: 0; color: var(--t2);
  font: 600 13px/1.3 var(--font); padding: 10px 12px; cursor: pointer;
}
table.data th button:hover { color: var(--white); }
table.data th[aria-sort] button { color: var(--brand); }
table.data th.n { text-align: right; }
table.data td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; color: var(--t1); }
table.data tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
table.data tbody tr:hover td { background: rgba(255, 255, 255, .045); }
table.data td.n { text-align: right; }

dialog {
  background: var(--card);
  color: var(--t1);
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  padding: 28px;
  width: min(540px, calc(100vw - 32px));
  box-shadow: 0 24px 64px rgba(0, 0, 0, .6);
}
dialog::backdrop { background: var(--overlay); }
dialog h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
dialog .actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 22px; }

/* ------------------------------------------------------------ staff area */

.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  min-height: 36px; padding: 6px 16px; border-radius: 999px;
  background: transparent; border: 1px solid var(--border2); color: var(--t2);
  font: 600 14px/1.2 var(--font); cursor: pointer;
}
.tab:hover { color: var(--white); border-color: var(--border3); }
.tab[aria-selected="true"] { background: var(--brand); color: var(--on-brand); border-color: var(--brand); }
.adminpage { max-width: 1400px; margin: 0 auto; padding: 36px 24px 96px; }
.tablewrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th {
  padding: 12px 14px; text-align: left; white-space: nowrap;
  font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
  color: var(--t2); border-bottom: 1px solid var(--border2); background: rgba(255, 255, 255, .02);
}
table.list td { padding: 12px 14px; border-bottom: 1px solid rgba(255, 255, 255, .04); vertical-align: top; font-size: 15px; }
table.list tr:nth-child(even) td { background: rgba(255, 255, 255, .015); }
table.list tbody tr:hover td { background: rgba(255, 255, 255, .04); }
table.list td.n, table.list th.n { text-align: right; font-variant-numeric: tabular-nums; }
table.list .sub { color: var(--t2); font-size: 14px; }
table.list .acts { display: flex; gap: 8px; flex-wrap: wrap; }
table.list tr.linksrow td { background: var(--card-hover); padding: 16px 18px 6px; }
.panelcard { padding: 0; overflow: hidden; }
.panelcard .ph { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 16px 22px; border-bottom: 1px solid var(--border); }
.panelcard .ph h2 { font-size: 15px; font-weight: 700; letter-spacing: -.1px; text-transform: none; }
.panelcard .pb { padding: 22px; }
.formgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(260px, 100%), 1fr)); gap: 16px 20px; }
.formgrid .wide { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 10px; }
.checks label {
  display: inline-flex; align-items: center; gap: 10px; padding: 9px 16px;
  border: 1px solid var(--input-border); border-radius: 999px; background: var(--input); cursor: pointer;
}
.checks label:has(input:checked) { border-color: var(--brand); background: var(--brand-tint); }
.linkrow { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 6px 0 14px; }
.linkrow code {
  flex: 1 1 280px; min-width: 0; overflow-wrap: anywhere;
  background: var(--input); border: 1px solid var(--border2); border-radius: var(--radius-sm);
  padding: 9px 12px; font: 400 14px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--t1);
}
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.kv dt { color: var(--t2); }
.kv dd { margin: 0; font-variant-numeric: tabular-nums; }
.answer { white-space: pre-wrap; margin: 0; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ------------------------------------------------------------ responsive */

@media (min-width: 1280px) {
  body.data-open .shell { grid-template-columns: 256px minmax(0, 1fr) minmax(0, 1.05fr); }
  body.data-open .stepmain { padding: 32px 32px 120px; }
}

@media (min-width: 900px) and (max-width: 1279px) {
  body.data-open .shell { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  body.data-open .rail { display: none; }
  body.data-open .mobile-steps { display: flex; }
  body.data-open .stepmain { padding: 28px 28px 120px; }
}

@media (max-width: 899px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { display: none; }
  .mobile-steps { display: flex; }
  .stepmain { padding: 20px var(--gutter) 110px; }
  body.data-open .datapanel {
    position: fixed;
    inset: var(--header-h) 0 0 0;
    align-self: stretch;  /* the desktop rule's align-self: start would size it to its content */
    height: auto;
    z-index: 35;
    border-left: 0;
  }
  .pos-grid { grid-template-columns: minmax(0, 1fr); }
  .startcard { position: static; }
}

@media (max-width: 640px) {
  .topbar .in { padding: 8px var(--gutter); gap: 6px 12px; }
  .logo { height: 18px; }
  .who { display: none; }
  .page, .adminpage { padding: 36px var(--gutter) 80px; }
  .card { padding: 20px; }
  .qcard { padding: 18px 16px; }
  .note { padding: 16px 18px; }

  .stepnav .btn { flex: 1 1 100%; }
  .kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .kv dd { margin-bottom: 10px; }
  .stepnav .next { margin-left: 0; order: -1; }
}

/* Answer tables become one card per row when their question card is narrow:
   on a phone, and beside the data panel. Nobody types in a sideways scroll. */
.qcard { container-type: inline-size; }
@container (max-width: 600px) {
  table.grid.stack, table.grid.stack tbody, table.grid.stack tr, table.grid.stack td { display: block; width: 100%; }
  table.grid.stack thead, table.grid.stack colgroup { display: none; }
  table.grid.stack tr { border: 1px solid var(--border2); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
  table.grid.stack tr:last-child td { border-bottom: 0; }
  table.grid.stack td { border: 0; padding: 6px 0; }
  table.grid.stack td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase;
    color: var(--t2); margin-bottom: 6px;
  }
  table.grid.stack td.itemlabel { padding-top: 4px; font-weight: 600; }
  table.grid.stack td.rowact { width: auto; padding-top: 4px; text-align: right; }
}

/* ------------------------------------------------------------ help marks (staff area) */

/* position: relative keeps the hidden screen-reader text inside any scrolling
   table; without it, marks in a wide table widen the whole page on a phone. */
.helpwrap { position: relative; display: inline-flex; vertical-align: middle; margin-left: 6px; }
.helpq {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; padding: 0; flex: none;
  border-radius: 50%; border: 1px solid var(--border3); background: transparent;
  color: var(--t2); font: 700 11px/1 var(--font); letter-spacing: 0; text-transform: none;
  cursor: help;
}
.helpq::after { content: ''; position: absolute; inset: -9px; } /* a 36px target for touch */
.helpq:hover, .helpq[aria-expanded="true"] { border-color: var(--brand); color: var(--brand); }
.helpq:focus-visible { box-shadow: var(--focus-ring); border-radius: 50%; }
.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;
}
.tip {
  position: fixed; z-index: 90; pointer-events: none;
  max-width: 320px; padding: 10px 12px;
  background: #1c1c1c; color: var(--t1);
  border: 1px solid var(--border3); border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .55);
  font: 400 14px/1.5 var(--font); letter-spacing: 0; text-transform: none; white-space: normal;
}

.adminpage.lead-in { padding-bottom: 0; }
.adminpage.after { padding-top: 20px; }
details.howto { padding: 0; }
details.howto > summary {
  list-style: none; cursor: pointer; padding: 16px 22px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  font-weight: 700; font-size: 15px; color: var(--white);
}
details.howto > summary::-webkit-details-marker { display: none; }
details.howto > summary::after { content: 'Show'; font-weight: 600; font-size: 14px; color: var(--brand); }
details.howto[open] > summary::after { content: 'Hide'; }
details.howto > summary:focus-visible { box-shadow: var(--focus-ring); border-radius: var(--radius); }
details.howto .howto-body { padding: 0 22px 20px; border-top: 1px solid var(--border); }
details.howto ol { margin: 16px 0 0; padding-left: 1.4em; }
details.howto li { margin: 0 0 10px; }
details.howto li strong { display: block; }

.statsline { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 12px 0 0; font-size: 14px; color: var(--t2); font-variant-numeric: tabular-nums; }
.signal { color: var(--amber-text); font-weight: 600; }
.tracknote { font-size: 15px; color: var(--t2); border: 1px dashed var(--border3); border-radius: 12px; padding: 10px 14px; margin: 0 0 18px; }


/* ------------------------------------------------------------ scoring (staff area) */

.stage-result { border: 1px solid var(--border2); border-radius: 12px; padding: 14px 16px; margin: 0 0 12px; }
.stage-result .banner { margin: 10px 0 0; }
.stage-score { font-size: 18px; font-variant-numeric: tabular-nums; }
.quote { border-left: 3px solid var(--border3); padding: 2px 0 2px 10px; margin: 6px 0; color: var(--t1); font-size: 15px; white-space: pre-wrap; }
.banner .quote { border-left-color: var(--red); }
form.decision { display: grid; gap: 10px; max-width: 640px; padding: 4px 0; }
form.decision input[type="number"], form.decision select { max-width: 200px; }
tr.formrow td, li.formrow { background: var(--card-hover); }
li.formrow { display: block !important; padding: 12px 14px !important; border-radius: 10px; }
.checklist.gates li { align-items: flex-start; }
.checklist.gates .what { flex: 1; min-width: 0; }

/* Spacing helpers, used instead of inline style attributes (the Content-Security-Policy refuses those). */
.m0 { margin: 0; }
.mt0 { margin-top: 0; }
