/* Portal styles on top of Bootstrap 5.3. Colours come only from tokens.css. */

/* Bootstrap theme mapping */
:root {
  --bs-body-font-family: var(--bng-sans);
  --bs-body-font-size: 1rem;
  --bs-body-line-height: var(--bng-line-body);
  --bs-body-color: var(--bng-ink);
  --bs-body-bg: var(--bng-page-bg);
  --bs-primary: var(--bng-green-text);
  --bs-primary-rgb: 24, 122, 66;
  --bs-link-color: var(--bng-green-text);
  --bs-link-color-rgb: 24, 122, 66;
  --bs-link-hover-color: var(--bng-green-hover);
  --bs-border-color: var(--bng-line);
  --bs-border-radius: var(--bng-radius);
  --bs-secondary-color: var(--bng-muted);
}

html { font-size: var(--bng-font-body); }
body { min-height: 100vh; display: flex; flex-direction: column; overflow-x: hidden; overflow-wrap: break-word; }
h1, h2, h3 { color: var(--bng-ink); font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: var(--bng-h1); line-height: 1.15; }
h2 { font-size: var(--bng-h2); line-height: 1.2; }
h3 { font-size: var(--bng-h3); line-height: 1.25; }
p, li { max-width: 72ch; }
a { text-underline-offset: 3px; }
:focus-visible { outline: none; box-shadow: var(--bng-focus); border-radius: 4px; }
img { max-width: 100%; height: auto; }

.bng-eyebrow { color: var(--bng-green-text); text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; font-size: 0.8125rem; }
.bng-lead { font-size: 1.125rem; color: var(--bng-muted); }
.bng-muted { color: var(--bng-muted); }
.bng-container { width: 100%; max-width: var(--bng-wide); margin: 0 auto; padding: 0 var(--bng-page-pad); }

/* Skip link */
.bng-skip { position: absolute; left: -9999px; top: 0; z-index: 1000; background: var(--bng-surface); color: var(--bng-ink); padding: 12px 16px; }
.bng-skip:focus { left: 16px; top: 16px; }

/* Buttons */
.btn { border-radius: var(--bng-radius); font-weight: 700; padding: 0.625rem 1.125rem; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; }
.btn-primary { --bs-btn-bg: var(--bng-green-text); --bs-btn-border-color: var(--bng-green-text); --bs-btn-hover-bg: var(--bng-green-hover); --bs-btn-hover-border-color: var(--bng-green-hover); --bs-btn-active-bg: var(--bng-green-pressed); --bs-btn-active-border-color: var(--bng-green-pressed); --bs-btn-disabled-bg: var(--bng-green-text); --bs-btn-disabled-border-color: var(--bng-green-text); }
.btn-outline-light { --bs-btn-color: var(--bng-on-dark); --bs-btn-border-color: rgba(255, 255, 255, 0.55); --bs-btn-hover-bg: rgba(255, 255, 255, 0.1); --bs-btn-hover-color: var(--bng-on-dark); --bs-btn-hover-border-color: var(--bng-on-dark); }
.btn-outline-primary { --bs-btn-color: var(--bng-green-text); --bs-btn-border-color: var(--bng-green-text); --bs-btn-hover-bg: var(--bng-green-text); --bs-btn-hover-border-color: var(--bng-green-text); --bs-btn-hover-color: var(--bng-on-dark); --bs-btn-active-bg: var(--bng-green-pressed); --bs-btn-active-border-color: var(--bng-green-pressed); --bs-btn-active-color: var(--bng-on-dark); }
.btn-outline-danger { --bs-btn-color: var(--bng-danger); --bs-btn-border-color: var(--bng-danger); --bs-btn-hover-bg: var(--bng-danger); --bs-btn-hover-border-color: var(--bng-danger); --bs-btn-hover-color: var(--bng-on-dark); --bs-btn-active-bg: var(--bng-danger); --bs-btn-active-border-color: var(--bng-danger); --bs-btn-active-color: var(--bng-on-dark); }
.btn-link-plain { background: none; border: 0; color: inherit; padding: 0; min-height: 0; font-weight: inherit; }

/* Environment banner (staging) */
.bng-env-banner { background: var(--bng-leaf-amber); color: var(--bng-deep); text-align: center; font-weight: 800; letter-spacing: 0.08em; padding: 6px 16px; font-size: 0.875rem; }
/* ADR 0062: an Admin acting as someone; amber like the environment banner, edged so the two read as separate bars. */
.bng-acting-banner { background: var(--bng-leaf-amber); color: var(--bng-deep); border-bottom: 3px solid var(--bng-leaf-amber-edge); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 8px 16px; padding: 8px 16px; font-size: 0.9375rem; }

/* Public top bar */
.bng-topbar { background: var(--bng-deep); color: var(--bng-on-dark); position: sticky; top: 0; z-index: 900; }
.bng-topbar .bng-container { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 68px; }
.bng-brand { display: inline-flex; align-items: center; gap: 10px; color: var(--bng-on-dark); text-decoration: none; font-weight: 800; letter-spacing: 0.02em; font-size: 1.125rem; }
.bng-brand:hover { color: var(--bng-on-dark); }
.bng-brand-mark { width: 28px; height: 28px; flex: none; }
.bng-brand small { display: block; font-size: 0.625rem; letter-spacing: 0.16em; color: var(--bng-green-bright); font-weight: 700; }
.bng-topbar-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.bng-topbar-link { color: var(--bng-on-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 0.5rem 0.25rem; }
.bng-topbar-link:hover, .bng-topbar-link:focus-visible { color: var(--bng-green-bright); }

/* Public hero */
.bng-hero { background: radial-gradient(1200px 500px at 85% 20%, rgba(84, 200, 111, 0.16), transparent 60%), var(--bng-deep); color: var(--bng-on-dark); padding: clamp(40px, 7vw, 96px) 0; }
.bng-hero h1 { color: var(--bng-on-dark); }
.bng-hero h1 em { font-style: normal; color: var(--bng-green-bright); }
.bng-hero p { color: var(--bng-on-dark-muted); font-size: 1.125rem; }
.bng-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 24px; }

/* Cards */
.bng-card { background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); box-shadow: var(--bng-shadow-soft); padding: clamp(18px, 2.4vw, 28px); }
.bng-grid { display: grid; gap: 20px; align-items: start; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.bng-icon-chip { width: 44px; height: 44px; border-radius: 50%; background: var(--bng-green-tint); color: var(--bng-green); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.bng-icon-chip svg { width: 22px; height: 22px; }

/* Main */
main { flex: 1 0 auto; }
.bng-section { padding: clamp(32px, 5vw, 64px) 0; }

/* Footer */
.bng-footer { background: var(--bng-deep); color: var(--bng-on-dark-muted); padding: 28px 0; font-size: 0.875rem; }
.bng-footer a { color: var(--bng-on-dark); }
.bng-footer .bng-container { display: flex; flex-wrap: wrap; gap: 12px 24px; justify-content: space-between; }

/* Forms */
.form-label { font-weight: 700; }
.form-control, .form-select { border-radius: var(--bng-radius); min-height: 48px; border-color: rgba(9, 24, 32, 0.28); }
.form-control:focus, .form-select:focus { border-color: var(--bng-green); box-shadow: var(--bng-focus); }
.form-text { color: var(--bng-muted); }
.field-validation-error, .validation-summary-errors { color: var(--bng-danger); font-weight: 600; }
.input-validation-error { border-color: var(--bng-danger) !important; }
.bng-error-summary { border: 3px solid var(--bng-danger); border-radius: var(--bng-radius); padding: 16px 20px; background: var(--bng-surface); margin-bottom: 24px; }
.bng-error-summary h2 { font-size: 1.125rem; margin: 0 0 8px; }
.bng-error-summary ul { margin: 0; padding-left: 1.2rem; }
.bng-narrow { max-width: 520px; }
/* Calculators: the main form beside the metric upload on desktop; fields two to a line. */
/* minmax(0, 1fr): a grid column otherwise grows to its longest dropdown option and the page scrolls sideways at 320 px. */
.bng-calc { display: grid; gap: 24px; align-items: start; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .bng-calc { grid-template-columns: minmax(0, 1fr) 360px; } }
.bng-calc-question { max-width: 880px; }
@media (min-width: 768px) { .bng-calc-question .bng-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Calculator results lead with the answer (I2, I3): one dark band, then the detail. */
.bng-summary { background: var(--bng-deep); color: var(--bng-on-dark); border-radius: var(--bng-radius); padding: clamp(18px, 3vw, 28px); margin: 0 0 20px; display: grid; gap: 6px; }
.bng-summary-label { color: var(--bng-on-dark-muted); font-size: 1rem; font-weight: 600; margin: 0; letter-spacing: 0; }
.bng-summary-figure { font-size: clamp(30px, 4.5vw, 42px); font-weight: 800; line-height: 1.1; letter-spacing: -0.02em; margin: 0; font-variant-numeric: tabular-nums; max-width: none; }
.bng-summary-figure span { font-size: 1rem; font-weight: 600; color: var(--bng-on-dark-muted); letter-spacing: 0; }
.bng-summary-note { color: var(--bng-on-dark-muted); margin: 0; }
.bng-figure-note { display: block; color: var(--bng-muted); font-size: 0.875rem; }
.bng-distance { width: 100%; max-width: 560px; border-collapse: collapse; margin-bottom: 4px; font-variant-numeric: tabular-nums; }
.bng-distance th, .bng-distance td { padding: 8px 10px; border-top: 1px solid var(--bng-line); font-weight: 400; text-align: left; }
.bng-distance td:last-child { text-align: right; font-weight: 700; white-space: nowrap; }
.bng-distance tr:first-child th, .bng-distance tr:first-child td { background: var(--bng-green-tint); }
.bng-choices-row { grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); max-width: 560px; }
/* Controls sit on the bottom line so a field with a hint lines up with its neighbour without one. */
.bng-fields > * { display: flex; flex-direction: column; }
.bng-fields > * > .form-control, .bng-fields > * > .form-select { margin-top: auto; }
/* min-* keeps the 24 px tap target (WCAG 2.5.8) where the text is smaller, e.g. the search filters on small phones. */
.form-check-input { width: 1.5em; height: 1.5em; min-width: 24px; min-height: 24px; margin-top: 0; border-color: rgba(9, 24, 32, 0.5); }
.form-check-input:checked { background-color: var(--bng-green-text); border-color: var(--bng-green-text); }
.form-check-input:focus { border-color: var(--bng-green); box-shadow: var(--bng-focus); }
.form-check { display: flex; gap: 0.75rem; align-items: flex-start; padding-left: 0; }
.form-check .form-check-input { float: none; margin-left: 0; flex: none; }
.form-check > div, .form-check > label { flex: 1; }
/* Bootstrap floats legends, which pushes the fieldset's controls beside the question. */
fieldset legend { font-size: inherit; float: none; }

/* Settings sub-navigation: a wrapping row of tabs. */
.bng-subnav ul { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 0; margin: 16px 0 8px; }
.bng-subnav a { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 14px; border: 1px solid var(--bng-line); border-radius: var(--bng-radius-pill); background: var(--bng-surface); font-weight: 600; text-decoration: none; }
.bng-subnav a[aria-current="page"] { background: var(--bng-green-text); border-color: var(--bng-green-text); color: var(--bng-on-dark); }
/* J13 (Grok): on a phone the settings links fold under one line ("Settings: Credentials"), not four rows above every page. */
.bng-subnav-fold { margin: 12px 0 8px; }
.bng-subnav-fold > summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.bng-subnav-fold .bng-subnav ul { margin-top: 8px; }
.bng-checkbox-grid { display: grid; gap: 10px 20px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); }

/* Radio cards: one choice per line with a plain description (registration role, organisation type). */
.bng-choices { display: grid; gap: 10px; }
.bng-choice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border: 2px solid var(--bng-line); border-radius: var(--bng-radius); background: var(--bng-surface); cursor: pointer; }
.bng-choice:hover { border-color: var(--bng-green); }
.bng-choice:has(input:checked) { border-color: var(--bng-green-text); background: var(--bng-green-tint); }
.bng-choice input { width: 1.5em; height: 1.5em; margin-top: 0.05em; flex: none; accent-color: var(--bng-green-text); }
.bng-choice strong { display: block; }
.bng-choice-hint { display: block; color: var(--bng-muted); font-size: 0.9375rem; }

