/* Build one from scratch: the guided journey. Tokens come from assets/css/1265.css. */

.page-build main { min-height: 70vh; }
.build [hidden] { display: none !important; }

/* ---------- Intro ---------- */
.b-intro { padding-block: var(--space-8) var(--space-7); }
.b-intro-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: var(--space-8); align-items: center; }
.b-intro h1 { font-size: var(--step-5); line-height: 1.02; letter-spacing: -0.03em; margin: var(--space-3) 0 var(--space-5); max-width: 15ch; }
.b-intro h1 em { font-style: normal; box-shadow: inset 0 -0.22em 0 var(--mark); }
.b-intro .lede { max-width: 58ch; }
.b-intro-actions { display: flex; flex-wrap: wrap; gap: var(--space-3); margin: var(--space-6) 0 var(--space-4); }
.b-open { cursor: pointer; }
.b-open:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.b-intro-note { max-width: 62ch; font-size: var(--step--1); margin: var(--space-2) 0 0; }
.b-intro-art { margin: 0; display: grid; gap: var(--space-5); }
.b-intro-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-2); padding: var(--space-5); transform: rotate(-1.2deg); }
.b-ia-q { font: 650 var(--step-1)/1.25 var(--font-display); margin: 0 0 var(--space-4); }
.b-ia-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.b-ia-opts span { padding: 7px 12px; border-radius: 999px; border: 1.5px solid var(--line-strong); font-size: var(--step--1); font-weight: 600; }
.b-ia-opts .is-on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.b-ia-effect { margin: var(--space-4) 0 0; padding: 10px 12px; border-radius: 10px; background: var(--mark-soft); font-size: var(--step--1); }
.b-gets { margin-top: var(--space-8); padding-top: var(--space-6); border-top: 1px solid var(--line); }
.b-gets h2 { font-size: var(--step-3); margin: 0 0 var(--space-5); }
.b-gets-list { list-style: none; margin: 0 0 var(--space-5); padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: var(--space-4); }
.b-gets-list li { display: grid; gap: var(--space-2); align-content: start; padding: var(--space-5); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); }
.b-gets-list .file-badge { width: max-content; height: 34px; min-width: 52px; font-size: 10.5px; }
.b-gets-list b { font: 650 var(--step-1)/1.2 var(--font-display); }
.b-gets-list li > span:last-child { color: var(--ink-2); font-size: var(--step--1); line-height: 1.5; }
@media (max-width: 900px) {
  .b-intro { padding-block: var(--space-6); }
  .b-intro-grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-6); }
  .b-intro-art { max-width: 460px; }
}

/* ---------- Journey layout ---------- */
.b-journey { padding-block: var(--space-6) var(--space-8); }
.b-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr) 330px; gap: var(--space-6); align-items: start; }
@media (max-width: 1180px) { .b-layout { grid-template-columns: minmax(0, 1fr) 320px; } .b-rail { grid-column: 1 / -1; } }
@media (max-width: 900px) { .b-layout { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); } }

/* Rail */
.b-rail { position: sticky; top: 92px; }
.b-progress { height: 6px; border-radius: 6px; background: var(--cell-empty); overflow: hidden; }
.b-progress i { display: block; height: 100%; width: 0; background: var(--mark); border-radius: 6px; transition: width var(--dur-3) var(--ease-out); }
.b-progress-text { font: 600 var(--step--2)/1 var(--font-mono); letter-spacing: 0.04em; text-transform: uppercase; margin: var(--space-3) 0 var(--space-4); }
.b-sections { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.b-sec-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 10px; background: none; color: var(--muted); font: 550 var(--step--1)/1.2 var(--font-body); text-align: left; cursor: pointer; }
.b-sec-btn:hover { background: var(--bg-tint); color: var(--ink); }
.b-sec-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.b-sec-dot { width: 10px; height: 10px; border-radius: 3px; border: 1.5px solid var(--line-strong); flex: none; }
.b-sections .is-done .b-sec-btn { color: var(--ink-2); }
.b-sections .is-done .b-sec-dot { background: var(--ink); border-color: var(--ink); }
.b-sections .is-current .b-sec-btn { color: var(--ink); font-weight: 700; background: var(--surface); box-shadow: var(--shadow-1); }
.b-sections .is-current .b-sec-dot { background: var(--mark); border-color: var(--ink); }
@media (max-width: 1180px) {
  .b-rail { position: static; }
  .b-sections { display: flex; flex-wrap: wrap; gap: 4px; }
  .b-sec-btn { width: auto; padding: 6px 10px; }
}
@media (max-width: 900px) { .b-sections { display: none; } .b-progress-text { margin-bottom: 0; } }

