/* ============================================================
   LAHMP Wizard — styles.css
   IUCN brand · IBM Plex · Professional editorial aesthetic
   ============================================================ */

/* ── Tokens ─────────────────────────────────────────────────────────── */
:root {
  --navy:        #003478;
  --navy-dark:   #002255;
  --navy-light:  #e8eef7;
  --yellow:      #FDC82F;
  --yellow-dark: #c9a000;
  --green:       #1A7A52;
  --green-light: #e6f4ed;
  --amber:       #c97a00;
  --amber-light: #fff4e0;
  --red:         #c0392b;
  --red-light:   #fdecea;
  --grey-100:    #f5f6f8;
  --grey-200:    #e8eaed;
  --grey-300:    #d1d5db;
  --grey-500:    #6b7280;
  --grey-700:    #374151;
  --grey-900:    #111827;
  --white:       #ffffff;

  --font-sans:  'IBM Plex Sans', system-ui, sans-serif;
  --font-serif: 'IBM Plex Serif', Georgia, serif;
  --font-mono:  'IBM Plex Mono', 'Courier New', monospace;

  --radius-sm: 3px;
  --radius:    6px;
  --radius-lg: 10px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow:    0 2px 8px rgba(0,0,0,.10);
  --shadow-lg: 0 4px 20px rgba(0,0,0,.12);

  --transition: 150ms ease;
  --container: 900px;
}

/* ── Reset ───────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  color: var(--grey-900);
  background: var(--grey-100);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
img { max-width: 100%; display: block; }
input, textarea, select, button { font: inherit; }
button { cursor: pointer; border: none; background: none; }

/* ── Layout ──────────────────────────────────────────────────────────── */
.container {
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Header ──────────────────────────────────────────────────────────── */
.site-header {
  background: var(--navy);
  color: var(--white);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.header-brand { display: flex; align-items: center; gap: 14px; }
.iucn-mark {
  max-width: 80px;
  width: auto;
  height: auto;
  display: block;
}
.brand-text { display: flex; flex-direction: column; gap: 1px; }
.brand-name {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--white);
  line-height: 1.2;
}
.brand-sub { font-size: .72rem; color: rgba(255,255,255,.65); }
.header-meta { font-size: .82rem; color: rgba(255,255,255,.8); max-width: 240px; text-overflow: ellipsis; overflow: hidden; white-space: nowrap; }

/* ── Step progress bar ───────────────────────────────────────────────── */
.step-nav {
  background: var(--white);
  border-bottom: 1px solid var(--grey-200);
  padding: 0;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.step-nav .container { padding-top: 0; padding-bottom: 0; }

.progress-bar-wrap {
  display: flex;
  align-items: flex-start;
  padding: 14px 0 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

/* Step node */
.pb-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 72px;
  flex: 0 0 auto;
  text-align: center;
  user-select: none;
  padding: 4px 6px;
  cursor: default;
  border-radius: var(--radius);
  outline: none;
}
.pb-step.is-clickable { cursor: pointer; }
.pb-step.is-clickable:hover .pb-node,
.pb-step.is-clickable:focus-visible .pb-node {
  box-shadow: 0 0 0 4px rgba(0,52,120,.12);
}
.pb-step:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.pb-node {
  width: 32px; height: 32px;
  border-radius: 50%;
  border: 2px solid var(--grey-300);
  background: var(--white);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  position: relative;
  transition: background var(--transition), border-color var(--transition), box-shadow var(--transition);
}
.pb-num {
  font-size: .78rem;
  font-weight: 700;
  color: var(--grey-400);
  line-height: 1;
}

.pb-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--grey-500);
  line-height: 1.3;
  white-space: nowrap;
}
.pb-sublabel {
  font-size: .67rem;
  color: var(--grey-400);
  line-height: 1.2;
  white-space: nowrap;
}

/* Connector */
.pb-connector {
  flex: 1;
  height: 0;
  border-top: 2px dashed var(--grey-300);
  margin-top: 21px; /* aligns with centre of 32px node + 4px step padding */
  min-width: 12px;
  transition: border-color var(--transition), border-style var(--transition);
}
.pb-connector.is-done {
  border-top: 2px solid var(--navy);
}

/* Active (current) step */
.pb-step.is-active .pb-node {
  background: var(--yellow);
  border-color: var(--yellow);
  box-shadow: 0 0 0 3px rgba(253,200,47,.28);
}
.pb-step.is-active .pb-num   { color: var(--navy-dark); }
.pb-step.is-active .pb-label { color: var(--navy); font-weight: 700; }
.pb-step.is-active .pb-sublabel { color: var(--navy); }

/* Done (completed) step */
.pb-step.is-done .pb-num { display: none; }
.pb-step.is-done .pb-node {
  background: var(--navy);
  border-color: var(--navy);
}
.pb-step.is-done .pb-node::after {
  content: '✓';
  font-size: .78rem;
  font-weight: 700;
  color: var(--white);
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
}
.pb-step.is-done .pb-label   { color: var(--navy); }
.pb-step.is-done .pb-sublabel { color: var(--grey-500); }

/* ── Main ────────────────────────────────────────────────────────────── */
.wizard-main { flex: 1; padding: 32px 0 120px; }
.wizard-step { animation: fadeIn .2s ease; }
.wizard-step.is-hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Step intro ──────────────────────────────────────────────────────── */
.step-intro { margin-bottom: 28px; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: .72rem;
  font-weight: 500;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--navy);
  margin-bottom: 6px;
}
.step-intro h1 {
  font-family: var(--font-serif);
  font-size: 1.75rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 8px;
}
.lead { font-size: .95rem; color: var(--grey-700); max-width: 640px; }

/* ── Blocks ──────────────────────────────────────────────────────────── */
.blocks-container { display: flex; flex-direction: column; gap: 12px; }
.block {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.block-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  text-align: left;
  background: none;
  border-bottom: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}
.block-header:hover { background: var(--grey-100); }
.block-header[aria-expanded="true"] { border-bottom-color: var(--grey-200); }
.block-header.just-updated { animation: blockFlash .9s ease forwards; }
@keyframes blockFlash {
  0%   { background: #e8f5ee; }
  60%  { background: #e8f5ee; }
  100% { background: transparent; }
}
.block-title-wrap { flex: 1; }
.block-title {
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.3;
}
.block-subtitle { font-size: .78rem; color: var(--grey-500); margin-top: 2px; }
.chevron {
  width: 16px; height: 16px;
  color: var(--grey-500);
  flex-shrink: 0;
  transition: transform var(--transition);
}
.block-header[aria-expanded="false"] .chevron { transform: rotate(-90deg); }
.block-body { padding: 20px; }
.block-desc { font-size: .88rem; color: var(--grey-700); margin-bottom: 16px; line-height: 1.5; }

/* ── Form elements ───────────────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.form-field, .form-field-full { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.form-field-full { margin-bottom: 16px; }
label { font-size: .83rem; font-weight: 500; color: var(--grey-700); }
.req { color: var(--red); }
input[type="text"],
input[type="number"],
input[type="email"],
textarea,
select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  font-size: .88rem;
  color: var(--grey-900);
  background: var(--white);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(0,52,120,.12);
}
textarea { resize: vertical; min-height: 80px; }
.field-hint { font-size: .78rem; color: var(--grey-500); margin-bottom: 8px; line-height: 1.4; }

/* ── Check grid ──────────────────────────────────────────────────────── */
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
}
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  font-size: .83rem;
  cursor: pointer;
  transition: all var(--transition);
  line-height: 1.35;
}
.check-item input { flex-shrink: 0; margin-top: 2px; accent-color: var(--navy); }
.check-item:hover  { border-color: var(--navy); background: var(--navy-light); }
.check-item.is-checked { border-color: var(--navy); background: var(--navy-light); font-weight: 500; }