/* Portal shell (ADR 0044): dark sidebar + content at >= 992 px; one navigation, rearranged below. */
.bng-portal { display: grid; grid-template-columns: 260px minmax(0, 1fr); flex: 1 0 auto; }
.bng-sidebar { background: var(--bng-deep); color: var(--bng-on-dark); padding: 20px 14px; display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; overscroll-behavior: contain; }
.bng-sidebar ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.bng-sidebar nav a { display: flex; align-items: center; justify-content: space-between; gap: 10px; color: var(--bng-on-dark-muted); text-decoration: none; padding: 8px 12px; border-radius: var(--bng-radius); min-height: 44px; font-weight: 600; }
.bng-sidebar nav a:hover { background: rgba(255, 255, 255, 0.07); color: var(--bng-on-dark); }
.bng-sidebar nav a[aria-current="page"] { background: var(--bng-green-text); color: var(--bng-on-dark); }
.bng-nav-label { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.bng-nav-icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bng-nav-heading { color: var(--bng-on-dark-muted); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; margin: 6px 12px 4px; }
.bng-nav-tools a { font-weight: 500; }
.bng-nav-tools summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding-right: 12px; color: var(--bng-on-dark-muted); cursor: pointer; list-style: none; border-radius: var(--bng-radius); }
.bng-nav-tools summary::-webkit-details-marker { display: none; }
.bng-nav-tools summary::after { content: "\25BE"; }
.bng-nav-tools details[open] > summary::after { content: "\25B4"; }
.bng-nav-tools summary .bng-nav-heading { margin-top: 0; margin-bottom: 0; }
.bng-nav-tools summary:hover { color: var(--bng-on-dark); background: rgba(255, 255, 255, 0.07); }
.bng-nav-group { border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 8px; }
.bng-sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.bng-sheet-close { display: none; }
/* Account chip: organisation, type and role; switching changes the journey, never access (Phase 1 s8.10). */
.bng-account { background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.14); border-radius: var(--bng-radius); font-size: 0.9375rem; }
.bng-account summary, .bng-account-head { display: grid; gap: 2px; padding: 10px 12px; min-height: 44px; }
.bng-account summary { cursor: pointer; list-style: none; }
.bng-account summary::-webkit-details-marker { display: none; }
.bng-account summary::after { content: "Switch organisation"; justify-self: start; font-size: 0.8125rem; text-decoration: underline; color: var(--bng-green-bright); }
.bng-account[open] summary::after { content: "Hide organisations"; }
.bng-account-name { font-weight: 700; color: var(--bng-on-dark); overflow-wrap: anywhere; }
.bng-account-role { color: var(--bng-on-dark-muted); font-size: 0.875rem; }
.bng-account-body { padding: 0 12px 12px; color: var(--bng-on-dark-muted); }
.bng-account-body a { color: var(--bng-on-dark); }
.bng-switcher { display: grid; gap: 6px; }
.bng-switcher .btn { justify-content: flex-start; text-align: left; white-space: normal; }
.bng-sidebar-footer { margin-top: auto; border-top: 1px solid rgba(255, 255, 255, 0.12); padding-top: 14px; font-size: 0.875rem; color: var(--bng-on-dark-muted); }
.bng-sidebar-footer .btn { width: 100%; }
.bng-content { padding: clamp(16px, 3vw, 36px) var(--bng-page-pad); min-width: 0; }
.bng-appbar, .bng-tabbar { display: none; }

/* Invitations waiting on the dashboard: stand out from the cards below. */
.bng-invitations { border: 2px solid var(--bng-green-text); border-left-width: 6px; background: var(--bng-surface); border-radius: var(--bng-radius); padding: 18px 20px; }
.bng-invitation { max-width: none; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px 16px; padding: 12px 0; border-top: 1px solid var(--bng-line); }
.bng-invitation > div:first-child { flex: 1 1 260px; min-width: 0; overflow-wrap: anywhere; }