/* Question card */
.b-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-2); padding: clamp(20px, 3.2vw, 40px); display: grid; gap: var(--space-5); min-width: 0; }
.b-card > .eyebrow { margin: 0; }
.b-q { font-size: var(--step-4); line-height: 1.08; letter-spacing: -0.025em; margin: 0; max-width: 22ch; }
.b-q:focus { outline: none; }
.b-q:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; border-radius: 4px; }
.b-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4) var(--space-5); align-items: end; }
.b-field { display: grid; gap: 6px; min-width: 0; }
.b-field-group, .b-list { grid-column: 1 / -1; }
.b-field > label, .b-choice legend, .b-list-title { font-weight: 650; font-size: var(--step--1); color: var(--ink); }
.b-hint { margin: -2px 0 2px; font-size: var(--step--2); color: var(--muted); line-height: 1.45; }
.b-card input[type="number"], .b-card input[type="time"], .b-card input[type="date"], .b-card input[type="text"], .b-card select {
  font: 600 var(--step-0)/1.2 var(--font-body); color: var(--ink); background: var(--surface-2);
  border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; min-height: 46px; width: 100%; min-width: 0;
  font-variant-numeric: tabular-nums;
}
.b-card input:focus-visible, .b-card select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; border-color: transparent; }
.b-choice { border: 0; margin: 0; padding: 0; min-width: 0; }
.b-choice legend { padding: 0; margin-bottom: 8px; }
.b-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.b-opt { position: relative; }
.b-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.b-opt span { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 16px; border-radius: 999px; border: 1.5px solid var(--line-strong); background: var(--surface); font-weight: 600; font-size: var(--step--1); transition: background var(--dur-2), color var(--dur-2), border-color var(--dur-2); }
.b-opt input[type="checkbox"] + span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid currentColor; flex: none; }
.b-opt input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.b-opt input[type="checkbox"]:checked + span::before { background: var(--mark); border-color: var(--mark); }
.b-opt input:hover + span { border-color: var(--ink); }
.b-opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Rows (meetings, duties, CPD, events) */
.b-rows { display: grid; gap: var(--space-3); min-width: 0; }
.b-list { min-width: 0; }
.b-row { display: grid; grid-template-columns: var(--tpl, minmax(0, 1fr) auto); gap: var(--space-2) var(--space-3); align-items: end; padding: var(--space-3); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.b-row:has(> .b-cell:only-of-type) { grid-template-columns: minmax(120px, 240px) auto; justify-content: start; }
.b-cell { display: grid; gap: 4px; min-width: 0; }
.b-cell-label { font-size: var(--step--2); font-weight: 600; color: var(--muted); }
.b-row input, .b-row select { min-height: 42px !important; padding: 8px 10px !important; font-size: var(--step--1) !important; }
.b-remove { min-height: 42px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); font: 600 var(--step--2)/1 var(--font-body); cursor: pointer; }
.b-remove:hover { border-color: var(--over); color: var(--over); }
.b-remove:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.b-add { margin-top: var(--space-3); justify-self: start; }
.b-list-empty { margin: 0 0 var(--space-2); font-size: var(--step--1); }
.b-dates { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.b-date { display: flex; gap: 6px; align-items: center; }
.b-date input { width: auto !important; }
@media (max-width: 720px) {
  .b-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .b-row > .b-cell:first-child { grid-column: 1 / -1; }
  /* "Who" (the second column of meetings, duties and events) gets its own full row, so role names are not cut off. */
  .b-row > .b-cell-select:nth-child(2) { grid-column: 1 / -1; }
  .b-row > .b-remove { grid-column: 1 / -1; justify-self: start; min-height: 36px; }
  .b-row:has(> .b-cell:only-of-type) { grid-template-columns: minmax(0, 1fr) auto; }
  .b-row:has(> .b-cell:only-of-type) > .b-remove { grid-column: auto; }
}

/* What this answer adds */
.b-effect { margin: 0; padding: 12px 14px 12px 16px; border-radius: 12px; background: var(--mark-soft); box-shadow: inset 4px 0 0 var(--mark); font-size: var(--step--1); line-height: 1.55; color: var(--ink); }
.b-effect:empty { display: none; }
.b-effect.is-warn { background: var(--over-soft); box-shadow: inset 4px 0 0 var(--over); }
.b-effect-local { display: block; font-weight: 600; }
.b-effect-local + * { display: block; margin-top: 4px; }
.b-why { padding: var(--space-4); border-radius: var(--radius); border: 1px dashed var(--line-strong); font-size: var(--step--1); color: var(--ink-2); }
.b-why p { margin: 0; line-height: 1.55; }
.b-why-title { font: 600 var(--step--2)/1 var(--font-mono) !important; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted) !important; margin-bottom: 8px !important; }
.b-why-rule { margin-top: 8px !important; }
.b-why-rule a { font-weight: 600; }
.b-flags { display: grid; gap: var(--space-3); }
.b-flags:empty { display: none; }
.b-flag { margin: 0; padding: var(--space-4) var(--space-5); border-radius: var(--radius); background: var(--over-soft); border: 1px solid color-mix(in srgb, var(--over) 35%, transparent); font-size: var(--step--1); }
.b-flag.is-needs_contingency { background: var(--band-soft); border-color: color-mix(in srgb, var(--band) 35%, transparent); }
.b-flag p { margin: 0 0 6px; }
.b-flag-title { font-weight: 700; color: var(--ink); }
.b-flag-opts { margin: 8px 0 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.b-flag-opts li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding-left: 16px; position: relative; line-height: 1.45; }
.b-flag-opts li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 8px; height: 8px; border-radius: 2px; background: var(--mark); }
.b-nav { display: flex; gap: var(--space-3); align-items: center; padding-top: var(--space-4); border-top: 1px solid var(--line); flex-wrap: wrap; }
.b-nav-gap { flex: 1; }
.b-nav .btn-mark { min-width: 140px; }