/* ── Radio pills ─────────────────────────────────────────────────────── */
.radio-group { display: flex; flex-wrap: wrap; gap: 6px; }
.radio-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid var(--grey-300);
  border-radius: 20px;
  font-size: .83rem;
  cursor: pointer;
  transition: all var(--transition);
}
.radio-pill input[type="radio"] { accent-color: var(--navy); }
.radio-pill:hover    { border-color: var(--navy); background: var(--navy-light); }
.radio-pill.is-checked { border-color: var(--navy); background: var(--navy); color: var(--white); }
.radio-pill.is-checked input { accent-color: var(--white); }

/* ── Tag input ───────────────────────────────────────────────────────── */
.form-subsection { margin-bottom: 20px; }
.subsection-title { font-size: .88rem; font-weight: 600; color: var(--grey-700); margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--grey-200); }
.tag-input-wrap { display: flex; flex-direction: column; gap: 8px; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 10px;
  background: var(--navy-light);
  border: 1px solid var(--navy);
  border-radius: 20px;
  font-size: .8rem;
  font-weight: 500;
  color: var(--navy);
}
.tag-remove { color: var(--navy); opacity: .6; font-size: 1rem; line-height: 1; }
.tag-remove:hover { opacity: 1; }
.tag-add-row { display: flex; gap: 8px; }
.tag-input { flex: 1; }

/* ── Composition table ───────────────────────────────────────────────── */
.comp-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.comp-table th { padding: 7px 10px; background: var(--grey-100); font-weight: 600; text-align: left; border-bottom: 2px solid var(--grey-200); }
.comp-table td { padding: 6px 10px; border-bottom: 1px solid var(--grey-200); }
.comp-input { width: 100px; text-align: right; padding: 4px 8px; }
.comp-total { text-align: right; font-size: .82rem; color: var(--grey-500); margin-top: 6px; }
.comp-total.is-over span     { color: var(--red);    font-weight: 600; }
.comp-total.is-complete span { color: var(--green);  font-weight: 600; }
.comp-total.is-under span    { color: var(--amber);  font-weight: 600; }
.comp-hint { color: var(--amber); }

/* ── Pressure list ───────────────────────────────────────────────────── */
.pressure-list { display: flex; flex-direction: column; gap: 2px; }
.pressure-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  transition: background var(--transition), border-color var(--transition);
}
.pressure-row:hover { background: var(--grey-100); }
.pressure-row.is-flagged { background: var(--amber-light); border-color: rgba(201,122,0,.2); }
.pressure-name { display: flex; align-items: flex-start; gap: 8px; font-size: .85rem; flex: 1; min-width: 0; }
.pressure-id { font-family: var(--font-mono); font-size: .72rem; font-weight: 500; color: var(--grey-500); flex-shrink: 0; margin-top: 2px; }
.pressure-radios { display: flex; gap: 4px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }
.pressure-radio {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border: 1px solid var(--grey-300);
  border-radius: 14px;
  font-size: .75rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
}
.pressure-radio input { display: none; }
.pressure-radio:hover   { border-color: var(--navy); }
.pressure-radio.is-active { background: var(--navy); color: var(--white); border-color: var(--navy); }
.pressure-row.is-flagged .pressure-radio.is-active { background: var(--amber); border-color: var(--amber); }
/* ── Practice score breakdown ────────────────────────────────────────── */
.score-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 6px 12px 8px;
  border-top: 1px solid var(--grey-200);
}
.breakdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: .72rem;
  font-weight: 500;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  cursor: default;
}
.breakdown-chip .chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.chip-pressure  { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
.chip-challenge { background: #FEE2E2; color: #7F1D1D; border: 1px solid #FECACA; }
.chip-service   { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }

.pressure-row--other { flex-direction: column; gap: 6px; }
.pressure-row-main { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; width: 100%; }
.pressure-other-text {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--grey-300);
  border-radius: var(--radius);
  font-family: var(--font-sans);
  font-size: .85rem;
  color: var(--navy);
  background: var(--white);
  transition: border-color var(--transition);
  box-sizing: border-box;
}
.pressure-other-text:focus { outline: none; border-color: var(--navy); }
.pressure-other-text.is-hidden { display: none; }

/* ── Challenge list ──────────────────────────────────────────────────── */
.challenge-list { display: flex; flex-direction: column; gap: 3px; }
.challenge-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--grey-200);
  font-size: .85rem;
  transition: all var(--transition);
}
.challenge-row.is-prepopulated { border-color: rgba(0,52,120,.15); }
.challenge-row.is-confirmed    { background: var(--green-light); border-color: rgba(26,122,82,.25); }
.challenge-row.is-inactive     { opacity: .6; }
.challenge-row.is-inactive:hover { opacity: 1; }
.challenge-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; flex: 1; }
.challenge-check input { margin-top: 3px; flex-shrink: 0; accent-color: var(--green); }
.challenge-name { line-height: 1.35; }
.challenge-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-shrink: 0; }
.challenge-group { font-size: .75rem; }

/* ── Service list ────────────────────────────────────────────────────── */
.service-list { display: flex; flex-direction: column; gap: 3px; }
.service-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--grey-200);
  font-size: .85rem;
  transition: all var(--transition);
}
.service-row.is-selected { background: var(--navy-light); border-color: rgba(0,52,120,.2); }
.service-check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; flex: 1; }
.service-check input { margin-top: 3px; flex-shrink: 0; accent-color: var(--navy); }
.service-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.priority-label { display: flex; align-items: center; gap: 5px; font-size: .78rem; font-weight: 500; }
.priority-label.is-hidden { display: none; }
.priority-select { padding: 2px 6px; font-size: .78rem; width: 60px; }

/* ── Tooltips ────────────────────────────────────────────────────────── */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}
.tooltip-icon {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--navy-light);
  color: var(--navy);
  font-style: normal;
  font-size: .62rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  margin-left: 4px;
  flex-shrink: 0;
  user-select: none;
  line-height: 1;
  transition: background var(--transition);
}
.tooltip-wrap:hover .tooltip-icon,
.tooltip-wrap:focus-visible .tooltip-icon,
.tooltip-wrap.is-open .tooltip-icon { background: var(--navy); color: var(--white); }

.tooltip-box {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--white);
  border: 1px solid var(--navy);
  border-radius: var(--radius);
  padding: 8px 12px;
  max-width: 280px;
  min-width: 160px;
  font-size: .78rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.5;
  color: var(--grey-900);
  z-index: 500;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s ease;
  box-shadow: var(--shadow);
  text-align: left;
  font-family: var(--font-sans);
}
/* downward-pointing triangle */
.tooltip-box::after {
  content: '';
  position: absolute;
  top: 100%; left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--navy);
}

.tooltip-wrap:hover .tooltip-box,
.tooltip-wrap:focus-visible .tooltip-box,
.tooltip-wrap.is-open .tooltip-box { opacity: 1; }

/* Ensure badges containing tooltips display correctly */
.badge .tooltip-wrap { vertical-align: middle; }
.badge .tooltip-icon { margin-left: 3px; }