/* Status pills */
.bng-pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex: none; border-radius: var(--bng-radius-pill); padding: 2px 10px; font-size: 0.8125rem; font-weight: 700; background: var(--bng-soft); border: 1px solid var(--bng-line); color: var(--bng-ink); }
.bng-pill-done { background: var(--bng-green-tint); border-color: transparent; color: #135c33; }
.bng-pill-progress { background: var(--bng-info-tint); border-color: transparent; color: #144c73; }
.bng-pill-blocked { background: var(--bng-soft); color: var(--bng-muted); }
.bng-pill-wrap { white-space: normal; text-align: left; flex: 0 1 auto; min-width: 0; }

/* Guidance components */
.bng-help { border-left: 4px solid var(--bng-green); background: var(--bng-surface); border-radius: var(--bng-radius); padding: 16px 18px; }
.bng-why { color: var(--bng-muted); font-size: 0.9375rem; margin-top: 6px; }
.bng-why strong { color: var(--bng-ink); }
.bng-next { background: var(--bng-green-tint); border-radius: var(--bng-radius); padding: 18px 20px; }
.bng-next h2, .bng-next h3 { font-size: 1.125rem; margin-top: 0; }
/* Inside a form the panel sits just above the submit button; keep them apart. */
form .bng-next { margin-bottom: 1rem; }
.bng-howto { border: 1px solid var(--bng-line); border-radius: var(--bng-radius); background: var(--bng-surface-soft); }
.bng-howto > summary { cursor: pointer; padding: 12px 16px; font-weight: 700; min-height: 44px; }
.bng-howto > div { padding: 0 16px 14px; }
.bng-empty { text-align: center; border: 2px dashed var(--bng-line); border-radius: var(--bng-radius); padding: 32px 20px; background: var(--bng-surface); }
.bng-empty p { margin-left: auto; margin-right: auto; }

.bng-glossary { display: inline; }
.bng-glossary-term { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: help; text-decoration: underline dotted var(--bng-green); text-decoration-thickness: 2px; text-underline-offset: 4px; min-height: 24px; }
.bng-glossary-term:hover { color: var(--bng-green-text); }
.bng-glossary-body[popover] { margin: auto; inset: 0; width: min(92vw, 440px); height: fit-content; padding: 18px 20px; background: var(--bng-surface); color: var(--bng-ink); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); box-shadow: var(--bng-shadow); font-size: 1rem; line-height: 1.55; }
.bng-glossary-body[popover]::backdrop { background: rgba(6, 17, 19, 0.35); }
.bng-glossary-body a { display: inline-block; margin-top: 6px; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

.bng-tasks { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--bng-line); }
.bng-tasks > li { max-width: none; }
.bng-task { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 8px 12px; padding: 14px 0; border-bottom: 1px solid var(--bng-line); }
.bng-task > div:first-child { flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.bng-task-name { font-weight: 700; }
.bng-task-hint { color: var(--bng-muted); font-size: 0.9375rem; margin: 2px 0 0; }

.bng-steps { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; margin: 0 0 20px; counter-reset: step; }
.bng-steps li { counter-increment: step; display: flex; align-items: center; gap: 8px; color: var(--bng-muted); font-weight: 600; font-size: 0.9375rem; }
.bng-steps li::before { content: counter(step); width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bng-line); display: inline-flex; align-items: center; justify-content: center; font-weight: 800; }
.bng-steps li[aria-current="step"] { color: var(--bng-ink); }
.bng-steps li[aria-current="step"]::before { background: var(--bng-green-text); border-color: var(--bng-green-text); color: var(--bng-on-dark); }
.bng-steps li.done::before { background: var(--bng-green-tint); border-color: transparent; color: var(--bng-green-text); }
.bng-steps li > a { color: var(--bng-green-text); }
.bng-steps-name, .bng-steps-bar { display: none; }
/* Walk review P9: on a phone the rail is one line and a thin bar (under 40 px); the step's Back link goes the other way. */
@media (max-width: 575.98px) {
  .bng-rail-thin { margin-bottom: 12px; }
  .bng-rail-thin .bng-eyebrow { margin-bottom: 2px !important; text-transform: none; letter-spacing: 0; line-height: 1.3; }
  .bng-rail-thin .bng-steps-name { display: inline; }
  .bng-rail-thin .bng-steps-bar { display: flex; gap: 3px; }
  .bng-rail-thin .bng-steps-bar i { flex: 1; height: 5px; border-radius: 2px; background: var(--bng-line); }
  .bng-rail-thin .bng-steps-bar i.done { background: var(--bng-green-text); }
  .bng-rail-thin .bng-steps { display: none; }
}
.bng-step-nav { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 0 12px; margin-top: 8px; }
.bng-step-nav .btn-link { padding-left: 0; padding-right: 0; }

/* Walk review S1: a trail on a wide screen; on a phone only its first crumb, as a way back. */
.bng-crumbs { display: flex; flex-wrap: wrap; align-items: center; list-style: none; padding: 0; margin: 0 0 2px; font-size: 0.9375rem; }
.bng-crumbs li { max-width: none; overflow-wrap: anywhere; }
.bng-crumbs a { display: inline-flex; align-items: center; min-height: 44px; }
.bng-crumbs li + li::before { content: "\203A"; margin: 0 8px; color: var(--bng-muted); }
.bng-crumbs li[aria-current] { color: var(--bng-muted); }
.bng-crumbs li:only-child a::before { content: "\2039"; margin-right: 6px; }
@media (max-width: 575.98px) {
  .bng-crumbs li:not(:first-child) { display: none; }
  .bng-crumbs a::before { content: "\2039"; margin-right: 6px; }
}
/* ADR 0070, H5: who a consultant is working for, kept in view. The scroll padding stops a focused or linked item landing under it; a long name can take five lines on a phone, so a window too short to spare the room lets it scroll away. */
.bng-working-for { position: sticky; top: 0; z-index: 800; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding: 0 12px; background: var(--bng-surface); border: 1px solid var(--bng-line); border-left: 4px solid var(--bng-green-text); border-radius: var(--bng-radius); }
.bng-working-for p { margin: 0; padding: 6px 0; min-width: 0; max-width: none; overflow-wrap: anywhere; }
.bng-working-for a { flex: none; display: inline-flex; align-items: center; min-height: 44px; }
.bng-content:has(.bng-search-app) .bng-working-for { margin: 0; border-radius: 0; }
.bng-portal-html:has(.bng-working-for) { scroll-padding-top: 72px; }
@media (max-width: 991.98px) {
  .bng-working-for { top: 57px; }
  .bng-portal-html:has(.bng-working-for) { scroll-padding-top: 200px; }
}
@media (max-height: 700px) {
  .bng-working-for { position: static; }
  .bng-portal-html:has(.bng-working-for) { scroll-padding-top: 64px; }
}
/* ADR 0070, H2: a consultant's client projects: rows that wrap by their own width, and a card each with a full-width button on a phone. */
.bng-client-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 8px; }
.bng-client-rows { list-style: none; padding: 0; margin: 0; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); }
.bng-client-row { max-width: none; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 14px; }
.bng-client-row + .bng-client-row { border-top: 1px solid var(--bng-line); }
.bng-client-name { flex: 1 1 220px; min-width: 0; }
.bng-client-next { flex: 2 1 260px; min-width: 0; max-width: none; margin: 0; }
.bng-client-action { flex: none; min-width: 192px; text-align: right; }
@media (max-width: 575.98px) {
  .bng-client-rows { display: grid; gap: 10px; background: none; border: 0; }
  .bng-client-row, .bng-client-row + .bng-client-row { display: block; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); }
  .bng-client-name { display: block; }
  .bng-client-next { margin: 6px 0 10px; }
  .bng-client-action { min-width: 0; }
  .bng-client-action .btn { width: 100%; }
}
.bng-bank-name { font-size: clamp(1.5rem, 4vw, 1.75rem); margin-bottom: 4px; }
/* Walk review S1: a habitat bank's tabs. Staff pages keep .bng-tabs; do not share these with them. */
.bng-tabline { display: flex; flex-wrap: wrap; column-gap: 18px; border-bottom: 1px solid var(--bng-line); margin-bottom: 1rem; }
.bng-tabline a { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 2px; margin-bottom: -1px; border-bottom: 3px solid transparent; color: var(--bng-ink); font-weight: 600; text-decoration: none; }
.bng-tabline a:hover { border-bottom-color: var(--bng-line); }
.bng-tabline a[aria-current="page"] { border-bottom-color: var(--bng-green-text); color: var(--bng-green-text); }
.bng-section-menu { display: none; margin-bottom: 1rem; border: 1px solid var(--bng-muted); border-radius: var(--bng-radius); background: var(--bng-surface); }
.bng-section-menu > summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 8px 12px; font-weight: 700; cursor: pointer; list-style: none; }
.bng-section-menu > summary::-webkit-details-marker { display: none; }
.bng-section-menu > summary::after { content: "\25BE"; }
.bng-section-menu[open] > summary::after { content: "\25B4"; }
.bng-section-menu ul { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--bng-line); }
.bng-section-menu li { max-width: none; }
.bng-section-menu a { display: flex; align-items: center; min-height: 44px; padding: 6px 12px; font-weight: 600; text-decoration: none; }
.bng-section-menu a[aria-current="page"] { font-weight: 800; text-decoration: underline; }
@media (max-width: 575.98px) {
  .bng-tabline { display: none; }
  .bng-section-menu { display: block; }
}

.bng-cya { width: 100%; border-collapse: collapse; }
.bng-cya th, .bng-cya td { text-align: left; vertical-align: top; padding: 12px 8px 12px 0; border-bottom: 1px solid var(--bng-line); }
.bng-cya th { width: 34%; font-weight: 700; }
.bng-cya td:last-child { text-align: right; white-space: nowrap; }