/* Running totals */
.b-side { position: sticky; top: 92px; }
.b-side-inner { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5); display: grid; gap: var(--space-4); box-shadow: var(--shadow-1); }
.b-side-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.b-side h2 { font-size: var(--step-1); margin: 0; }
.b-side-close { display: none; }
.b-side-note { margin: -8px 0 0; font-size: var(--step--2); line-height: 1.45; }
.b-roles { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.b-role { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; align-items: center; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); text-align: left; font: inherit; cursor: pointer; box-shadow: inset 4px 0 0 var(--under); transition: border-color var(--dur-2), transform var(--dur-2) var(--ease-out); }
.b-role.is-over { box-shadow: inset 4px 0 0 var(--cell-over); }
.b-role.is-needs_contingency { box-shadow: inset 4px 0 0 var(--mark); }
.b-role[aria-pressed="true"] { border-color: var(--ink); background: var(--surface); }
.b-role:hover { border-color: var(--line-strong); }
.b-role:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.b-role-name { font-weight: 650; font-size: var(--step--1); }
.b-role-total { justify-self: end; font-size: var(--step--1); }
.b-role-total b { font-size: var(--step-1); }
.b-role-total small { color: var(--muted); }
.b-role .badge { justify-self: start; font-size: 11px; }
.b-role-gauge { grid-column: 1 / -1; }
.b-grid-wrap { display: grid; gap: 8px; }
.b-grid-title { margin: 0; font-weight: 650; font-size: var(--step--1); }
.b-teach { margin: 0; font-size: var(--step--2); line-height: 1.5; }
.build.is-busy .b-roles, .build.is-busy .b-grid-wrap { opacity: 0.72; transition: opacity var(--dur-2) 160ms; }