/* ── Badges ──────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .04em;
  padding: 2px 7px;
  border-radius: 3px;
  white-space: nowrap;
  text-transform: uppercase;
}
.badge-conf-high    { background: var(--green-light);  color: var(--green); }
.badge-conf-medium  { background: var(--amber-light);  color: var(--amber); }
.badge-conf-low     { background: var(--grey-200);     color: var(--grey-500); }
.badge-prepop       { background: var(--navy-light);   color: var(--navy); }
.badge-standard     { background: var(--navy-light);   color: var(--navy); }
.badge-transformative { background: var(--green-light); color: var(--green); }
.badge-inclusion    { background: var(--grey-200);     color: var(--grey-700); }
.badge-baseline     { background: var(--yellow);       color: var(--navy-dark); }
.badge-warn         { background: #fff3cd;             color: #856404; font-size: 0.7rem; }
.level-badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-family: var(--font-mono); font-size: .72rem; font-weight: 600;
}
.level-1 { background: var(--grey-200); color: var(--grey-700); }
.level-2 { background: var(--navy-light); color: var(--navy); }
.level-3 { background: var(--navy); color: var(--white); }

.text-muted { color: var(--grey-500); font-size: .78rem; }
.trim-reason   { font-size: .8rem; color: var(--grey-700); max-width: 340px; }
.stage-cell    { font-size: .78rem; color: var(--grey-700); white-space: nowrap; }
.expected-cell { font-size: .78rem; color: var(--grey-700); max-width: 220px; }
.ref-link  { font-size: .72rem; color: var(--navy); text-decoration: underline dotted; }
.ref-link:hover { text-decoration: underline; }
.ref-plain { font-size: .72rem; color: var(--grey-500); cursor: default; }

/* ── Abiotic precursor tags ─────────────────────────────────────────── */
.abiotic-precursors { margin-top: 4px; font-size: .7rem; color: var(--grey-500); display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.precursor-tag { background: var(--grey-100); border: 1px solid var(--grey-200); border-radius: 3px; padding: 0 4px; font-family: var(--font-mono); font-size: .67rem; color: var(--grey-700); white-space: nowrap; }

/* ── Equipment details in biological table ──────────────────────────── */
.eq-details { margin-top: 4px; }
.eq-details summary { font-size: .7rem; color: var(--navy); cursor: pointer; user-select: none; list-style: none; }
.eq-details summary::-webkit-details-marker { display: none; }
.eq-list { margin: 4px 0 0 12px; padding: 0; font-size: .72rem; color: var(--grey-700); line-height: 1.6; }

/* ── Phase badge (abiotic table) ────────────────────────────────────── */
.phase-badge { font-family: var(--font-mono); font-size: .7rem; font-weight: 600; padding: 2px 7px; border-radius: var(--radius-sm); white-space: nowrap; }
.phase-y1      { background: var(--yellow);      color: var(--navy-dark); }
.phase-ongoing { background: var(--grey-200);     color: var(--grey-700); }
.abiotic-measures { font-size: .72rem; color: var(--grey-500); margin-top: 3px; line-height: 1.35; }
.interp-note { font-size: .75rem; color: var(--grey-700); line-height: 1.5; padding: 4px 0 2px; margin: 0; }
.unlock-hint { font-size: .78rem; color: var(--green); max-width: 240px; }
.badge-scale { background: var(--grey-100); color: var(--grey-700); border: 1px solid var(--grey-300); font-size: .68rem; }
.guidance-tape h4 { color: var(--amber); }
.guidance-approach h4 { color: var(--navy); }
.approach-badges-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.approach-group { display: flex; flex-wrap: wrap; gap: 3px; }
.approach-badge {
  font-family: var(--font-mono);
  font-size: .72rem;
  background: #eef3fb;
  border: 1px solid #c5d6ee;
  border-radius: 3px;
  padding: 1px 6px;
  color: var(--navy);
  cursor: default;
  white-space: nowrap;
}
.approach-badge:hover { background: #d8e8f7; border-color: var(--navy); }

/* ── Advisory notice (draft/unvalidated warning) ────────────────────── */
.advisory-notice { background: #fffbe6; border: 1px solid var(--yellow); border-radius: 6px; padding: 10px 14px; font-size: .82rem; color: var(--grey-800); margin-bottom: 14px; line-height: 1.5; }

/* ── Inline warnings (step incomplete) ─────────────────────────────── */
.warnings-block { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.inline-warning {
  background: #fff8f0;
  border: 1px solid #f5a623;
  border-left: 4px solid #f5a623;
  border-radius: 4px;
  padding: 9px 14px;
  font-size: .82rem;
  color: var(--grey-800);
  line-height: 1.5;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.btn-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--navy);
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}
.btn-link:hover { color: var(--navy-light); }

/* ── Empty plan state ───────────────────────────────────────────────── */
.empty-plan-state {
  text-align: center;
  padding: 40px 32px !important;
}
.empty-plan-state h2 {
  font-family: var(--font-serif);
  color: var(--navy);
  margin-bottom: 10px;
}
.empty-plan-state p { color: var(--grey-600); margin-bottom: 20px; }
.empty-plan-checklist {
  list-style: none;
  padding: 0;
  margin: 0 auto 24px;
  max-width: 480px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.empty-plan-checklist li {
  padding: 8px 12px 8px 36px;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: 4px;
  font-size: .88rem;
  color: var(--grey-700);
  position: relative;
}
.empty-plan-checklist li::before {
  content: '○';
  position: absolute;
  left: 12px;
  color: var(--grey-400);
}
.empty-plan-checklist li.done {
  background: #f0faf5;
  border-color: #a8d5bc;
  color: var(--grey-800);
}
.empty-plan-checklist li.done::before {
  content: '✓';
  color: var(--green);
  font-weight: 700;
}

/* ── Monitoring role label under indicator name ─────────────────────── */
.monitoring-role { font-size: .7rem; color: var(--grey-500); font-style: italic; margin-top: 2px; line-height: 1.3; }

/* ── Connected indicator groups ─────────────────────────────────────── */
.connected-groups { margin-top: 4px; font-size: .7rem; color: var(--grey-500); display: flex; flex-wrap: wrap; gap: 3px; align-items: center; }
.connected-tag { background: #eef3fb; border: 1px solid #c5d6ee; border-radius: 3px; padding: 0 4px; font-size: .67rem; color: var(--navy); white-space: nowrap; }

/* ── Pre-screen ──────────────────────────────────────────────────────── */
.prescreen-question { margin-bottom: 20px; padding-bottom: 20px; border-bottom: 1px solid var(--grey-200); }
.prescreen-question:last-child { border-bottom: none; margin-bottom: 0; }
.prescreen-label { font-size: .9rem; font-weight: 500; color: var(--grey-900); margin-bottom: 10px; }

/* ── Practice cards ──────────────────────────────────────────────────── */
.practice-summary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--navy-light);
  border: 1px solid rgba(0,52,120,.2);
  border-radius: var(--radius);
  padding: 6px 14px;
  font-size: .85rem;
  margin-bottom: 14px;
}
.psum-num {
  font-family: var(--font-mono);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--navy);
}
.theme-group { margin-bottom: 24px; }
.theme-header { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 2px solid var(--navy-light); }
.theme-title { font-family: var(--font-serif); font-size: 1rem; font-weight: 600; color: var(--navy); }
.chain-label { font-family: var(--font-mono); font-size: .7rem; color: var(--grey-500); }
.practice-cards { display: flex; flex-direction: column; gap: 6px; }
.practice-card {
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  transition: all var(--transition);
  overflow: hidden;
}
.practice-card:hover { border-color: var(--navy); box-shadow: var(--shadow-sm); }
.practice-card.is-selected { border-color: var(--navy); background: var(--navy-light); }
.practice-check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; cursor: pointer; }
.practice-check > input[type="checkbox"] { margin-top: 4px; flex-shrink: 0; accent-color: var(--navy); transform: scale(1.15); }
.practice-card-body { flex: 1; min-width: 0; }
.practice-card-header { display: flex; align-items: flex-start; gap: 8px; flex-wrap: wrap; margin-bottom: 5px; }
.practice-code { font-family: var(--font-mono); font-size: .72rem; font-weight: 500; color: var(--grey-500); flex-shrink: 0; margin-top: 2px; }
.practice-name { font-size: .9rem; font-weight: 600; flex: 1; }
.practice-badges { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }
.practice-score { font-family: var(--font-mono); font-size: .72rem; color: var(--green); cursor: default; }
.practice-rationale { font-size: .8rem; color: var(--grey-700); line-height: 1.45; }
.empty-state { color: var(--grey-500); font-size: .88rem; padding: 12px 0; }

/* ── Practice field guidance (expandable) ───────────────────────────── */
.practice-field-guidance {
  border-top: 1px solid var(--grey-200);
  margin: 0;
}
.practice-card.is-selected .practice-field-guidance { border-color: rgba(0,52,120,.2); }
.guidance-summary {
  font-size: .75rem;
  font-weight: 600;
  color: var(--navy);
  padding: 7px 14px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.guidance-summary::-webkit-details-marker { display: none; }
.practice-field-guidance[open] .guidance-summary { color: var(--navy-dark); }
.guidance-body { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.guidance-section h4 { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--grey-500); margin-bottom: 4px; }
.guidance-section p { font-size: .78rem; color: var(--grey-700); line-height: 1.5; white-space: pre-wrap; }
.guidance-correct  h4 { color: var(--green); }
.guidance-incorrect h4 { color: var(--red); }

/* ── Capacity ────────────────────────────────────────────────────────── */
.cap-section { display: flex; flex-direction: column; gap: 0; }
.cap-q { font-size: .9rem; font-weight: 600; color: var(--grey-900); margin: 20px 0 10px; }
.cap-q:first-child { margin-top: 0; }
.cap-equip-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 6px; margin-top: 8px; }
.team-rows { display: flex; flex-direction: column; gap: 6px; }
.team-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.team-row + .team-row { border-top: 1px solid var(--grey-200); }
.team-check { display: flex; align-items: center; gap: 8px; cursor: pointer; flex: 1; font-size: .95rem; min-width: 0; }
.team-check input[type="checkbox"] { accent-color: var(--navy); width: auto; flex-shrink: 0; }
.team-type-code { font-family: var(--font-mono); font-size: .8rem; font-weight: 600; background: var(--navy); color: var(--white); padding: 2px 7px; border-radius: var(--radius-sm); flex-shrink: 0; }
.team-row.is-active .team-type-code { background: var(--green); }
.team-type-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.team-row input[type="number"].team-count { width: 56px; text-align: center; flex-shrink: 0; padding: 6px 8px; }
.days-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.days-table th { padding: 7px 10px; background: var(--grey-100); font-weight: 600; border-bottom: 2px solid var(--grey-200); text-align: left; }
.days-table td { padding: 6px 10px; border-bottom: 1px solid var(--grey-200); }
.empty-row { color: var(--grey-500); font-style: italic; }
#recruit-roles-wrap { margin-top: 10px; }
#recruit-roles-wrap.is-hidden { display: none; }

/* ── Calendar ────────────────────────────────────────────────────────── */
.cal-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
  margin-top: 8px;
}
.cal-month {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  background: var(--grey-100);
}
.cal-month-name { font-size: .72rem; font-weight: 600; color: var(--grey-700); margin-bottom: 4px; }
.cal-access {
  font-size: .68rem;
  padding: 2px 6px;
  border-radius: 10px;
  border: 1px solid var(--grey-300);
  cursor: pointer;
  white-space: nowrap;
  transition: all var(--transition);
  width: 100%;
  text-align: center;
}
.cal-access input { display: none; }
.cal-accessible.is-active  { background: var(--green); color: var(--white); border-color: var(--green); }
.cal-constrained.is-active { background: var(--amber); color: var(--white); border-color: var(--amber); }
.cal-unknown.is-active     { background: var(--grey-500); color: var(--white); border-color: var(--grey-500); }