/* Small screens */
@media (max-width: 991.98px) {
  /* Below 992 px: top bar + bottom bar; the sidebar becomes a bottom sheet (closed sheets are hidden, lessons). */
  .bng-portal-html { scroll-padding-top: 64px; scroll-padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .bng-portal { grid-template-columns: minmax(0, 1fr); }
  .bng-appbar { display: flex; align-items: center; gap: 12px; background: var(--bng-deep); color: var(--bng-on-dark); padding: 6px 16px; position: sticky; top: 0; z-index: 900; min-height: 56px; }
  .bng-appbar .bng-brand { flex: none; }
  .bng-appbar-title { flex: 1; min-width: 0; margin: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: none; }
  .bng-appbar-account { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 56px; min-height: 44px; color: var(--bng-on-dark); font-size: 0.75rem; font-weight: 600; text-decoration: none; border-radius: var(--bng-radius); }
  .bng-appbar-account:hover { color: var(--bng-green-bright); }
  .bng-appbar-account .bng-nav-icon { width: 24px; height: 24px; }
  .bng-sidebar { position: fixed; left: 0; right: 0; bottom: 0; top: auto; height: auto; max-height: 85vh; border-radius: 16px 16px 0 0; padding: 14px 16px calc(16px + env(safe-area-inset-bottom)); transform: translateY(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; z-index: 1000; }
  .bng-sidebar.is-open, .bng-sidebar:target { transform: none; visibility: visible; box-shadow: 0 0 0 100vmax rgba(9, 24, 32, 0.45); }
  .bng-sheet-close { display: inline-flex; align-items: center; min-height: 44px; padding: 0 12px; color: var(--bng-on-dark); font-weight: 600; }
  .bng-sidebar .bng-in-bar { display: none; }
  .bng-nav-work:not(:has(li:not(.bng-in-bar))), .bng-nav-section:not(:has(li:not(.bng-in-bar))) { display: none; }
  .bng-content { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .bng-tabbar { display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 950; background: var(--bng-surface); border-top: 1px solid var(--bng-line); padding-bottom: env(safe-area-inset-bottom); box-shadow: 0 -2px 10px rgba(9, 24, 32, 0.08); }
  .bng-tabbar ul { list-style: none; margin: 0; padding: 0; display: flex; }
  .bng-tabbar li { flex: 1 1 0; min-width: 0; max-width: none; }
  .bng-tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 56px; padding: 6px 2px; color: var(--bng-muted); font-size: 0.75rem; font-weight: 600; text-decoration: none; text-align: center; line-height: 1.15; overflow-wrap: anywhere; }
  .bng-tabbar a[aria-current="page"] { color: var(--bng-green-text); box-shadow: inset 0 3px 0 var(--bng-green-text); }
  .bng-tabbar .bng-nav-icon { width: 24px; height: 24px; }
  .bng-tabbar .bng-bell-count { position: absolute; top: 4px; left: calc(50% + 6px); margin: 0; }
}

@media (max-width: 575.98px) {
  .bng-topbar .bng-container { min-height: 60px; }
  .bng-brand { font-size: 1rem; }
  .bng-topbar-actions .btn { padding: 0.5rem 0.75rem; }
  .bng-cya th { width: auto; display: block; padding-bottom: 0; border: 0; }
  .bng-cya td { display: block; text-align: left; padding-top: 4px; }
  .bng-cya td:last-child { text-align: left; }
  /* J13 (Codex): stacked rows keep one rule under each answer, not one under the value and another under the Change cell. */
  .bng-cya th { padding-top: 10px; }
  .bng-cya td:not(:last-child) { border: 0; padding-bottom: 2px; }
  .bng-cya td:last-child { padding-top: 0; padding-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Phase 2: geography and register */
.bng-callout { background: var(--bng-surface); border: 1px solid var(--bng-line); border-left: 6px solid var(--bng-green-text); border-radius: var(--bng-radius); padding: 16px 20px; }
.bng-area-name { font-size: 1.375rem; font-weight: 800; color: var(--bng-ink); margin-bottom: 8px; }
.bng-input-postcode { max-width: 12ch; text-transform: uppercase; }
.bng-callout-error { border-color: var(--bng-danger); background: var(--bng-danger-tint); }
.bng-pill-failed { background: #fbe9e7; color: #9c2318; }
/* position: relative keeps .visually-hidden text inside a scrolling table from widening the page (absolute boxes escape the scroller otherwise). */
.bng-table-wrap { position: relative; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); }
.bng-table { margin: 0; font-size: 0.9375rem; }
.bng-table th { white-space: nowrap; }
.bng-attribution { color: var(--bng-muted); font-size: 0.875rem; }
/* Bootstrap pink code text fails contrast on the off-white page. */
code { color: var(--bng-ink); white-space: nowrap; }

/* Register map (ADR 0030) */
.bng-filter-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr)); }
.bng-map-layout { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 992px) { .bng-map-layout { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; } }
/* Results fade while search-live.js fetches the new ones. */
.bng-live-busy .bng-live-region { opacity: 0.55; }
/* Sea colour of OS Outdoor_3857 (close to OSM's): OS has no tiles beyond Great Britain, so the gap reads as sea. */
.bng-map { height: clamp(320px, 60vh, 560px); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); }
/* .leaflet-container too: leaflet.css loads later and sets #ddd. */
.bng-map, .leaflet-container.bng-map { background: #a9ddef; }
/* leaflet.css loads later and sets display: block on markers. */
.leaflet-marker-icon.bng-marker, .bng-marker { display: flex; align-items: center; justify-content: center; border-radius: 50%; }
.bng-hash { white-space: normal; overflow-wrap: anywhere; word-break: break-all; }
.bng-map-small { height: clamp(240px, 40vh, 360px); }
.bng-marker-listing { background: var(--bng-green-text); border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35); }
.bng-photos { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.bng-photos img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--bng-radius); border: 1px solid var(--bng-line); }
.bng-photos figure { margin: 0; }
/* Register sites in grey (product owner, 2026-10-25): shown by default, never mistaken for green units for sale. */
.bng-marker-register { background: #c3cbc8; border: 2px solid #6f7d79; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); }
.bng-cluster { background: var(--bng-green-text); color: #fff; font-weight: 800; font-size: 0.9375rem; border: 3px solid #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35); }
/* Search map: register sites cluster as rings, so filled green always means for sale. */
.bng-cluster-register { background: #e4e9e7; color: #3f4b48; border: 2px solid #6f7d79; font-size: 0.8125rem; }
/* Search map app (owner, 2026-10-24): the map fills the stage; filters and the filters in use float top left, the site list and
   key on the right, a listing's card over the map. For-sale markers go from pale to dark green with verification leaves. */
.bng-leaves-0 { background: #d4ecd9; color: #0b3d1f; }
.bng-leaves-1 { background: #a8dab5; color: #0b3d1f; }
.bng-leaves-2 { background: #6dbb86; color: #0b3d1f; }
.bng-leaves-3 { background: #3c9a5f; color: #fff; }
.bng-leaves-4 { background: #1f7a45; color: #fff; }
.bng-leaves-5 { background: #0e5130; color: #fff; }
/* A dark outer ring keeps every for-sale marker visible on the map, even the palest (no leaves yet). */
.bng-marker.bng-marker-listing { box-shadow: 0 0 0 2px #0b3d1f, 0 2px 6px rgba(0, 0, 0, 0.45); }
.bng-marker-listing.bng-gold { border: 4px solid #d4a017; }
.bng-legend .bng-legend-stack { flex-direction: column; align-items: flex-start; gap: 6px; }
.bng-legend-scale { display: inline-flex; gap: 2px; flex: 0 0 auto; }
.bng-legend-scale .bng-legend-symbol { width: 20px; height: 20px; border-width: 2px; font-size: 0.6875rem; font-weight: 700; }
.bng-mapapp-stage { position: relative; }
.bng-mapapp-stage .bng-map { height: clamp(520px, calc(100vh - 160px), 860px); }
.bng-mapapp-left { position: absolute; top: 12px; left: 12px; z-index: 500; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; max-width: calc(100% - 420px); pointer-events: none; }
.bng-mapapp-right { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 380px; z-index: 500; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; pointer-events: none; }
.bng-mapapp-left > *, .bng-mapapp-right > * { pointer-events: auto; }
.bng-mapapp-button { display: inline-flex; align-items: center; min-height: 44px; padding: 8px 18px; border-radius: 999px; background: var(--bng-green-text); color: #fff; font-weight: 700; text-decoration: none; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3); }
.bng-mapapp-button:hover, .bng-mapapp-button:focus-visible { color: #fff; background: var(--bng-deep); }
.bng-mapapp-chips .bng-chip { box-shadow: 0 1px 6px rgba(0, 0, 0, 0.25); }
.bng-chip-clear { display: inline-flex; align-items: center; min-height: 44px; padding: 6px 14px; border-radius: 999px; background: var(--bng-surface); font-weight: 600; }
.bng-mapapp-panel { background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); padding: 12px 14px; }
.bng-sites { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.bng-mapapp-right .bng-legend { flex: 0 0 auto; max-height: 50%; overflow-y: auto; font-size: 0.875rem; }
.bng-mapapp-right .bng-legend > summary { cursor: pointer; }
.bng-site-list { list-style: none; margin: 0; padding: 0; }
.bng-site-list button { display: flex; gap: 10px; align-items: flex-start; width: 100%; min-height: 44px; padding: 8px 4px; border: 0; border-top: 1px solid var(--bng-line); background: none; text-align: left; color: inherit; }
.bng-site-list button:hover, .bng-site-list button:focus-visible { background: var(--bng-soft); }
.bng-site-list .bng-legend-symbol { margin-top: 2px; }
.bng-site-name { display: block; font-weight: 700; }
.bng-site-meta { display: block; color: var(--bng-muted); font-size: 0.875rem; }
.bng-mapapp-card { position: absolute; left: 12px; bottom: 12px; z-index: 1000; width: min(460px, calc(100% - 420px)); max-height: calc(100% - 84px); overflow-y: auto; padding: 8px; border-radius: var(--bng-radius); background: var(--bng-page-bg); box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35); }
.bng-mapapp-card .btn-close { position: sticky; top: 4px; float: right; z-index: 1; margin: 4px; padding: 10px; background-color: var(--bng-surface); }
.bng-mapapp-card .bng-result { margin: 0; }
/* Key toggles: select a kind of site to show or hide it on the map and in the list, at once. */
.bng-key-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 4px 6px; border: 0; border-radius: 6px; background: none; color: inherit; text-align: left; }
.bng-key-toggle:hover, .bng-key-toggle:focus-visible { background: var(--bng-soft); }
/* Hidden kinds say so in words rather than fading below readable contrast. */
.bng-key-toggle[aria-pressed="false"] { color: var(--bng-muted); text-decoration: line-through; }
.bng-key-toggle[aria-pressed="false"]::after { content: "hidden"; margin-left: 6px; font-size: 0.75rem; font-weight: 700; }
.bng-key-count { margin-left: auto; color: var(--bng-muted); font-size: 0.8125rem; }
.bng-mapapp-right .bng-legend li { margin-bottom: 2px; }
/* Find units as a full-screen app (owner, 2026-10-24): the page does not scroll and has no footer; the map fills the
   window below the navigation (search-map.js sizes it); panels scroll inside themselves. */
/* Only once search-map.js runs (.bng-app-live): without JavaScript the page scrolls to the listing cards. */
html:has(.bng-app-live), body:has(.bng-app-live) { overflow: hidden; }
body:has(.bng-app-live) .bng-footer { display: none; }
.bng-content:has(.bng-search-app) { padding: 0; }
.bng-search-app .bng-mapapp-stage .bng-map { height: calc(100dvh - 120px); }
.bng-mapapp-left .bng-tabs { margin: 0 !important; }
.bng-mapapp-left .bng-tabs a { box-shadow: 0 1px 6px rgba(0, 0, 0, 0.2); }
.bng-mapapp-context .bng-card { margin-top: 0 !important; max-height: 40vh; overflow-y: auto; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }
.bng-mapapp-context .bng-callout { margin: 8px 0 0 !important; box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); }
.bng-search-filters .bng-context { margin: 0 0 12px; }
.bng-sites-notes p { margin-bottom: 4px; }
.leaflet-marker-icon.bng-marker:focus-visible { outline: 3px solid var(--bng-deep); outline-offset: 2px; }
.bng-legend li { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.bng-legend-symbol { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 0.75rem; }
.bng-legend-symbol.bng-cluster { width: 30px; height: 30px; }
.bng-legend-listing { background: var(--bng-green-text); border: 3px solid var(--bng-green-bright); }
.bng-unit-tiles { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 170px), 1fr)); }
.bng-unit-tiles li { background: var(--bng-soft); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); padding: 10px 12px; }
.bng-unit-tiles li > span { display: block; font-size: 1.375rem; font-weight: 800; color: var(--bng-ink); }
.bng-callout-warning { border-left-color: #d99a1e; }

/* Five Leaf badges (P4): icon + text, never colour alone. Colours from tokens.css (design-system "Verification badge colours"). */
.bng-leaf { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 0.9375rem; color: var(--bng-ink); }
.bng-leaf svg { width: 22px; height: 22px; flex: none; }
.bng-leaf svg path { stroke-width: 2; stroke-linejoin: round; }
.bng-leaf .bng-leaf-vein { fill: none; stroke: var(--bng-surface); stroke-width: 1.5; }
.bng-leaf-grey svg path:first-child { fill: none; stroke: var(--bng-leaf-grey); }
.bng-leaf-grey .bng-leaf-vein { stroke: var(--bng-leaf-grey); }
.bng-leaf-amber svg path:first-child { fill: var(--bng-leaf-amber); stroke: var(--bng-leaf-amber-edge); }
.bng-leaf-amber .bng-leaf-vein { stroke: var(--bng-leaf-amber-edge); }
.bng-leaf-green svg path:first-child { fill: var(--bng-leaf-green); stroke: var(--bng-leaf-green); }
.bng-leaf-gold svg path:first-child { fill: var(--bng-leaf-gold); stroke: var(--bng-leaf-gold); }
.bng-leaf-gold svg circle { fill: var(--bng-surface); stroke: var(--bng-leaf-gold); stroke-width: 2; }
.bng-leaf-name { font-weight: 600; }
.bng-leaf-help { display: inline-flex; align-items: center; justify-content: center; width: 24px; height: 24px; margin-left: 6px; padding: 0; border: 1px solid var(--bng-green-text); border-radius: 50%; background: var(--bng-surface); color: var(--bng-green-text); font-weight: 800; font-size: 0.8125rem; line-height: 1; cursor: help; vertical-align: middle; }
.bng-leaf-help:hover, .bng-leaf-help:focus-visible { background: var(--bng-green-text); color: var(--bng-surface); }
.bng-leaf-help-body { font-weight: 400; }
.bng-leaf-scale { font-size: 0.9375rem; }
.bng-leaf-dot { display: inline-block; width: 12px; height: 12px; margin-right: 6px; border-radius: 50%; border: 2px solid var(--bng-leaf-grey); vertical-align: -1px; }
.bng-leaf-dot.bng-leaf-amber { background: var(--bng-leaf-amber); border-color: var(--bng-leaf-amber-edge); }
.bng-leaf-dot.bng-leaf-green { background: var(--bng-leaf-green); border-color: var(--bng-leaf-green); }
.bng-leaf-dot.bng-leaf-gold { background: var(--bng-leaf-gold); border-color: var(--bng-leaf-gold); box-shadow: inset 0 0 0 2px var(--bng-surface); }
.bng-leaf-key-button { font-size: 0.9375rem; }
.bng-leaves { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 8px; }
.bng-leaves > li { min-width: 0; }
.bng-leaves details > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; }
.bng-checks { list-style: none; padding: 0; display: grid; gap: 6px; }
.bng-checks > li { display: flex; align-items: flex-start; gap: 8px; }
.bng-checks .bng-pill { flex: none; }
.bng-gold-standard { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; border: 2px solid var(--bng-leaf-gold); border-radius: var(--bng-radius-pill); padding: 4px 14px; color: var(--bng-ink); }
.bng-overdue { color: #9c2318; font-weight: 700; }
.bng-readable { max-width: 880px; }

/* Projects and requirements (Phase 5) */
.bng-requirements { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.bng-requirements ul { padding-left: 1.25rem; }
.bng-totals { list-style: none; padding: 0; margin: 0 0 0.5rem; display: flex; flex-wrap: wrap; gap: 8px 24px; font-size: 1.125rem; }
.bng-choice-picture { align-items: center; }
.bng-module-picture { width: 96px; height: 64px; flex: none; }
.bng-date { display: flex; flex-wrap: wrap; gap: 16px; }
.bng-input-2 { width: 4.5em; }
.bng-input-4 { width: 6.5em; }
.bng-input-date { width: 11em; max-width: 100%; }
/* Honeypot (calculator forms): clipped and aria-hidden; a 1px box keeps it off the page width too. */
.bng-honeypot input { width: 1px; height: 1px; padding: 0; border: 0; }
.bng-search { display: flex; gap: 8px; }
.bng-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 360px) { .bng-module-picture { width: 64px; height: 43px; } }

/* Phase 6: search results, delivered cost, multiplier zones */
.bng-results { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr); }
.bng-result h3 a { color: var(--bng-green-text); }
.bng-card-inner { box-shadow: none; background: var(--bng-surface-soft); }
.bng-delivered { border-top: 1px solid var(--bng-line); padding-top: 12px; }
.bng-figures { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); margin: 0 0 8px; }
.bng-figures div { background: var(--bng-soft); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); padding: 8px 12px; }
.bng-figures dt { font-weight: 600; font-size: 0.875rem; color: var(--bng-muted); }
.bng-figures dd { margin: 0; font-weight: 700; color: var(--bng-ink); overflow-wrap: anywhere; }
.bng-figures .bng-figure-main { font-size: 1.375rem; font-weight: 800; }
.bng-legend-zone { flex: 0 0 auto; width: 22px; height: 16px; border-radius: 3px; border: 2px solid var(--bng-muted); background: var(--bng-surface); }
.bng-zone-within { background: rgba(63, 191, 111, 0.35); border-color: var(--bng-green-text); }
.bng-zone-neighbouring { background: rgba(242, 184, 75, 0.35); border-color: #b26b00; }
.bng-zone-layers { display: flex; flex-wrap: wrap; gap: 6px; }
.bng-zone-layers .btn[aria-pressed="true"] { background: var(--bng-green-text); border-color: var(--bng-green-text); color: var(--bng-on-dark); }
#zone-area-list li { margin-bottom: 0; }
/* A tapped zone area takes focus; the highlight already shows it, so no box round its bounds. */
.bng-map path.leaflet-interactive:focus:not(:focus-visible) { outline: none; }
.bng-best { border-top: 1px solid var(--bng-line); padding-top: 8px; margin-bottom: 8px; }
@media (max-width: 575.98px) { .bng-topbar-actions { gap: 6px; } .bng-topbar-link { padding: 0.375rem 0.125rem; font-size: 0.875rem; } }

/* Messages (P7.4): the person's own messages sit on a tinted card; long words never push the page sideways. */
.bng-message-mine { background: var(--bng-surface); border-left: 4px solid var(--bng-green-text); }
.bng-message-body { white-space: pre-wrap; overflow-wrap: anywhere; }
.bng-ref { white-space: nowrap; }
.bng-deal-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.bng-deal-list > li { border: 1px solid var(--bng-line); border-radius: var(--bng-radius); padding: 12px 16px; margin-bottom: 8px; background: var(--bng-surface); }
/* Deal room (P8): task list beside the deal card and timeline; one column below 992px. */
.bng-deal-room { display: grid; gap: 24px; }
@media (min-width: 992px) { .bng-deal-room { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; } }
.bng-deal-main, .bng-deal-side { min-width: 0; }
.bng-timeline { list-style: none; padding: 0 0 0 14px; margin: 0 0 1rem; border-left: 2px solid var(--bng-line); }
.bng-timeline > li { margin-bottom: 10px; overflow-wrap: anywhere; }
.bng-document-list { padding-left: 1.25rem; }
.bng-document-list > li { margin-bottom: 8px; overflow-wrap: anywhere; }
.bng-break { overflow-wrap: anywhere; word-break: break-word; }
.bng-trade-line { border-top: 1px solid var(--bng-line); padding: 12px 0; }
.bng-trade-line .btn { white-space: nowrap; }
.bng-bell-count { display: inline-block; min-width: 1.5em; padding: 0 0.4em; border-radius: 999px; background: #b3261e; color: #fff; font-size: 0.8rem; text-align: center; margin-left: 0.25rem; }
/* Badges keep white text on red in every nav (two-digit counts once failed contrast). */
.bng-sidebar nav span.bng-bell-count, .bng-tabbar span.bng-bell-count { display: inline-block; min-height: 0; padding: 0 0.4em; color: #fff; font-weight: 600; }

/* Name columns in wide staff tables keep words whole on phones (reconciliation report). */
.bng-col-name { min-width: 11rem; }

/* Dashboards and insight (P13): KPI tiles that link to the work, native progress/meter bars (no inline styles under the CSP). */
.bng-kpis { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); }
.bng-kpi { display: flex; flex-direction: column; gap: 4px; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); box-shadow: var(--bng-shadow-soft); padding: 16px 18px; color: var(--bng-ink); text-decoration: none; min-width: 0; }
.bng-kpi:hover, .bng-kpi:focus-visible { border-color: var(--bng-green-text); color: var(--bng-ink); }
.bng-kpi-label { font-weight: 700; color: var(--bng-green-text); text-decoration: underline; }
.bng-kpi-value { font-size: 1.875rem; font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.bng-kpi-value-small { font-size: 1.25rem; }
.bng-kpi-unit { font-size: 0.9375rem; font-weight: 600; }
.bng-kpi-note { color: var(--bng-muted); font-size: 0.9375rem; }
.bng-progress, .bng-meter { display: block; width: 100%; max-width: 220px; height: 10px; border: 0; border-radius: var(--bng-radius-pill); background: var(--bng-soft); overflow: hidden; accent-color: var(--bng-green-text); }
.bng-progress::-webkit-progress-bar, .bng-meter::-webkit-meter-bar { background: var(--bng-soft); border-radius: var(--bng-radius-pill); }
.bng-progress::-webkit-progress-value, .bng-meter::-webkit-meter-optimum-value { background: var(--bng-green-text); border-radius: var(--bng-radius-pill); }
.bng-progress::-moz-progress-bar, .bng-meter::-moz-meter-bar { background: var(--bng-green-text); border-radius: var(--bng-radius-pill); }
.bng-meter { max-width: none; height: 14px; min-width: 60px; }
.bng-dashboard-projects { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 1200px) { .bng-dashboard-projects { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; } }
/* The comparison: one card per listing, side by side when they fit; subgrid keeps each row level across the cards. */
.bng-compare { display: grid; gap: 16px; align-items: stretch; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.bng-compare-card { display: grid; grid-row: span 6; grid-template-rows: subgrid; gap: 12px; min-width: 0; padding: 16px; }
.bng-compare-costs .bng-compare-card { grid-row: span 7; }
.bng-compare-card dl { display: contents; }
.bng-compare-card dt { font-size: 0.8125rem; font-weight: 700; color: var(--bng-muted); }
.bng-compare-card dd { margin: 0; }
.bng-compare-card dl > div { border-top: 1px solid var(--bng-line); padding-top: 8px; min-width: 0; }
.bng-compare-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 4px 12px; }
.bng-compare-head .btn { min-height: 44px; }
.bng-compare-total { font-size: 1.25rem; font-variant-numeric: tabular-nums; }

/* Phase 15: filter chips that wrap (never scroll the page sideways) and tables that stack into cards on phones. */
.bng-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bng-chips a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--bng-line); border-radius: var(--bng-radius-pill); background: var(--bng-surface); font-weight: 600; text-decoration: none; }
.bng-chips a[aria-current="page"] { background: var(--bng-green-text); border-color: var(--bng-green-text); color: var(--bng-on-dark); }
.bng-chip-count { font-weight: 700; font-size: 0.875rem; }
@media (max-width: 575.98px) {
  .bng-table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .bng-table-stack, .bng-table-stack tbody, .bng-table-stack tr, .bng-table-stack td { display: block; width: 100%; }
  .bng-table-stack tr { border: 1px solid var(--bng-line); border-radius: var(--bng-radius); background: var(--bng-surface); padding: 8px 14px; margin-bottom: 10px; }
  .bng-table-stack td { border: 0; padding: 4px 0; text-align: left; background: transparent; }
  .bng-table-stack td[data-label]::before { content: attr(data-label); display: block; font-size: 0.8125rem; font-weight: 700; color: var(--bng-muted); }
  /* L9: a first cell that names the row, then the figures two by two, so a table of numbers is not five screens long. */
  .bng-table-stack-pairs tr { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; padding: 6px 12px; margin-bottom: 8px; }
  .bng-table-stack-pairs td { width: auto; padding: 2px 0; }
  .bng-table-stack-pairs td:first-child { grid-column: 1 / -1; font-weight: 700; }
  .bng-table-stack-pairs td:first-child::before { display: none; }
}
@media (min-width: 360px) and (max-width: 575.98px) {
  .bng-table-stack-pairs tr { grid-template-columns: repeat(4, 1fr); column-gap: 8px; }
}
.bng-deal-list > li.bng-unread { border-left: 4px solid var(--bng-green-text); }

/* Public header (P15.2 AC7): logo and both buttons stay on one row down to 320 px; the page links take a second row. */
.bng-topbar .bng-container { flex-wrap: wrap; }
.bng-topbar-links { margin-left: auto; }
@media (max-width: 767.98px) {
  .bng-topbar .bng-container { row-gap: 0; padding-top: 6px; padding-bottom: 6px; }
  .bng-topbar-buttons { margin-left: auto; flex-wrap: nowrap; }
  .bng-topbar-links { order: 3; flex-basis: 100%; margin-left: 0; justify-content: flex-start; }
}
@media (max-width: 374.98px) {
  .bng-topbar .bng-brand > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bng-topbar-buttons .btn { padding: 0.5rem 0.625rem; }
}

/* Verification (P15.4 AC3): five leaf summaries as links; the open one is marked. */
.bng-leaf-summaries { list-style: none; padding: 0; margin: 0 0 16px; display: grid; gap: 6px; }
.bng-leaf-summaries a { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; min-height: 44px; padding: 6px 10px; font-size: 0.9375rem; border: 1px solid var(--bng-line); border-radius: var(--bng-radius); background: var(--bng-surface); color: var(--bng-ink); text-decoration: none; }
.bng-leaf-summaries a[aria-current="true"] { border: 2px solid var(--bng-green-text); }
.bng-leaf-summary-next { color: var(--bng-green-text); font-weight: 600; text-decoration: underline; font-size: 0.9375rem; }
.bng-leaf-link { text-decoration: none; color: inherit; }
/* Sticky main action (phone pattern 4): above the bottom bar below 992 px, inline on desktop. */
.bng-sticky-action { margin-top: 0.5rem; }
@media (max-width: 991.98px) {
  .bng-sticky-action { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 5; background: var(--bng-surface); padding: 10px 0; margin-top: 10px; box-shadow: 0 -8px 8px -8px rgba(9, 24, 32, 0.15); }
  .bng-sticky-action .btn { width: 100%; }
}
@media (max-width: 575.98px) { .bng-tabs { gap: 6px; } .bng-tabs a { padding: 6px 12px; font-size: 0.9375rem; } }

/* Walk review S2, units and prices: subgrid keeps each field's label, box and note level across the row; the guide moves beside the fields once they fit. */
/* A legend that does not float sits on the card's top border (line 126 turns floating off for every other fieldset). */
.bng-price-card > legend { float: left; width: 100%; }
.bng-price-line { display: grid; gap: 12px 24px; }
.bng-price-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 12px; }
.bng-price-fields > div { display: grid; grid-row: span 3; grid-template-rows: subgrid; min-width: 0; }
.bng-price-fields > div:first-child { grid-column: 1 / -1; }
.bng-price-fields .form-label { align-self: end; margin-bottom: 0; }
.bng-price-hint { color: var(--bng-muted); font-size: 0.875rem; margin: 0; }
.bng-price-total { background: var(--bng-soft); border-radius: var(--bng-radius); padding: 6px 10px; margin: 8px 0 0; }
.bng-price-guide { font-size: 0.9375rem; }
.bng-price-guide .bng-howto { background: transparent; }
.bng-price-unit-box { display: none; }
.bng-price-fields .form-control:has(+ .bng-price-unit-box) { border-radius: 0 var(--bs-border-radius) var(--bs-border-radius) 0; }
/* Walk review S2: "per unit" goes in the box only when the fields have room for it. The room is this row's, not the window's: the sidebar and the guide beside the fields both take from it, which cut the price off from 1280 to 1335 px. */
.bng-price-line > div:first-child { container-type: inline-size; }
@container (min-width: 640px) {
  .bng-price-unit-box { display: flex; }
  .bng-price-unit { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .bng-price-fields .form-control:has(+ .bng-price-unit-box) { border-radius: 0; }
}
@media (max-width: 359.98px) {
  .bng-price-fields .input-group .form-control { padding-inline: 8px; }
}
@media (min-width: 768px) {
  .bng-price-fields { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .bng-price-fields > div:first-child { grid-column: auto; }
}
@media (min-width: 1280px) {
  .bng-price-line { grid-template-columns: minmax(0, 1fr) 280px; align-items: start; }
  .bng-price-guide { background: var(--bng-soft); border-radius: var(--bng-radius); padding: 8px 12px; }
}
.bng-prices-actions .bng-sticky-action { display: flex; align-items: center; gap: 8px; }
.bng-prices-actions .bng-sticky-action .btn { width: auto; }
.bng-prices-actions .bng-sticky-action .btn-primary { flex: 1 1 auto; }
/* Below 992 px the inner bar alone sticks, as everywhere; a wrapper with a box of its own would hold it in place. The scroll padding keeps a field reached by Tab clear of the bars. */
@media (max-width: 991.98px) {
  html:has(.bng-prices-actions) { scroll-padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
  .bng-prices-actions { display: contents; }
}
@media (min-width: 992px) {
  html:has(.bng-prices-actions) { scroll-padding-bottom: 90px; }
  .bng-prices-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; margin-top: 12px; padding: 10px 16px; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); box-shadow: 0 -8px 8px -8px rgba(9, 24, 32, 0.15); }
  .bng-prices-actions .bng-sticky-action { margin-top: 0; }
  .bng-prices-actions .bng-sticky-action .btn-primary { flex: none; }
}

/* Home (P15.3): "Needs you" first; KPI tiles two across on phones (phone pattern 5). The "Now" card (home "Needs you", deal
   room) has its own class: .bng-actions above is a flex row of buttons, and sharing it put the card's heading and text on one line. */
.bng-now { background: var(--bng-surface); border: 2px solid var(--bng-green-text); border-left-width: 6px; border-radius: var(--bng-radius); padding: 16px 18px; }
.bng-action-list { list-style: none; padding: 0; margin: 0; }
.bng-action-list > li { max-width: none; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--bng-line); }
.bng-action-list > li:first-child { border-top: 0; }
.bng-action-list > li > div { flex: 1 1 240px; min-width: 0; }
.bng-action-list .bng-pill { margin-left: 6px; }
.bng-action-list-quiet > li { display: grid; gap: 2px; }
.bng-fold summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; min-height: 44px; }
.bng-fold[open] summary { margin-bottom: 12px; }
@media (max-width: 575.98px) {
  .bng-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .bng-kpi { padding: 12px; }
  .bng-kpi-value { font-size: 1.375rem; }
}

/* Find units (P15.5): results first; filters in a rail beside results and map from 992 px, and sheets (:target) below. */
.bng-context { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); padding: 12px 16px; margin-top: 12px; }
.bng-context > div { flex: 1 1 220px; min-width: 0; }
.bng-context > .bng-context-action { flex: 0 0 auto; }
.bng-search { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr); }
.bng-search-main { min-width: 0; }
.bng-sheet-panel-head { display: none; }
.bng-results-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin: 16px 0 12px; }
.bng-results-tools { display: none; gap: 8px; }
/* Search: the filters sit above the map at every width (owner, 2026-10-24), so the map gets the full width; the main
   four show, the rest open under More filters. Filters in use show as chips, each removable. */