/* Phone: totals as a bar and a sheet */
.b-bar { display: none; }
@media (max-width: 900px) {
  html:has(.build[data-view="journey"]) { scroll-padding-bottom: 96px; }
  .b-journey { padding-bottom: 96px; }
  .b-bar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 24px rgb(0 0 0 / 8%); }
  .b-bar-btn { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; border: 0; background: none; color: var(--ink); font: inherit; text-align: left; cursor: pointer; padding: 4px 0; }
  .b-bar-btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
  .b-bar-role { font-weight: 650; font-size: var(--step--1); }
  .b-bar-total { justify-self: end; font-weight: 700; }
  .b-bar .badge { justify-self: start; font-size: 11px; }
  .b-bar-more { justify-self: end; font-size: var(--step--2); color: var(--muted); text-decoration: underline; }
  .b-side { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 60; max-height: 82vh; overflow: auto; transform: translateY(105%); transition: transform var(--dur-3) var(--ease-out); visibility: hidden; }
  .b-side.is-open { transform: none; visibility: visible; }
  .b-side-inner { border-radius: var(--radius-l) var(--radius-l) 0 0; padding-bottom: calc(var(--space-5) + env(safe-area-inset-bottom)); box-shadow: 0 -12px 40px rgb(0 0 0 / 18%); }
  .b-side-close { display: inline-flex; }
}
@media (prefers-reduced-motion: reduce) { .b-side { transition: none; } .b-progress i { transition: none; } }

/* ---------- Review ---------- */
.b-review { padding-block: var(--space-7) var(--space-8); }
.b-review-head { max-width: 760px; }
.b-review-head h1 { font-size: var(--step-5); line-height: 1.02; letter-spacing: -0.03em; margin: var(--space-3) 0 var(--space-4); }
.b-review-head h1:focus { outline: none; }
.b-review-actions { margin: var(--space-4) 0 var(--space-6); }
.b-land { list-style: none; margin: 0 0 var(--space-7); padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: var(--space-4); }
.b-land-role { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: var(--space-5); display: grid; gap: var(--space-3); align-content: start; box-shadow: inset 0 5px 0 var(--under); }
.b-land-role.is-over { box-shadow: inset 0 5px 0 var(--cell-over); }
.b-land-role.is-needs_contingency { box-shadow: inset 0 5px 0 var(--mark); }
.b-land-head { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); }
.b-land-head h2 { font-size: var(--step-1); margin: 0; }
.b-land-range { margin: 0; color: var(--ink-2); }
.b-land-range b { font: 700 var(--step-3)/1 var(--font-display); color: var(--ink); letter-spacing: -0.02em; }
.b-land-text { margin: 0; font-size: var(--step--1); line-height: 1.5; }
.b-land-role > .muted { margin: 0; font-size: var(--step--1); line-height: 1.5; }
.b-outputs { margin: var(--space-6) 0 var(--space-7); }
.b-out-grid { margin-bottom: var(--space-5); }
.b-summary { padding: var(--space-5); border-radius: var(--radius-l); background: var(--bg-tint); max-width: 860px; }
.b-summary h3 { margin: 0 0 var(--space-3); font-size: var(--step-1); }
.b-summary p { margin: 0 0 var(--space-3); line-height: 1.6; }
.b-lines { margin-top: var(--space-7); }
.b-table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
.b-table th, .b-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.b-table thead th { font: 600 var(--step--2)/1.3 var(--font-mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg-tint); }
.b-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.b-table tbody th { font-weight: 600; }
.b-table tbody th small { display: block; font-weight: 400; font-size: var(--step--2); }
.b-table tfoot th, .b-table tfoot td { border-top: 2px solid var(--ink); border-bottom: 0; }
.build .unlock { margin-top: 0; }