/* ── Step 4 output ───────────────────────────────────────────────────── */

/* Summary panel */
.output-summary-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: stretch;
  background: var(--navy);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  margin-bottom: 16px;
  color: var(--white);
}
.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.1);
  border-radius: var(--radius);
  padding: 12px 20px;
  min-width: 80px;
}
.stat-num {
  font-family: var(--font-mono);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--yellow);
}
.stat-label {
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-top: 4px;
  color: rgba(255,255,255,.75);
  text-align: center;
}
.summary-meta {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  margin-left: auto;
  padding-left: 16px;
  border-left: 1px solid rgba(255,255,255,.2);
  font-size: .8rem;
  color: rgba(255,255,255,.8);
}
@media (max-width: 640px) {
  .summary-meta { margin-left: 0; padding-left: 0; border-left: none; border-top: 1px solid rgba(255,255,255,.2); padding-top: 10px; }
}

.output-actions {
  display: flex;
  gap: 10px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}
.output-section {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.section-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--grey-200);
}
.narrative-header { margin-bottom: 16px; }
.narrative-header h2 { font-family: var(--font-serif); font-size: 1.25rem; font-weight: 600; color: var(--navy); margin-bottom: 4px; }
.narrative-for { font-size: .85rem; color: var(--grey-500); }
.narrative-paras p { font-size: .9rem; line-height: 1.65; margin-bottom: 12px; }
.narrative-paras p:last-child { margin-bottom: 0; }
.landscape-desc {
  border-left: 3px solid var(--navy-light);
  margin: 0 0 16px;
  padding: 8px 14px;
  font-size: .88rem;
  color: var(--grey-700);
  font-style: italic;
  line-height: 1.55;
}
.chain-group { margin-bottom: 16px; }
.chain-group-title { font-size: .88rem; font-weight: 600; color: var(--navy); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.chain-group-title::before { content: ''; display: inline-block; width: 3px; height: 14px; background: var(--navy); border-radius: 2px; }
.chain-practices { display: flex; flex-direction: column; gap: 4px; }
.chain-practice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--grey-100);
  border-radius: var(--radius);
  font-size: .83rem;
}
.table-scroll { overflow-x: auto; }
.output-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
}
.output-table th {
  padding: 8px 10px;
  background: var(--grey-100);
  font-weight: 600;
  font-size: .78rem;
  text-align: left;
  border-bottom: 2px solid var(--grey-200);
  color: var(--grey-700);
}
.output-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--grey-200);
  vertical-align: top;
}
.output-table tr:last-child td { border-bottom: none; }
.metric-cell { font-family: var(--font-mono); font-size: .75rem; color: var(--grey-700); }

/* ── Biological monitoring cards ─────────────────────────────────────── */
.bio-cards { display: flex; flex-direction: column; gap: 10px; }

.bio-card {
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  overflow: hidden;
  break-inside: avoid;
}

.bio-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--grey-50);
  border-bottom: 1px solid var(--grey-200);
}

.bio-card-title-wrap { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.bio-card-name  { font-weight: 600; font-size: .9rem; color: var(--navy); line-height: 1.3; }
.bio-card-category { font-size: .75rem; color: var(--grey-500); }

.bio-card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  flex-shrink: 0;
}