.bng-more-filters > summary { font-weight: 700; color: var(--bng-green-text); cursor: pointer; padding: 10px 0; }
.bng-chip-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; }
.bng-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px; border: 1px solid var(--bng-green-text); border-radius: 999px; background: var(--bng-surface); color: var(--bng-green-text); font-weight: 600; text-decoration: none; }
.bng-chip:hover, .bng-chip:focus-visible { background: var(--bng-soft); }
@media (max-width: 991.98px) {
  .bng-results-tools { display: flex; }
  .bng-sheet-panel { position: fixed; inset: 0; z-index: 1000; background: var(--bng-page-bg); overflow-y: auto; padding: 0 16px calc(24px + env(safe-area-inset-bottom)); transform: translateY(100%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; }
  .bng-sheet-panel:target { transform: none; visibility: visible; }
  .bng-sheet-panel-head { display: flex; position: sticky; top: 0; z-index: 2; background: var(--bng-page-bg); align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--bng-line); margin-bottom: 12px; }
  .bng-sheet-done { font-weight: 700; min-height: 44px; display: inline-flex; align-items: center; }
  /* Phones: the same app. The site list slides up from the List button (bottom left), the key opens from its button
     (bottom right), a listing's card rises from the bottom; pinch to zoom, so no zoom buttons. */
  .bng-mapapp-left { top: 8px; left: 8px; right: 8px; max-width: none; }
  .bng-mapapp-left .bng-tabs { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; }
  /* 40px clears the map attribution, which wraps to two lines on a phone and must stay readable (OS licence). */
  .bng-mapapp-right { top: auto; left: 8px; right: 8px; bottom: 40px; width: auto; max-height: 75%; align-items: flex-end; }
  .bng-sites { display: none; width: 100%; }
  .bng-sites.is-open { display: block; }
  .bng-mapapp-right .bng-legend { max-height: 60vh; }
  .bng-mapapp-list { position: absolute; left: 8px; bottom: 40px; z-index: 600; }
  .bng-search-app .leaflet-control-zoom { display: none; }
  .bng-mapapp-card { left: 8px; right: 8px; bottom: 8px; width: auto; max-height: 70%; }
}
/* Desktop: the filters open as a drawer from the left, over the map (the same panel is the phone sheet). */
@media (min-width: 992px) {
  .bng-search-filters { position: fixed; top: var(--bng-app-top, 0px); bottom: 0; left: 0; z-index: 1050; width: 400px; max-width: 90vw; overflow-y: auto; padding: 0 16px 24px; background: var(--bng-page-bg); box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25); transform: translateX(-105%); visibility: hidden; transition: transform 0.2s ease, visibility 0.2s; }
  .bng-search-filters:target, .bng-search-filters.is-open { transform: none; visibility: visible; }
  .bng-search-filters .bng-sheet-panel-head { display: flex; position: sticky; top: 0; z-index: 2; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; padding: 10px 0; border-bottom: 1px solid var(--bng-line); background: var(--bng-page-bg); }
  .bng-search-filters .bng-sheet-done { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
}