.bio-card-body {
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.bio-field-row { display: flex; flex-direction: column; gap: 2px; }
.bio-field-label {
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--grey-500);
}
.bio-field-value { font-size: .82rem; color: var(--grey-800); line-height: 1.45; }

.bio-signal-details { margin-top: 2px; }
.bio-signal-summary {
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--grey-500);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 5px;
  user-select: none;
}
.bio-signal-summary::before { content: '▸'; font-size: .6rem; transition: transform .15s; }
.bio-signal-details[open] .bio-signal-summary::before { transform: rotate(90deg); }
.bio-signal-text {
  margin: 6px 0 0;
  font-size: .78rem;
  color: var(--grey-700);
  line-height: 1.55;
  white-space: pre-wrap;
}

.badge-stage {
  background: #eef3fb;
  color: var(--navy);
  border: 1px solid #c5d6ee;
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

/* ── Bio section grouping (A/B/C/D collapsible sections) ──────────────── */
.bio-section {
  margin-bottom: 10px;
  border-radius: 6px;
  overflow: hidden;
}

.bio-section-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--grey-50);
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.bio-section[open] .bio-section-toggle {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}
.bio-section-toggle::-webkit-details-marker { display: none; }
.bio-section-label {
  font-size: .88rem;
  font-weight: 600;
  color: var(--navy);
}
.bio-section-count {
  font-family: var(--font-mono);
  font-weight: 400;
  color: var(--grey-500);
  font-size: .8rem;
}
.bio-section-desc {
  font-size: .75rem;
  color: var(--grey-500);
  text-align: right;
  flex: 1;
}
.bio-section-toggle::after {
  content: '▾';
  font-size: .72rem;
  color: var(--grey-500);
  transition: transform .15s;
  flex-shrink: 0;
}
.bio-section:not([open]) .bio-section-toggle::after {
  transform: rotate(-90deg);
}

.bio-section-body {
  border: 1px solid var(--grey-200);
  border-top: none;
  border-bottom-left-radius: 6px;
  border-bottom-right-radius: 6px;
  padding: 12px;
  background: var(--white);
}

/* ── Bio summary sentence ─────────────────────────────────────────────── */
.bio-summary-sentence {
  font-size: .88rem;
  color: var(--grey-700);
  margin-bottom: 14px;
  padding: 10px 14px;
  background: var(--navy-light);
  border-radius: 6px;
  border-left: 3px solid var(--navy);
  line-height: 1.5;
}
.bio-pending-note {
  color: var(--grey-500);
  font-style: italic;
}

/* ── Bio table (fixed layout for predictable column widths) ──────────── */
.bio-table { table-layout: fixed; }
.bio-table td { overflow-wrap: break-word; }

/* ── Bio table row states ─────────────────────────────────────────────── */
.bio-row-pending { opacity: 0.65; }
.bio-row-draft td { background: #fffdf0; }
.bio-row-draft td:first-child { border-left: 3px solid #f0c04a; }
.protocol-pending-inline { font-size: .82rem; color: var(--grey-600); font-style: italic; }
.bio-row-tags { margin-top: 4px; font-size: .75rem; color: var(--grey-600); }

/* ── Pending bio cards ────────────────────────────────────────────────── */
.bio-card-pending {
  opacity: 0.65;
  border-color: var(--grey-300);
}
.bio-card-pending .bio-card-header {
  background: var(--grey-100);
  border-bottom-color: var(--grey-300);
}
.bio-card-pending .bio-card-name { color: var(--grey-600); }

.badge-pending {
  background: var(--grey-200);
  color: var(--grey-600);
  font-style: italic;
  font-size: .68rem;
  padding: 2px 6px;
  border-radius: 3px;
  text-transform: none;
  letter-spacing: 0;
}

.protocol-pending-notice {
  font-size: .82rem;
  color: var(--grey-600);
  font-style: italic;
  padding: 8px 12px;
  background: var(--grey-100);
  border-left: 3px solid var(--grey-300);
  border-radius: 0 4px 4px 0;
  line-height: 1.5;
}

/* ── Draft bio cards (amber — protocol proposed, awaiting validation) ─── */
.bio-card-draft {
  border-color: #f0c04a;
}
.bio-card-draft .bio-card-header {
  background: #fffbee;
  border-bottom-color: #f0c04a;
}

.badge-draft {
  background: #fff3cd;
  color: #856404;
  border: 1px solid #f0c04a;
  font-size: .68rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}

.protocol-draft-notice {
  font-size: .78rem;
  color: #856404;
  font-style: italic;
  padding: 7px 10px;
  background: #fffbee;
  border-left: 3px solid #f0c04a;
  border-radius: 0 4px 4px 0;
  line-height: 1.5;
  margin-bottom: 4px;
}

@media print {
  /* bio-card and bio-section print rules are consolidated in the main @media print block below */
  .bio-signal-details[open] .bio-signal-text,
  .bio-signal-details .bio-signal-text { display: block !important; }
}

/* ── Footer ──────────────────────────────────────────────────────────── */
.wizard-footer {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--white);
  border-top: 1px solid var(--grey-200);
  padding: 12px 0;
  z-index: 99;
  box-shadow: 0 -2px 12px rgba(0,0,0,.06);
}
.wizard-footer .container { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.autosave { font-size: .78rem; color: var(--grey-500); opacity: 0; transition: opacity .3s; }
.autosave.visible { opacity: 1; }

/* ── Buttons ─────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 20px;
  border-radius: var(--radius);
  font-size: .88rem;
  font-weight: 500;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-primary {
  background: var(--yellow);
  color: var(--navy-dark);
  border: 2px solid var(--yellow);
}
.btn-primary:hover { background: var(--yellow-dark); border-color: var(--yellow-dark); }
.btn-ghost {
  background: transparent;
  color: var(--grey-700);
  border: 1px solid var(--grey-300);
}
.btn-ghost:hover { background: var(--grey-100); border-color: var(--grey-500); }
.btn-ghost:disabled { opacity: .4; pointer-events: none; }
.btn-secondary {
  background: var(--grey-100);
  color: var(--grey-700);
  border: 1px solid var(--grey-300);
}
.btn-secondary:hover { background: var(--grey-200); }
.btn-sm { padding: 5px 12px; font-size: .8rem; }

/* Blocked Continue button */
.btn-primary.btn-continue-blocked,
.btn-primary:disabled {
  background: var(--grey-300);
  border-color: var(--grey-300);
  color: var(--grey-500);
  cursor: not-allowed;
  opacity: 1;
}
.btn-primary.btn-continue-blocked:hover,
.btn-primary:disabled:hover {
  background: var(--grey-300);
  border-color: var(--grey-300);
}

/* ── Step completion checklist ───────────────────────────────────────── */
.step-checklist-wrap {
  margin-top: 20px;
  margin-bottom: 8px;
}
.completion-checklist {
  background: var(--white);
  border: 1px solid var(--grey-200);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
}
.cl-items {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 2px;
}
.cl-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .83rem;
}
.cl-icon {
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .68rem;
  font-weight: 700;
  flex-shrink: 0;
}
.cl-done .cl-icon {
  background: var(--green-light);
  color: var(--green);
}
.cl-missing .cl-icon {
  background: var(--amber-light);
  color: var(--amber);
}
.cl-done .cl-label { color: var(--grey-700); }
.cl-missing .cl-label { color: var(--amber); font-weight: 500; }
.cl-hint {
  margin-top: 10px;
  font-size: .8rem;
  color: var(--grey-500);
  font-style: italic;
}

/* ── Toast ───────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 72px; left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--grey-900);
  color: var(--white);
  padding: 10px 20px;
  border-radius: var(--radius);
  font-size: .85rem;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  white-space: nowrap;
  max-width: calc(100vw - 48px);
}
.toast.is-visible { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ── Error state ─────────────────────────────────────────────────────── */
.error-state {
  background: var(--white);
  border: 1px solid var(--red);
  border-radius: var(--radius-lg);
  padding: 32px;
  margin-top: 32px;
  text-align: center;
}
.error-state h2 { font-family: var(--font-serif); color: var(--red); margin-bottom: 10px; }
.error-state code { background: var(--grey-100); padding: 2px 6px; border-radius: 3px; font-family: var(--font-mono); font-size: .85rem; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .cal-grid  { grid-template-columns: repeat(3, 1fr); }
  .check-grid { grid-template-columns: 1fr; }
  .pressure-row { flex-direction: column; }
  .pressure-radios { justify-content: flex-start; }
  .pb-sublabel { display: none; }
  .pb-step { min-width: 52px; }
  .pb-label { font-size: .68rem; }
}

/* ── Fixture banner ──────────────────────────────────────────────────── */
.fixture-banner {
  background: var(--yellow);
  color: #1a1a1a;
  font-family: var(--font-mono);
  font-size: .8rem;
  text-align: center;
  padding: .55rem 1rem;
  letter-spacing: .01em;
}
.fixture-banner strong { font-weight: 600; }
.fixture-clear {
  color: #1a1a1a;
  text-underline-offset: 2px;
  margin-left: .5rem;
}
.fixture-clear:hover { opacity: .7; }

/* ── Demo mode ───────────────────────────────────────────────────────── */
.demo-loader {
  margin-top: 18px;
}
.btn-demo {
  font-size: .78rem;
  font-family: var(--font-mono);
  background: var(--white);
  color: var(--grey-600);
  border: 1px solid var(--grey-300);
  border-radius: 6px;
  padding: .4rem .85rem;
  cursor: pointer;
  transition: background var(--transition), color var(--transition), border-color var(--transition);
  letter-spacing: .01em;
}
.btn-demo:hover {
  background: var(--grey-100);
  color: var(--grey-800);
  border-color: var(--grey-400);
}

/* Demo mode — .pb-step.is-clickable handles cursor via JS */

/* ── EFG Grouped Selector ────────────────────────────────────────────── */
.efg-selector {
  border: 1px solid var(--grey-200);
  border-radius: 6px;
  overflow: hidden;
}
.efg-realm-group {
  border-bottom: 1px solid var(--grey-200);
}
.efg-realm-group:last-child { border-bottom: none; }
.efg-realm-summary {
  padding: 8px 14px;
  background: var(--grey-100);
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--grey-500);
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.efg-realm-summary::before {
  content: '▶';
  font-size: .65rem;
  transition: transform .15s;
  flex-shrink: 0;
}
.efg-realm-group[open] > .efg-realm-summary::before { transform: rotate(90deg); }
.efg-realm-summary::-webkit-details-marker { display: none; }
.efg-realm-body { padding: 10px 14px 14px; }
.efg-biome-group { margin-bottom: 10px; }
.efg-biome-group:last-child { margin-bottom: 0; }
.efg-biome-label {
  font-size: .72rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 6px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--grey-200);
}
.efg-code-badge {
  font-family: var(--font-mono);
  font-size: .75rem;
  background: var(--navy);
  color: #fff;
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 2px;
}
.check-item:has(input[name="efg_code"]) { font-size: .82rem; }