/* Find units redesign (2026-10-25, ADR 0050): a visible title with the location box, richer rows, zone badges, grey
   register rows, the compare tray, busy feedback and a visible map error. */
.bng-mapapp-title { width: min(380px, 100%); padding: 12px 14px; display: grid; gap: 4px; }
.bng-mapapp-back { padding: 0 12px; max-width: 100%; }
.bng-mapapp-back .bng-crumbs { margin: 0; }
.bng-mapapp-heading { font-size: 1.125rem; font-weight: 800; margin: 0; }
.bng-mapapp-sub { margin: 0; color: var(--bng-muted); font-size: 0.875rem; }
.bng-place { margin-top: 6px; }
.bng-place .form-label { font-weight: 700; margin-bottom: 4px; }
.bng-place-field { position: relative; }
.bng-place-field .form-control { padding-right: 44px; }
.bng-place-clear { position: absolute; top: 0; right: 0; width: 44px; height: 100%; display: inline-flex; align-items: center; justify-content: center; font-size: 1.25rem; text-decoration: none; color: var(--bng-muted); }
.bng-place-options { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 1100; list-style: none; margin: 0; padding: 4px 0; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2); max-height: 50vh; overflow-y: auto; }
.bng-place-option { display: flex; flex-direction: column; padding: 8px 12px; min-height: 44px; justify-content: center; cursor: pointer; }
.bng-place-option.is-active, .bng-place-option:hover { background: var(--bng-green-tint); }
.bng-place-label { font-weight: 600; }
.bng-place-detail { font-size: 0.8125rem; color: var(--bng-muted); }
.bng-place-help { margin: 4px 0 0; font-size: 0.8125rem; color: var(--bng-muted); }
.bng-zone-badge { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 0.75rem; font-weight: 700; white-space: nowrap; background: var(--bng-soft); color: var(--bng-ink); border: 1px solid var(--bng-line); }
.bng-zone-within { background: var(--bng-green-tint); color: var(--bng-green-text); border-color: transparent; }
.bng-zone-neighbouring { background: var(--bng-warning-tint); color: #6b4700; border-color: transparent; }
.bng-zone-outside { background: var(--bng-danger-tint); color: var(--bng-danger); border-color: transparent; }
.bng-badge-gold { background: #f7eecb; color: #5c4800; border-color: transparent; }
.bng-badge-ineligible { background: var(--bng-soft); color: var(--bng-muted); }
.bng-site-row { display: flex; align-items: stretch; border-top: 1px solid var(--bng-line); }
.bng-site-list .bng-site-row button { flex: 1 1 auto; min-width: 0; border-top: 0; }
.bng-site-main { display: grid; gap: 2px; flex: 1 1 auto; min-width: 0; }
.bng-site-badges { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.bng-site-price { flex: 0 0 auto; text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bng-site-price small { display: block; max-width: 84px; margin-left: auto; white-space: normal; font-weight: 500; font-size: 0.75rem; color: var(--bng-muted); }
.bng-site-name { overflow-wrap: anywhere; }
.bng-sort span { white-space: nowrap; }
.bng-site-tick { flex: 0 0 44px; display: flex; align-items: center; justify-content: center; cursor: pointer; }
.bng-row-ineligible .bng-site-name { color: var(--bng-muted); }
.bng-site-group { padding: 10px 4px 4px; border-top: 1px solid var(--bng-line); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bng-muted); }
.bng-site-register { background: var(--bng-soft); }
.bng-site-register .bng-site-name { font-weight: 600; color: var(--bng-muted); }
.bng-marker-listing.bng-ineligible { opacity: 0.55; }
.bng-marker-listing > span { font-size: 0.75rem; font-weight: 800; }
.bng-sites-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 12px; margin: 6px 0; }
.bng-sort { display: inline-flex; align-items: center; gap: 6px; font-size: 0.8125rem; font-weight: 600; }
.bng-sort .form-select { width: auto; }
.bng-empty { padding: 8px 0; }
.bng-live-busy-note { display: none; color: var(--bng-green-text); font-weight: 600; }
.bng-live-busy .bng-live-busy-note { display: block; }
.bng-live-busy .bng-live-region, .bng-live-busy #site-list { opacity: 0.55; }
.bng-compare-tray { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bng-ink); color: var(--bng-on-dark); }
.bng-compare-picked { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; flex: 1 1 auto; }
.bng-compare-chip { min-height: 32px; padding: 2px 10px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, 0.5); background: transparent; color: var(--bng-on-dark); font-size: 0.8125rem; font-weight: 600; }
.bng-compare-note { flex-basis: 100%; color: var(--bng-on-dark); }
.bng-compare-note:empty { display: none; }
/* Find units with a project (ADR 0068): pickers and tabs head the list box; rows and cards show each bank's plan. */
.bng-sites .bng-context { margin: 0 0 4px; padding: 0; gap: 6px 12px; background: none; border: 0; }
.bng-sites .bng-context .form-label { font-size: 0.8125rem; font-weight: 700; margin-bottom: 2px; }
.bng-sites .bng-context > div { flex-basis: 100%; }
.bng-sites-tabs { display: flex; border-bottom: 1px solid var(--bng-line); margin: 0 0 8px; }
.bng-sites-tabs [role="tab"] { flex: 1 1 auto; min-height: 44px; padding: 0 8px; border: 0; border-bottom: 3px solid transparent; background: none; font-weight: 700; color: var(--bng-muted); white-space: nowrap; }
.bng-sites-tabs [role="tab"][aria-selected="true"] { color: var(--bng-green-text); border-bottom-color: var(--bng-green-text); }
.bng-tab-count { font-weight: 600; }
.bng-badge-all { background: var(--bng-green-tint); color: var(--bng-green-text); border-color: transparent; }
.bng-site-fit { font-size: 0.8125rem; font-weight: 600; margin-top: 2px; }
.bng-fit-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.bng-fit-chip, .bng-req-chip { display: inline-block; padding: 1px 6px; border-radius: 6px; font-size: 0.75rem; font-weight: 600; line-height: 1.4; }
.bng-fit-chip svg, .bng-req-chip svg { width: 12px; height: 12px; margin-right: 3px; vertical-align: -2px; }
.bng-fit-chip.is-met, .bng-req-yes { background: var(--bng-green-tint); color: var(--bng-green-text); }
.bng-fit-chip.is-not, .bng-req-no { background: var(--bng-soft); color: var(--bng-muted); }
.bng-req-part, .bng-fit-chip.is-part { background: var(--bng-warning-tint); color: #6b4700; }
.bng-site-have { font-size: 0.8125rem; margin-top: 2px; }
/* A long zone badge wraps inside its row rather than running under the price column. */
.bng-site-badges .bng-zone-badge { white-space: normal; text-align: left; }
/* Project rows (owner, 2026-11-01): one full-width column, the cost its own line, the compare tick under the leaf mark. */
.bng-site-row-plan { position: relative; }
.bng-site-row-plan .bng-site-tick { position: absolute; left: 0; top: 34px; width: 30px; height: 36px; }
.bng-site-row-plan .bng-site-main { gap: 3px; }
.bng-site-meta-inline { font-weight: 400; font-size: 0.875rem; color: var(--bng-muted); }
.bng-site-cost { font-size: 0.875rem; font-variant-numeric: tabular-nums; }
.bng-site-cost strong { font-size: 1rem; font-weight: 800; }
.bng-site-cost .bng-site-short { white-space: nowrap; }
.bng-fit-chips .bng-site-fit { margin: 0 2px 0 0; align-self: center; }
.bng-site-have.is-short, .bng-site-short { color: #8a3b00; font-weight: 700; }
.bng-site-have svg, .bng-site-short svg { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }
.bng-fit.is-part { border-color: #c98a00; }
.bng-fit.is-part .bng-fit-state { background: var(--bng-warning-tint); color: #6b4700; }
.bng-req-word { font-weight: 500; }
.bng-requirement { border-top: 1px solid var(--bng-line); padding-top: 8px; margin-top: 8px; }
.bng-plan { margin-bottom: 12px; }
.bng-plan li, .bng-plan p { max-width: none; }
.bng-fit { border: 1px solid var(--bng-line); border-radius: var(--bng-radius); padding: 8px 10px; margin-bottom: 8px; }
.bng-fit.is-met { border-color: var(--bng-green-text); }
.bng-fit.is-not { background: var(--bng-soft); }
.bng-fit-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.bng-fit-state { flex: 0 0 auto; font-size: 0.75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; background: var(--bng-soft); color: var(--bng-muted); }
.bng-fit.is-met .bng-fit-state { background: var(--bng-green-tint); color: var(--bng-green-text); }
.bng-plan-best { background: var(--bng-green-tint); border-radius: var(--bng-radius); padding: 10px 12px; }
.bng-plan-best ul { padding-left: 18px; }
.bng-offer li { padding: 6px 0; border-top: 1px solid var(--bng-line); }
.bng-plan-line { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 8px 0; border-top: 1px solid var(--bng-line); }
.bng-plan-cost { flex: 0 0 auto; font-weight: 800; font-variant-numeric: tabular-nums; }
.bng-req-state { display: inline-block; font-size: 0.75rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; margin-bottom: 2px; }
.bng-plan-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-top: 2px solid var(--bng-ink); padding-top: 8px; }
.bng-plan-total strong { font-size: 1.25rem; font-variant-numeric: tabular-nums; }
@media (max-width: 991.98px) {
  /* Phones: an open list takes the height above the bottom buttons, so the pickers and tabs leave room for the rows. */
  .bng-mapapp-right:has(.bng-sites.is-open) { top: 8px; max-height: none; }
  .bng-mapapp-right:has(.bng-sites.is-open) .bng-sites { flex: 1 1 auto; }
  /* With a project the title box has nothing to show on a phone (its heading is hidden there). */
  .bng-mapapp-title:not(:has(.bng-place)) { display: none; }
}
.bng-compare-tray .btn-primary { background: var(--bng-green-bright); border-color: var(--bng-green-bright); color: var(--bng-ink); }
.bng-map-error { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 700; max-width: min(360px, calc(100% - 32px)); font-weight: 600; }
.bng-filter-actions { position: sticky; bottom: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; padding: 10px 0; background: var(--bng-surface); }
.bng-filter-actions .btn { flex: 1 1 auto; }
.bng-row-picked td { background: var(--bng-green-tint); }
.bng-result-actions { display: grid; gap: 6px; }
.bng-topbar-menu { display: none; }
.bng-areas { margin: 0 0 8px; padding: 10px 12px; border: 1px solid var(--bng-line); border-radius: var(--bng-radius); background: var(--bng-surface); }
.bng-areas legend { float: none; width: auto; font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.bng-areas-note { color: var(--bng-green-text); font-weight: 600; }
.bng-areas-note:empty { display: none; }
.bng-count { margin: 0 0 16px; padding: 10px 12px; border: 1px solid var(--bng-line); border-radius: var(--bng-radius); background: var(--bng-surface); }
.bng-count legend { float: none; width: auto; font-size: 1rem; font-weight: 700; margin-bottom: 4px; }
.bng-count .form-check { min-height: 32px; }
@media (max-width: 991.98px) {
  .bng-mapapp-title { width: 100%; padding: 8px 10px; }
  .bng-mapapp-heading, .bng-mapapp-sub { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .bng-place { margin-top: 0; }
  .bng-place .form-label { font-size: 0.8125rem; }
  .bng-mapapp-right { gap: 8px; }
  /* Above the List button, which sits at the same bottom line on the left. */
  .bng-compare-tray { width: 100%; margin-bottom: 52px; }
}
@media (max-width: 575.98px) {
  .bng-topbar-menu:not([hidden]) { display: inline-flex; }
  .bng-topbar-links[data-collapsible]:not(.is-open) { display: none; }
}
.bng-pre { white-space: pre-line; }

/* Review 2026-10-27 (ADR 0059): one pattern for every action that cannot be undone. A danger summary opens a panel that
   says what happens, with the real button inside; no script, so it works under the CSP. */
.btn-danger { --bs-btn-bg: var(--bng-danger); --bs-btn-border-color: var(--bng-danger); --bs-btn-hover-bg: #8f1c13; --bs-btn-hover-border-color: #8f1c13; --bs-btn-active-bg: #8f1c13; --bs-btn-active-border-color: #8f1c13; }
.bng-confirm > summary { list-style: none; display: inline-flex; align-items: center; min-height: 44px; }
.bng-confirm > summary::-webkit-details-marker { display: none; }
.bng-confirm-panel { margin-top: 10px; padding: 14px 16px; border: 1px solid var(--bng-danger); border-radius: var(--bng-radius); background: var(--bng-danger-tint); }
.bng-confirm-panel > :last-child { margin-bottom: 0; }
.bng-action-list > li > details[open] { flex-basis: 100%; }
/* A folding panel inside a row: just the link-style summary, the panel opens below it. */
.bng-howto-inline { border: 0; background: transparent; }
.bng-howto-inline > summary { padding: 0; color: var(--bng-green-text); font-weight: 600; text-decoration: underline; display: flex; align-items: center; }
.bng-howto-inline > div { padding: 8px 0 0; }

/* Review A18: a fact that differs between a habitat bank and its register site. */
.bng-row-differs td { background: var(--bng-warning-tint); }
/* A heading used as a disclosure's label sits on the same line as its arrow. */
details > summary > h2, details > summary > h3 { display: inline; }
/* Review B6: on a phone the action ("Upload your management plan") already names the document, so the leaf name drops. */
@media (max-width: 575.98px) { .bng-leaf-summary-name { display: none; } }

/* Deal journey (plan 2026-10-30): progress rail, "Now" card, whose-turn marker, actor tags, phase folds, deal options,
   stacked bars. Walk review S3: green = your action or done, blue = waiting on someone else, grey = later; a word always goes with the colour. */
.bng-rail { list-style: none; padding: 0; margin: 0 0 12px; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 6px; }
.bng-rail > li { max-width: none; display: flex; flex-direction: column; gap: 2px; padding-top: 10px; border-top: 6px solid var(--bng-line); font-size: 0.9375rem; min-width: 0; overflow-wrap: anywhere; }
.bng-rail > li.bng-rail-done { border-top-color: var(--bng-green); }
.bng-rail > li.bng-rail-current { border-top-color: var(--bng-green-text); }
.bng-rail-name { font-weight: 700; color: var(--bng-ink); }
.bng-rail-later .bng-rail-name { color: var(--bng-muted); font-weight: 600; }
.bng-rail-status { color: var(--bng-muted); font-size: 0.875rem; }
/* Where a deal is says nothing about whose turn it is, so its word stays neutral. */
.bng-rail-current .bng-rail-status { color: var(--bng-ink); font-weight: 700; }
.bng-rail-jump { display: inline-flex; align-items: center; min-height: 44px; }
.bng-rail-phone { display: none; }
@media (max-width: 575.98px) {
  .bng-rail-jump { display: none; }
  .bng-rail { gap: 4px; margin-bottom: 4px; }
  .bng-rail > li { padding-top: 0; border-top-width: 6px; border-radius: 3px; }
  .bng-rail-name, .bng-rail-status { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
  .bng-rail-phone { display: block; font-weight: 600; font-size: 0.9375rem; margin-bottom: 12px; }
}

.bng-now { --bng-who: var(--bng-green-text); border-color: var(--bng-who); }
.bng-now > h2 { margin: 2px 0 6px; }
.bng-now.bng-actor-other, .bng-now.bng-actor-bng { --bng-who: #1d5f8f; border-width: 1px; border-left-width: 6px; }
.bng-now.bng-now-done { border-color: var(--bng-green); }
.bng-now-who { display: flex; align-items: center; gap: 8px; margin: 0; font-weight: 700; font-size: 0.875rem; letter-spacing: 0.04em; text-transform: uppercase; color: var(--bng-who); }
.bng-who-mark { width: 12px; height: 12px; border-radius: 50%; background: var(--bng-who); flex: none; }
.bng-now-due { font-weight: 700; margin-bottom: 8px; }
.bng-also { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.bng-also > li { max-width: none; }
.btn-sm { min-height: 36px; padding: 0.375rem 0.75rem; }

.bng-actor { display: inline-block; border-radius: var(--bng-radius-pill); padding: 0 8px; font-size: 0.8125rem; font-weight: 700; line-height: 1.6; white-space: nowrap; }
.bng-actor-you { background: var(--bng-green-text); color: var(--bng-on-dark); }
.bng-actor-other, .bng-actor-bng { background: var(--bng-info-tint); color: #144c73; border: 1px solid #1d5f8f; }
.bng-actor-done { background: var(--bng-green-tint); color: #135c33; }
.bng-actor-later { background: var(--bng-soft); color: var(--bng-muted); border: 1px solid var(--bng-line); }
/* The "Now" card shares the actor classes for its colour; it keeps the ink colour for its text. */
.bng-now.bng-actor-you, .bng-now.bng-actor-other, .bng-now.bng-actor-bng { color: var(--bng-ink); border-style: solid; }
/* Solid tints, so the sticky action bar on a phone can take the card's colour (no white strip, nothing showing through). */
.bng-now.bng-actor-you { background: #e6f5ea; }
.bng-now.bng-actor-other, .bng-now.bng-actor-bng { background: #eaf3fb; }
.bng-now .bng-sticky-action { background: inherit; }
/* Walk review P13b: at the narrowest widths the card's text wraps long enough for a stuck button to sit over it. */
@media (max-width: 359.98px) { .bng-now .bng-sticky-action { position: static; box-shadow: none; } }
.bng-row-link, .bng-setup .bng-task-name { display: inline-flex; align-items: center; min-height: 44px; }

.bng-phase { border: 1px solid var(--bng-line); border-radius: var(--bng-radius); background: var(--bng-surface); margin-bottom: 8px; scroll-margin-top: 72px; }
.bng-phase > summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; padding: 10px 16px; min-height: 44px; }
.bng-phase-name { font-weight: 800; }
.bng-phase-summary { color: var(--bng-muted); font-size: 0.9375rem; flex: 1 1 200px; min-width: 0; overflow-wrap: anywhere; }
.bng-phase-done .bng-phase-summary { color: #135c33; }
.bng-phase .bng-tasks { border-top: 1px solid var(--bng-line); margin: 0 16px 6px; padding-left: 4px; }
.bng-step { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--bng-line); position: relative; }
.bng-step:last-child { border-bottom: 0; }
.bng-step > div { min-width: 0; overflow-wrap: anywhere; }
.bng-step-head { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.bng-step-icon { width: 18px; height: 18px; margin-top: 4px; border-radius: 50%; border: 2px solid var(--bng-muted); background: var(--bng-surface); }
.bng-step-done .bng-step-icon { border-color: var(--bng-green); background: var(--bng-green); box-shadow: inset 0 0 0 3px var(--bng-surface); }
.bng-step-open .bng-step-icon { border-color: var(--bng-green-text); border-width: 4px; }
.bng-step-open:has(.bng-actor-other) .bng-step-icon, .bng-step-open:has(.bng-actor-bng) .bng-step-icon { border-color: #1d5f8f; }
.bng-step-later .bng-step-icon { border-style: dashed; }
.bng-step-later .bng-task-name { color: var(--bng-muted); }

.bng-options { border-top: 1px solid var(--bng-line); padding-top: 8px; }
.bng-options > summary { cursor: pointer; font-weight: 700; color: var(--bng-muted); min-height: 44px; display: flex; align-items: center; }
.bng-options-list { list-style: none; padding: 0; margin: 4px 0 0; }
.bng-options-list > li { margin-bottom: 8px; }
.bng-link-danger { color: var(--bng-danger); font-weight: 600; }
.bng-link-danger:hover { color: var(--bng-danger); }
.bng-quiet-summary { cursor: pointer; color: var(--bng-green-text); text-decoration: underline; font-weight: 600; min-height: 44px; display: flex; align-items: center; }

.bng-stack { display: block; width: 100%; height: 14px; border-radius: 4px; overflow: hidden; }
.bng-stack-rest { fill: var(--bng-soft); stroke: var(--bng-line); stroke-width: 0.4; }
.bng-stack-allocated { fill: var(--bng-green-text); background: var(--bng-green-text); }
.bng-stack-deal { fill: #4a9be0; background: #4a9be0; }
.bng-stack-held { fill: #d99a1e; background: #d99a1e; }
.bng-stack-legend { list-style: none; padding: 0; margin: 6px 0 0; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 0.875rem; color: var(--bng-muted); }
.bng-stack-legend > li { display: inline-flex; align-items: center; gap: 6px; }
.bng-stack-key { width: 12px; height: 12px; border-radius: 2px; border: 1px solid var(--bng-line); flex: none; }
.bng-stack-key.bng-stack-rest { background: var(--bng-soft); }

/* Habitat bank overview and project page (plan 2026-10-30 C4, D6): leaf tiles and quiet tool cards. */
.bng-leaf-tiles { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: 8px; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.bng-leaf-tiles > li { max-width: none; min-width: 0; display: grid; gap: 4px; align-content: start; background: var(--bng-surface); border: 1px solid var(--bng-line); border-radius: var(--bng-radius); padding: 10px 12px; overflow-wrap: anywhere; }
.bng-leaf-tile-next { font-size: 0.875rem; color: var(--bng-muted); }
@media (max-width: 991.98px) { .bng-leaf-tiles { grid-template-columns: minmax(0, 1fr); } }
.bng-tools { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); }
.bng-tools > .bng-card { min-width: 0; }