/* ── Tag picker component ────────────────────────────────────────────── */
.tag-picker { position: relative; }

.tp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 6px 8px;
  border: 1.5px solid var(--grey-300);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--grey-100);
  min-height: 38px;
}
/* Hidden when no tags selected — toggled via JS .has-tags class */
.tag-picker:not(.has-tags) .tp-tags {
  display: none;
}
/* When no tags, give input full border-radius */
.tag-picker:not(.has-tags) .tp-input {
  border-radius: 6px;
}

.tp-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px 3px 12px;
  background: var(--navy);
  color: #fff;
  border-radius: 99px;
  font-size: .78rem;
  font-weight: 500;
  line-height: 1.4;
}
.tp-remove {
  background: none;
  border: none;
  color: rgba(255,255,255,.65);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  transition: color .1s;
}
.tp-remove:hover { color: #fff; }

.tp-control { position: relative; }
.tp-input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--grey-300);
  border-radius: 0 0 6px 6px;
  font: inherit;
  font-size: .88rem;
  background: #fff;
  color: var(--grey-900);
  outline: none;
  box-sizing: border-box;
  transition: border-color .15s;
}
.tp-input:focus { border-color: var(--navy); background: #fff; }

.tp-dropdown {
  position: fixed;
  background: #fff;
  border: 1.5px solid var(--navy);
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(0,52,120,.12);
  list-style: none;
  margin: 0;
  padding: 4px 0;
  max-height: 260px;
  overflow-y: auto;
  z-index: 9999;
}
.tp-dropdown.is-hidden { display: none; }

.tp-item {
  padding: 8px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 1px;
  outline: none;
}
.tp-item:hover,
.tp-item:focus { background: #eef3fb; }

.tp-label { font-size: .86rem; font-weight: 500; color: var(--grey-900); }
.tp-label strong { color: var(--navy); font-weight: 700; background: none; }
.tp-sublabel { font-size: .73rem; color: var(--grey-500); font-style: italic; }
.tp-empty,
.tp-hint { padding: 10px 14px; font-size: .82rem; color: var(--grey-500); font-style: italic; list-style: none; }

/* ── Livestock checkbox grid ─────────────────────────────────────────── */
.mt-8 { margin-top: 8px; }

/* ── Block 4/5/6 group headers ───────────────────────────────────────── */
.list-group-header {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--grey-500);
  background: var(--grey-100);
  padding: 5px 12px;
  margin: 0 -12px;
  border-top: 1px solid var(--grey-200);
  border-bottom: 1px solid var(--grey-200);
  position: sticky;
  top: 0;
  z-index: 1;
}
.pressure-group:first-child .list-group-header,
.challenge-group:first-child .list-group-header,
.service-group:first-child .list-group-header { border-top: none; }

/* ── Monitoring calendar grid (Step 4 output) ────────────────────────── */
.cal-output-wrap { overflow-x: auto; margin-bottom: 10px; }
.cal-output-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  min-width: 640px;
}
.cal-output-table th,
.cal-output-table td {
  padding: 5px 4px;
  border: 1px solid var(--grey-200);
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}
.cal-month-header th { background: var(--grey-100); }
.cal-group-col  { text-align: left !important; min-width: 180px; max-width: 220px; white-space: normal; padding-left: 8px; }
.cal-freq-col   { min-width: 88px; text-align: left !important; padding-left: 6px; }
.cal-month-th   { font-size: .7rem; font-weight: 700; color: var(--grey-500); letter-spacing: .02em; width: 36px; }
.cal-th-constrained { background: #fef9e7; color: #9a6700; }
.cal-th-unknown     { background: var(--grey-100); color: var(--grey-500); }

.cal-group-name { text-align: left; padding-left: 8px; }
.cal-group-name strong { display: block; font-size: .82rem; }
.cal-stage-tag {
  display: inline-block;
  margin-top: 2px;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--grey-500);
}
.cal-cell        { font-size: 1rem; line-height: 1; }
.cal-cell-off    { background: transparent; color: transparent; }
.cal-cell-on     { background: #e8f5ee; color: var(--green); font-weight: bold; }
.cal-cell-warn   { background: #fef9e7; color: #9a6700; font-weight: bold; }
.cal-freq-td     { font-size: .75rem; text-align: left; padding-left: 6px; white-space: normal; }

/* Access legend row */
.cal-access-legend-row td  { background: var(--grey-100); font-size: .8rem; font-weight: 600; }
.cal-legend-label          { text-align: left; padding-left: 8px; font-style: italic; color: var(--grey-500); }
.cal-legend-ok             { background: #e8f5ee; color: var(--green); }
.cal-legend-constrained    { background: #fef9e7; color: #9a6700; }
.cal-legend-unknown        { background: #f5f5f5; color: var(--grey-500); }

/* Legend strip below grid */
.cal-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 6px;
  font-size: .75rem;
  color: var(--grey-500);
}
.cal-legend-item  { display: flex; align-items: center; gap: 4px; }
.cal-legend-dot   { font-size: .95rem; }
.cal-legend-acc   { display: inline-block; font-size: .75rem; font-weight: 700; width: 16px; text-align: center; }
.cal-legend-access { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }

/* ── Print-only / screen-only utilities ─────────────────────────────── */
.screen-hide { display: none; }
.print-header {
  display: none; /* shown only in print via @media print below */
}

/* ── Print running header/footer (screen-hide base) ─────────────────── */
.print-running-head,
.print-running-foot { display: none; }

/* ── Print ───────────────────────────────────────────────────────────── */
@media print {
  /* ── Page setup ──────────────────────────────────────────────────────── */
  @page { size: A4; margin: 16mm 15mm 14mm; }

  /* Preserve all colours — badges, calendar cells, level indicators */
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }

  /* ── Hide screen-only chrome ─────────────────────────────────────────── */
  .print-hide,
  .site-header,
  .step-nav,
  .wizard-footer,
  .output-actions,
  .warnings-block,
  .fixture-banner,
  .step-checklist-wrap,
  .demo-loader,
  #demo-banner { display: none !important; }

  body { background: white; font-size: 9.5pt; color: #111; }
  .container { max-width: 100% !important; padding: 0 !important; }
  .wizard-main { padding: 0 !important; }
  .blocks-container { gap: 0; }

  /* ── Running header/footer — hidden in print ────────────────────────────
     position:fixed in Chromium print sits at the top of the content area,
     not inside the @page margin, so it overlaps content on every page.
     Page 1 cover header already carries landscape name + date. The browser's
     own print header/footer (URL, page number) handles the rest.          */
  .print-running-head,
  .print-running-foot { display: none !important; }

  /* ── Cover header (page 1 only) ──────────────────────────────────────── */
  .print-header {
    display: block !important;
    border-bottom: 3px solid #003478;
    padding-bottom: 10px;
    margin-bottom: 14px;
  }
  .print-header-brand {
    font-family: var(--font-mono), monospace; font-size: 7.5pt;
    color: #003478; letter-spacing: .05em; text-transform: uppercase; margin-bottom: 4px;
  }
  .print-header-title {
    font-family: var(--font-serif), Georgia, serif; font-size: 22pt;
    font-weight: 600; color: #003478; line-height: 1.15;
  }
  .print-header-sub  { font-size: 10.5pt; color: #333; margin-top: 3px; font-style: italic; }
  .print-header-meta { font-size: 8pt; color: #666; margin-top: 5px; }

  /* ── Summary panel ───────────────────────────────────────────────────── */
  .output-summary-panel {
    display: flex !important; flex-wrap: nowrap !important; gap: 0 !important;
    border: 1.5px solid #003478 !important; border-radius: 5px !important;
    padding: 0 !important; margin-bottom: 14px !important;
    background: #f0f5ff !important; overflow: hidden !important;
    break-inside: avoid;
  }
  .summary-stat {
    flex: 1; text-align: center; padding: 6px 4px;
    border-right: 1px solid #b8cce4;
  }
  .summary-stat:last-child { border-right: none; }
  .stat-num   { font-size: 15pt !important; display: block; line-height: 1.1; }
  .stat-label { font-size: 6.5pt !important; color: #444; display: block; }
  .summary-meta {
    font-size: 7.5pt; padding: 4px 10px;
    border-top: 1px solid #b8cce4; flex-basis: 100%;
    display: flex; flex-wrap: wrap; gap: 0 16px;
  }

  /* ── Output sections — clean, no card shadow ─────────────────────────── */
  .output-section {
    box-shadow: none !important; border: none !important;
    padding: 12px 0 4px !important; margin-bottom: 0 !important;
    border-top: 1.5px solid #d0dcea !important;
  }
  .narrative-section.output-section { border-top: none !important; padding-top: 0 !important; }

  .section-title {
    color: #003478 !important; font-size: 11pt; font-weight: 700;
    padding-bottom: 5px; margin-bottom: 8px;
    border-bottom: 1.5px solid #003478 !important;
    break-after: avoid; page-break-after: avoid;
  }

  /* ── Narrative ───────────────────────────────────────────────────────── */
  .narrative-header h2 { font-size: 14pt; margin-bottom: 3px; }
  .narrative-paras p   { font-size: 9.5pt; line-height: 1.55; margin-bottom: 8px; }
  .landscape-desc      { font-size: 9pt; margin: 6px 0; }
  .advisory-notice     { font-size: 8.5pt; padding: 5px 9px; margin-bottom: 8px; }
  .block-desc          { font-size: 9pt; margin-bottom: 6px; }
  .bio-summary-sentence { font-size: 9pt; margin-bottom: 8px; }

  /* ── Page-break control ──────────────────────────────────────────────── */
  /* Practice chains: new page after narrative */
  .output-section-chains { break-before: page; page-break-before: always; }
  .chain-group    { break-inside: avoid; margin-bottom: 7px; }
  .chain-practice { font-size: 9pt; padding: 2px 0; }

  /* Biological monitoring: always starts on a fresh page */
  .output-section-bio { break-before: page; page-break-before: always; }

  /* Disable per-subsection forced breaks — bio tables now flow naturally */
  .bio-section.section-force-break {
    break-before: auto !important;
    page-break-before: auto !important;
  }
  /* Bio sub-sections: break between them if needed, not in the middle of table */
  .bio-section { margin-bottom: 10px; }
  .bio-section-body { display: block !important; }
  .bio-section-body .table-scroll { overflow: visible !important; }

  /* Abiotic: new page */
  .output-section-abiotic { break-before: page; page-break-before: always; }

  /* Calendar: new page — it's wide and visually distinct */
  .output-section-cal { break-before: page; page-break-before: always; }

  /* Enhancement recs: continue on same or next page naturally */
  .output-section-enh { }

  /* ── Details/summary handling ────────────────────────────────────────── */
  /* Open all details by default */
  details { display: block !important; }
  details > summary { display: none !important; }
  details > *:not(summary) { display: block !important; }

  /* Bio sub-section summaries: restore as visible sub-headings */
  .bio-section > summary {
    display: block !important;
    font-size: 9.5pt; font-weight: 700; color: #003478;
    padding: 6px 0 5px; margin-bottom: 6px;
    border-bottom: 1px solid #c0cfe8;
    break-after: avoid; page-break-after: avoid;
  }
  .bio-section-toggle { display: flex !important; justify-content: space-between; align-items: baseline; }
  .bio-section-label  { font-size: 9.5pt; }
  .bio-section-desc   { font-size: 8pt; font-weight: 400; color: #555; }
  .bio-section-count  { font-size: 9pt; }

  /* Hide expandable secondary details inside table cells — keeps bio rows compact */
  .eq-details { display: none !important; }

  .eq-list, .guidance-body, .interp-note { display: block !important; }

  /* ── Tables ──────────────────────────────────────────────────────────── */
  .table-scroll   { overflow: visible !important; }
  .cal-output-wrap { overflow: visible !important; }

  .output-table thead,
  .cal-output-table thead { display: table-header-group; }

  .output-table tbody tr,
  .cal-output-table tbody tr { break-inside: avoid; page-break-inside: avoid; }

  .output-table { font-size: 8pt; width: 100%; }

  /* ── Bio table ───────────────────────────────────────────────────────── */
  .bio-table { font-size: 8pt; width: 100%; table-layout: fixed; }
  .bio-table th, .bio-table td { padding: 5px 6px !important; overflow-wrap: break-word; }

  /* Hide last column (draft / upgrade badges) — not needed on paper */
  .bio-table th:nth-child(7), .bio-table td:nth-child(7) { display: none !important; }

  /* Redistribute col widths across 6 effective columns (override inline styles) */
  .bio-table col:nth-child(1) { width: 21% !important; }  /* Indicator */
  .bio-table col:nth-child(2) { width: 14% !important; }  /* Category  */
  .bio-table col:nth-child(3) { width:  7% !important; }  /* Level     */
  .bio-table col:nth-child(4) { width: 33% !important; }  /* Protocol  */
  .bio-table col:nth-child(5) { width: 18% !important; }  /* Metric    */
  .bio-table col:nth-child(6) { width:  7% !important; }  /* Frequency */
  .bio-table col:nth-child(7) { width:  0  !important; }  /* Hidden    */

  /* Hide secondary sub-content inside bio rows */
  .bio-table .abiotic-measures { display: none !important; }

  /* ── Calendar table ──────────────────────────────────────────────────── */
  .cal-output-table { font-size: 7.5pt; width: 100%; table-layout: fixed; }
  .cal-group-col { width: 28% !important; }
  .cal-freq-col  { width: 10% !important; }
  /* 12 month columns share the remaining 62% → ~5.2% each */
  .cal-month-th  { width: 5.2% !important; font-size: 6.5pt !important; padding: 3px 1px !important; text-align: center; }
  .cal-cell      { padding: 3px 0 !important; text-align: center !important; font-size: 8pt !important; }
  .cal-legend    { flex-wrap: nowrap; font-size: 7.5pt; margin-top: 6px; }

  /* ── Badges ──────────────────────────────────────────────────────────── */
  .badge, .level-badge, .phase-badge { font-size: 7pt !important; padding: 1px 4px !important; }

  /* ── Tooltips: hide ──────────────────────────────────────────────────── */
  .tooltip-wrap .tooltip-box { display: none !important; }
  .tooltip-icon { display: none !important; }

  /* ── Score breakdown chips: hide ─────────────────────────────────────── */
  .score-breakdown { display: none !important; }
}

/* ── EFG Map (Block 1.2) ─────────────────────────────────────────────── */

#efg-map {
  height: 380px;
  border-radius: 6px;
  border: 1.5px solid var(--grey-300);
  overflow: hidden;
  cursor: crosshair;
  margin-bottom: 0;
  z-index: 0; /* keep below wizard modals */
}

/* Leaflet controls sit above the tile layer */
#efg-map .leaflet-control { z-index: 1; }

/* Loading state shown if data not yet available */
.efg-map-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--grey-500);
  font-size: .85rem;
}

@keyframes efg-spin { to { transform: rotate(360deg); } }
.efg-spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--grey-200);
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: efg-spin .7s linear infinite;
}

/* ── EFG checklist (below map) ───────────────────────────────────────── */

#efg-map-checklist {
  border: 1.5px solid var(--grey-200);
  border-top: none;
  border-radius: 0 0 6px 6px;
  background: var(--grey-100);
  padding: 10px 12px;
  min-height: 44px;
}

.efg-checklist-hint {
  font-size: .82rem;
  color: var(--grey-500);
  margin: 0;
  padding: 2px 0;
}

.efg-checklist {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.efg-checklist-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 6px;
  border: 1.5px solid var(--grey-300);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  font-size: .8rem;
  user-select: none;
  transition: border-color .15s, background .15s;
}

.efg-checklist-item input[type="checkbox"] {
  width: 14px; height: 14px;
  accent-color: var(--navy);
  flex-shrink: 0;
}

.efg-checklist-item.is-checked {
  border-color: var(--navy);
  background: #e8edf5;
}

.efg-checklist-code {
  font-family: var(--font-mono);
  font-size: .75rem;
  font-weight: 600;
  color: var(--navy);
}

.efg-checklist-name {
  color: var(--grey-700);
}

.efg-info {
  color: var(--grey-400);
  cursor: help;
  font-size: .8rem;
  flex-shrink: 0;
}
.efg-info:hover { color: var(--navy); }

/* ── Confirm button row ──────────────────────────────────────────────── */

.efg-confirm-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.efg-map-status {
  font-size: .82rem;
  color: var(--grey-500);
}
.efg-map-status.is-success { color: var(--green); font-weight: 500; }
.efg-map-status.is-warning { color: #c07800; }

/* ── Manual fallback collapsible ─────────────────────────────────────── */

.efg-manual-fallback {
  margin-top: 14px;
  border: 1px dashed var(--grey-300);
  border-radius: 6px;
  overflow: hidden;
}

.efg-manual-summary {
  padding: 9px 14px;
  font-size: .82rem;
  color: var(--grey-600);
  cursor: pointer;
  list-style: none;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.efg-manual-summary::before {
  content: '▶';
  font-size: .6rem;
  transition: transform .15s;
  flex-shrink: 0;
  color: var(--grey-400);
}
.efg-manual-fallback[open] > .efg-manual-summary::before { transform: rotate(90deg); }
.efg-manual-summary::-webkit-details-marker { display: none; }
.efg-manual-summary:hover { color: var(--navy); }

.efg-manual-body {
  padding: 10px 14px 14px;
  border-top: 1px dashed var(--grey-300);
}

/* ── ABC Map bridge ──────────────────────────────────────────────────────── */
.abc-bridge {
  margin: 24px 0 8px;
  border: 1px solid var(--grey-300);
  border-radius: 8px;
  overflow: hidden;
}

.abc-bridge-header {
  background: var(--navy);
  color: #fff;
  font-family: var(--font-serif);
  font-size: .9rem;
  font-weight: 600;
  padding: 10px 16px;
  letter-spacing: .01em;
}

.abc-bridge-body {
  background: #f9fafc;
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.abc-bridge-desc {
  font-size: .88rem;
  color: var(--grey-700);
  margin: 0;
}

.btn-abc {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--yellow);
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: .88rem;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 5px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  align-self: flex-start;
  transition: opacity .15s, box-shadow .15s;
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.btn-abc:hover {
  opacity: .88;
  box-shadow: 0 2px 6px rgba(0,0,0,.18);
}
.btn-abc:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: 2px;
}

.ext-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
}

.abc-bridge-note {
  font-size: .78rem;
  color: var(--grey-500);
  margin: 0;
}

.abc-bridge-steps {
  margin: 4px 0 0;
  padding-left: 20px;
  font-size: .83rem;
  color: var(--grey-700);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
