/* Main Colours */

:root {
  --primary-bg-color: #30384d;
  --primary-bg-link-color: white;
  --primary-bg-hover-color: white;
  --primary-bg-active-color: white;
  --primary-bg-text-color: white;
  --primary-color: white;
  --primary-text-color: white;
  --primary-link-color: blue;
  --primary-hover-color: #30384d;
  --primary-active-color: #30384d;
  --secondary-bg-color: green;
  --secondary-bg-link-color: white;
  --secondary-bg-hover-color: white;
  --secondary-bg-active-color: white;
  --secondary-bg-text-color: white;
  --secondary-color: white;
  --secondary-text-color: #ffffff;
  --secondary-link-color: black;
  --secondary-hover-color: blue;
  --secondary-active-color: #30384d;
  --custom-bg-color: red;
  --custom-text-color: #ffffff;
  --custom-bg-link-color: white;
  --custom-bg-hover-color: white;
  --custom-bg-active-color: white;
  --custom-bg-text-color: white;
  --custom-color: red;
  --custom-link-color: blue;
  --custom-hover-color: red;
  --custom-active-color: red;
  --warning-color: red;
  --success-color: green;
}

/* bootstrap overrides */

/* primary colors */

.color-primary {
  color: var(--primary-color) !important;
}

.text-primary {
  color: var(--primary-text-color) !important;
}

.link-primary {
  color: var(--primary-link-color) !important;
}

.link-primary:hover {
  color: var(--primary-hover-color) !important;
}

.link-primary:active {
  color: var(--primary-active-color) !important;
}

.btn-primary {
  background-color: var(--primary-bg-color);
  border-color: var(--primary-bg-color);
  color: var(--primary-color);
}

.btn-primary:hover {
  background-color: var(--primary-hover-color);
  border-color: var(--primary-hover-color);
  color: var(--primary-color);
}

.btn-primary:active {
  background-color: var(--primary-active-color);
  border-color: var(--primary-active-color);
  color: var(--primary-color);
}

.bg-primary {
  background-color: var(--primary-bg-color) !important;
  border-color: var(--primary-bg-color) !important;
  color: var(--primary-bg-text-color);
}

.bg-primary a {
  color: var(--primary-bg-link-color);
}

.bg-primary a:hover {
  color: var(--primary-bg-hover-color);
}

.bg-primary a:active {
  color: var(--primary-bg-active-color);
}

a {
  color: var(--primary-link-color);
}

a:hover {
  color: var(--primary-hover-color);
}

a:active {
  color: var(--primary-active-color);
}

/* secondary colors */

.color-secondary {
  color: var(--secondary-color) !important;
}

.text-secondary {
  color: var(--secondary-text-color) !important;
}

.link-secondary {
  color: var(--secondary-link-color) !important;
}

.link-secondary:hover {
  color: var(--secondary-hover-color) !important;
}

.link-secondary:active {
  color: var(--secondary-active-color) !important;
}

.btn-secondary {
  background-color: var(--secondary-bg-color);
  border-color: var(--secondary-bg-color);
  color: var(--secondary-color);
}

.btn-secondary:hover {
  background-color: var(--secondary-hover-color);
  border-color: var(--secondary-hover-color);
  color: var(--secondary-color);
}

.btn-secondary:active {
  background-color: var(--secondary-active-color);
  border-color: var(--secondary-active-color);
  color: var(--secondary-color);
}

.bg-secondary {
  background-color: var(--secondary-bg-color) !important;
  border-color: var(--secondary-bg-color) !important;
  color: var(--secondary-bg-text-color);
}

.bg-secondary a {
  color: var(--secondary-bg-link-color);
}

.bg-secondary a:hover {
  color: var(--secondary-bg-hover-color);
}

.bg-secondary a:active {
  color: var(--secondary-bg-active-color);
}

a.secondary {
  color: var(--secondary-link-color);
}

a.secondary:hover {
  color: var(--secondary-hover-color);
}

a.secondary:active {
  color: var(--secondary-active-color);
}

/* custom colors */

.color-custom {
  color: var(--custom-color) !important;
}

.text-custom {
  color: var(--custom-text-color) !important;
}

.link-custom {
  color: var(--custom-link-color) !important;
}

.link-custom:hover {
  color: var(--custom-hover-color) !important;
}

.link-custom:active {
  color: var(--custom-active-color) !important;
}

.btn-custom {
  background-color: var(--custom-bg-color);
  border-color: var(--custom-bg-color);
  color: var(--custom-color);
}

.btn-custom:hover {
  background-color: var(--custom-hover-color);
  border-color: var(--custom-hover-color);
  color: var(--custom-color);
}

.btn-custom:active {
  background-color: var(--custom-active-color);
  border-color: var(--custom-active-color);
  color: var(--custom-color);
}

.bg-custom {
  background-color: var(--custom-bg-color) !important;
  border-color: var(--custom-bg-color) !important;
  color: var(--custom-bg-text-color);
}

.bg-custom a {
  color: var(--custom-bg-link-color);
}

.bg-custom a:hover {
  color: var(--custom-bg-hover-color);
}

.bg-custom a:active {
  color: var(--custom-bg-active-color);
}

a.custom {
  color: var(--custom-link-color);
}

a.custom:hover {
  color: var(--custom-hover-color);
}

a.custom:active {
  color: var(--custom-active-color);
}

/* core stylings */

.navbar-toggler {
  color: #ffffff;
}

.index-card {
  border-width: 2px;
  border-style: solid;
}

main {
  min-height: 60vh;
}

.navbar img {
  width: 100%;
  max-width: 100px;
}

.feedback {
  color: var(--warning-color);
}

.consent_checkbox {
  height: 18px;
  margin-right: 15px;
}

.consent_checkbox > input {
  border: 1px solid black;
}

/* For testing - check tickbox to show hidden content */

.d-none {
  /*display: block !important;*/
}

/* For testing - uncheck tickbox to remove question shading */

.question_container > * {
  /*background-color: #b5f1a0;*/
}

/* ============================================
   admin.css — Shared layout (navbar, footer)
   + auth pages (login, registration, password)
   Include on ALL pages.
   ============================================ */

/* Full-height layout: push footer to bottom */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > main,
body > section {
  flex: 1;
}

body > footer {
  flex-shrink: 0;
}

/* Navbar */
.navbar-main {
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.28);
  padding: 10px 0;
}

.navbar-main > .container {
  justify-content: center !important;
  height: 100%;
}

.navbar-logo {
  max-height: 60px;
  width: auto;
}

/* Footer */
footer .footer-row {
  margin-right: 0 !important;
  margin-left: 0 !important;
}

footer .footer-content {
  text-align: center !important;
  padding-bottom: 36px;
  padding-top: 36px;
}

footer .footer-content ul {
  padding-left: 0;
}

footer .footer-copyright {
  text-align: center !important;
  color: white;
  margin-top: 30px;
}

/* Page containers */
.container-narrow {
  max-width: 700px;
}

.container-medium {
  max-width: 960px;
}

/* Login card */
.login-card {
  max-width: 440px;
  border: none;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08), 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* App navbar (authenticated pages) */
.app-navbar {
  background: #30384d;
  border-bottom: 1px solid #252b3d;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.app-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;   /* brand left, actions right — was center + absolutely
                                        positioned actions, which collided on wide screens */
  max-width: 960px;                  /* matches .container-medium so the bar lines up with content */
  margin: 0 auto;
  padding: 0 24px;
  height: 56px;
  gap: 16px;
}

/* Brand lockup — a pill-capsule mark (echoing the medication in the PETRA illustration) plus the
   wordmark. Replaces the old <img>, which at navbar size rendered as an unreadable white box. */
.app-navbar-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex-shrink: 0;
}
.app-navbar-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, #3B82F6 0%, #16A394 100%);
  color: #FFFFFF;
  flex-shrink: 0;
}
.app-navbar-mark svg { width: 17px; height: 17px; }
.app-navbar-wordmark {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #FFFFFF;
}

/* Retained for any page still using the legacy <img> brand. */
.app-navbar-logo {
  height: 38px;
  width: auto;
  border-radius: 8px;
  opacity: 0.92;
  mix-blend-mode: lighten;
}

.app-navbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.app-navbar-link {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255,255,255,0.65);
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border-radius: 6px;
  transition: all 0.15s;
}

.app-navbar-link:hover {
  color: #FFFFFF;
  background: rgba(255,255,255,0.1);
}

@media (max-width: 480px) {
  .app-navbar-inner { padding: 0 14px; gap: 8px; }
  .app-navbar-actions { gap: 2px; }
  .app-navbar-link { font-size: 11px; padding: 5px 6px; }
  .app-navbar-link svg { display: none; }
  .app-navbar-wordmark { font-size: 15px; letter-spacing: 1.5px; }
  .app-navbar-mark { width: 26px; height: 26px; }
  .app-navbar-mark svg { width: 15px; height: 15px; }
}

.login-icon-circle {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-card .input-group-text {
  background: #F9FAFB;
  border-right: none;
}

.login-card .input-group .form-control {
  border-left: none;
}

.login-card .input-group .form-control:focus {
  box-shadow: none;
  border-color: #ced4da;
}

.login-card .input-group:focus-within .input-group-text,
.login-card .input-group:focus-within .form-control {
  border-color: #3B82F6;
}

.login-card .input-group:focus-within .input-group-text {
  border-right: none;
}

.login-card .input-group:focus-within .form-control {
  border-left: none;
  box-shadow: none;
}

/* Login success — SVG line-drawing animation */
.ls-icon-wrap {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  opacity: 0;
  transform: scale(0.8);
  transition: all 0.5s ease;
}

.ls-icon-wrap.active {
  opacity: 1;
  transform: scale(1);
}

.ls-icon-wrap.clinician-bg {
  background: #EFF6FF;
}

.ls-icon-wrap.patient-bg {
  background: #F3E8FF;
}

/* Stroke draw animation */
@keyframes strokeDraw {
  to { stroke-dashoffset: 0; }
}

.ls-icon-wrap svg .draw-path {
  stroke-dashoffset: var(--path-len);
  stroke-dasharray: var(--path-len);
  animation: strokeDraw 1.5s ease forwards;
  animation-delay: 0.3s;
}

/* Fade-in for text content */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.ls-fade {
  opacity: 0;
}

.ls-fade.show {
  animation: fadeUp 0.5s ease forwards;
}

/* Green checkmark draw (plays first) */
@keyframes checkDraw {
  to { stroke-dashoffset: 0; }
}

.ls-check-path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: checkDraw 0.4s ease forwards;
  animation-delay: 0.2s;
}

/* Circle pulse behind icon */
@keyframes circlePulse {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.3); }
  70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

.ls-icon-wrap.pulse {
  animation: circlePulse 1s ease 0.3s;
}

/* Landing page */
/* Landing page — hero */
.landing-bg {
  background: #FFFFFF;
}

.landing-logo {
  height: 140px;
  width: auto;
  margin-bottom: 20px;
}

/* Landing page — blue footer */
.landing-footer-blue {
  background: #30384d;
  padding: 24px 20px;
  text-align: center;
  flex-shrink: 0;
}

.landing-footer-blue .landing-footer-logo {
  height: 28px;
  opacity: 0.9;
  margin-bottom: 10px;
  filter: brightness(0) invert(1);
}

.landing-footer-blue .landing-footer-text {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  margin-bottom: 8px;
}

.landing-footer-blue .landing-footer-links {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 13px;
}

.landing-footer-blue .landing-footer-links a {
  color: rgba(255,255,255,0.7);
  text-decoration: none;
  transition: color 0.15s;
}

.landing-footer-blue .landing-footer-links a:hover {
  color: #FFFFFF;
}

.landing-footer-blue .landing-footer-copy {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  margin: 0;
}

.landing-hero {
  max-width: 540px;
}

.landing-title {
  font-size: 42px;
  font-weight: 800;
  color: #30384d;
  letter-spacing: -0.5px;
  margin-bottom: 4px;
}

.landing-subtitle {
  font-size: 16px;
  font-weight: 500;
  color: #3B82F6;
  margin-bottom: 16px;
  line-height: 1.4;
}

.petra-initial {
  color: #30384d;
  font-weight: 800;
}

.landing-desc {
  font-size: 14px;
  color: #6B7280;
  line-height: 1.6;
  margin-bottom: 28px;
}

.landing-cards {
  max-width: 800px;
  margin: 0 auto;
}

.landing-info-card {
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  transition: all 0.2s ease;
}

.landing-info-card:hover {
  border-color: #93C5FD;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.08);
}

.landing-info-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-notice {
  max-width: 600px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 10px;
  padding: 14px 20px;
  font-size: 13px;
  color: #92400E;
  line-height: 1.5;
}

/* Methodology — page header eyebrow */
.method-eyebrow-top {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #3B82F6;
  margin-bottom: 10px;
}

/* Methodology — process ribbon (at-a-glance overview) */
.method-flow {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 8px 10px;
  max-width: 760px;
  margin: 4px auto 0;
}

.method-flow-item {
  font-size: 13px;
  font-weight: 600;
  color: #475569;
  background: #F1F5F9;
  border: 1px solid #E2E8F0;
  padding: 6px 15px;
  border-radius: 999px;
  white-space: nowrap;
}

.method-flow-arrow {
  flex-shrink: 0;
  color: #CBD5E1;
}

/* Methodology — step cards */
.method-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
}

.method-card {
  display: flex;
  gap: 20px;
  align-items: flex-start;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 22px 26px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.method-card:hover {
  border-color: #BFDBFE;
  box-shadow: 0 10px 26px rgba(48, 56, 77, 0.07);
  transform: translateY(-2px);
}

.method-card-badge {
  position: relative;
  flex-shrink: 0;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  background: #EFF6FF;
  border: 1px solid #DBEAFE;
  display: flex;
  align-items: center;
  justify-content: center;
}

.method-card-num {
  flex-shrink: 0;
  align-self: center;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -1px;
  color: #93C5FD;
}

.method-card-body {
  flex: 1;
  min-width: 0;
}

.method-card-title {
  font-size: 17px;
  font-weight: 700;
  color: #30384d;
  margin: 2px 0 5px;
  line-height: 1.3;
}

.method-card-lead {
  font-size: 14.5px;
  font-weight: 500;
  color: #374151;
  line-height: 1.5;
  margin: 0 0 6px;
}

.method-card-detail {
  font-size: 13px;
  color: #6B7280;
  line-height: 1.6;
  margin: 0;
}

/* Methodology — closing notice */
.method-notice {
  max-width: 760px;
  margin: 0 auto;
  background: #F8FAFC;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 20px 24px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.method-notice-icon {
  flex-shrink: 0;
  color: #30384d;
  margin-top: 1px;
}

.method-notice-title {
  font-size: 15px;
  font-weight: 700;
  color: #30384d;
  margin-bottom: 5px;
}

.method-notice-text {
  font-size: 13.5px;
  color: #6B7280;
  line-height: 1.6;
  margin: 0;
}

@media (max-width: 560px) {
  .method-flow-arrow { display: none; }
}

@media (max-width: 480px) {
  .method-card { padding: 18px; gap: 12px; }
  .method-card-badge { width: 46px; height: 46px; border-radius: 13px; }
  .method-card-title { font-size: 16px; }
  .method-card-num { font-size: 30px; }
}

/* Landing page — top banner */
.landing-banner {
  background: #FFFBEB;
  border-bottom: 1px solid #FDE68A;
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  color: #92400E;
  text-align: center;
  letter-spacing: 0.2px;
}

/* Landing page — navbar */
.landing-navbar {
  background: #FFFFFF;
  border-bottom: 1px solid #E5E7EB;
  padding: 12px 0;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

.landing-navbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.landing-navbar-logo {
  height: 44px;
  width: auto;
}

.landing-navbar-partner {
  height: 36px;
  width: auto;
  opacity: 0.85;
}

/* Landing page — footer */
.landing-footer {
  background: #F9FAFB;
  border-top: 1px solid #E5E7EB;
  padding: 32px 20px;
  text-align: center;
}

.landing-footer-logo {
  height: 32px;
  width: auto;
  opacity: 0.7;
  margin-bottom: 12px;
}

.landing-footer-text {
  font-size: 13px;
  color: #6B7280;
  margin-bottom: 4px;
}

.landing-footer-links {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  display: flex;
  justify-content: center;
  gap: 20px;
  font-size: 13px;
}

.landing-footer-links a {
  color: #6B7280;
  text-decoration: none;
  transition: color 0.15s;
}

.landing-footer-links a:hover {
  color: #1F2937;
}

.landing-footer-copy {
  font-size: 11px;
  color: #9CA3AF;
  margin: 0;
}

@media (max-width: 480px) {
  .landing-navbar-logo { height: 36px; }
  .landing-navbar-partner { height: 28px; }
  .landing-title { font-size: 32px; }
}

/* Dashboard action cards */
button.dashboard-action-card {
  font: inherit;
  text-align: left;
  width: 100%;
}
.dashboard-action-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 100%;
}

.dashboard-action-card:hover {
  border-color: #3B82F6;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.10);
  transform: translateY(-2px);
  text-decoration: none;
  color: inherit;
}

.da-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.da-icon-blue { background: #EFF6FF; }
.da-icon-green { background: #ECFDF5; }

.da-text { flex: 1; }

.da-title {
  font-size: 15px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 2px;
}

.da-desc {
  font-size: 13px;
  color: #9CA3AF;
  line-height: 1.3;
}

.da-arrow {
  flex-shrink: 0;
  transition: transform 0.2s;
}

.dashboard-action-card:hover .da-arrow {
  transform: translateX(3px);
}

.dashboard-action-card:hover .da-arrow svg {
  stroke: #3B82F6;
}

/* Common page header */
.page-header {
  text-align: center;
  padding: 36px 0 24px;
}

.page-header h1 {
  font-size: 26px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 6px;
}

.page-header h1 svg {
  vertical-align: -3px;
  margin-right: 6px;
}

.page-header p {
  font-size: 14px;
  color: #6B7280;
  margin-bottom: 0;
}

/* Shared action cards (used by clinician + patient dashboards) */
.action-cards {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  margin-bottom: 28px;
  padding-bottom: 28px;
  border-bottom: 1px solid #E5E7EB;
}

.action-card {
  flex: 1;
  min-width: 240px;
  max-width: 340px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  cursor: pointer;
}

.action-card:hover {
  border-color: #30384d;
  box-shadow: 0 2px 8px rgba(48, 56, 77, 0.10);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.action-card .icon-box {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-box-blue {
  background: #EFF6FF;
}

.icon-box-green {
  background: #ECFDF5;
}

.action-card .label {
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
}

.action-card .desc {
  font-size: 12px;
  color: #9CA3AF;
  line-height: 1.4;
  margin-top: 2px;
}

/* Section action button (inline with section headers) */
.btn-section-action {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #3B82F6;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-section-action:hover {
  background: #DBEAFE;
  border-color: #93C5FD;
  color: #2563EB;
}

.btn-section-action-lg {
  padding: 10px 20px;
  font-size: 13px;
}

/* Empty state (shared) */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: #9CA3AF;
  font-size: 14px;
}

.empty-state svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

/* ============================================
   clinician.css — Clinician dashboard +
   view patient data pages
   ============================================ */

/* Patient table */
.patients-section {
  margin-bottom: 32px;
  background: #ffffff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 20px 24px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.patients-section h2 {
  font-size: 15px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 12px;
}

.patients-section h2 svg {
  vertical-align: -2px;
  margin-right: 4px;
}

.patients-table {
  width: 100%;
  table-layout: fixed;   /* columns follow the fixed proportions below, so long names/emails
                            truncate with an ellipsis instead of widening the table past its card */
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid #E5E7EB;
  border-radius: 8px;
  overflow: hidden;
  font-size: 14px;
}

.patients-table thead th {
  background: #F9FAFB;
  color: #6B7280;
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 10px 12px;
  border-bottom: 1px solid #E5E7EB;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

.patients-table thead th:hover {
  background: #F3F4F6;
  color: #374151;
}

.patients-table thead th .sort-arrow {
  display: inline-block;
  margin-left: 4px;
  opacity: 0.3;
  font-size: 10px;
}

.patients-table thead th.sort-active .sort-arrow {
  opacity: 1;
}

.patients-table tbody tr {
  cursor: pointer;
  transition: background 0.15s;
}

.patients-table tbody tr:hover {
  background: #F9FAFB;
}

.patients-table tbody td {
  padding: 12px 12px;
  border-bottom: 1px solid #F3F4F6;
  color: #374151;
  vertical-align: middle;
}

.patients-table tbody tr:last-child td {
  border-bottom: none;
}

.patient-name {
  font-weight: 600;
  color: #1F2937;
}

.patient-email {
  color: #9CA3AF;
  font-size: 12px;
}

.btn-optimize {
  background: #059669;
  color: #fff;
  border: none;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
  white-space: nowrap;
}

.btn-optimize:hover {
  background: #047857;
  color: #fff;
}

.btn-view {
  background: transparent;
  color: #30384d;
  border: 1px solid #D1D5DB;
  padding: 5px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.btn-view:hover {
  background: #F3F4F6;
  border-color: #9CA3AF;
}

/* Actions column */
.td-actions {
  text-align: right;
}

/* Mobile: tables would overflow viewport because of many columns + nowrap
   headers. Let the table container scroll horizontally on its own and
   shrink the section's horizontal padding so the table edge aligns with
   the card edge. */
@media (max-width: 576px) {
  .patients-section {
    padding: 16px 12px;
  }
  .patients-section > #patients,
  .patients-section > #clinicians {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .patients-table {
    font-size: 13px;
  }
  .patients-table thead th {
    padding: 8px 10px;
  }
  .patients-table tbody td {
    padding: 10px;
  }
}

/* View patient data page */
.vpd-breadcrumb {
  font-size: 13px;
  color: #9CA3AF;
  margin-bottom: 16px;
}

.vpd-breadcrumb a {
  color: #6B7280;
  text-decoration: none;
  transition: color 0.15s;
}

.vpd-breadcrumb a:hover {
  color: #1F2937;
}

.vpd-breadcrumb svg {
  vertical-align: -1px;
  margin: 0 6px;
}

/* Patient profile card */
.vpd-profile-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 28px;
  margin-bottom: 32px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.04);
}

.vpd-profile-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.vpd-profile-info {
  display: flex;
  align-items: center;
  gap: 16px;
}

.vpd-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #EFF6FF;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.vpd-profile-name {
  font-size: 20px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 2px;
}

.vpd-profile-sub {
  font-size: 13px;
  color: #9CA3AF;
}

/* Stat pills row */
.vpd-stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.vpd-stat {
  flex: 1;
  min-width: 120px;
  background: #F9FAFB;
  border: 1px solid #F3F4F6;
  border-radius: 10px;
  padding: 14px 16px;
  text-align: center;
}

.vpd-stat-value {
  font-size: 22px;
  font-weight: 700;
  color: #1F2937;
  line-height: 1.2;
}

.vpd-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 4px;
}

/* Section headers */
.vpd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid #E5E7EB;
}

.vpd-section-title {
  font-size: 16px;
  font-weight: 700;
  color: #1F2937;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.vpd-section-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 20px;
  background: #F3F4F6;
  color: #6B7280;
}

.vpd-actions {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px solid #E5E7EB;
  text-align: center;
}

.vpd-actions form {
  display: inline-block;
  margin-left: 10px;
}

/* ============================================
   patient.css — Patient dashboard page
   ============================================ */

/* Patient dashboard uses shared action-card from admin.css */

/* Single-column action card variant for patient */
.action-card-full {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s ease;
  cursor: pointer;
  margin-bottom: 12px;
}

.action-card-full:hover {
  border-color: #30384d;
  box-shadow: 0 4px 12px rgba(48, 56, 77, 0.10);
  transform: translateY(-1px);
}

.action-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.action-title {
  font-size: 15px;
  font-weight: 600;
  color: #1F2937;
}

.action-desc {
  font-size: 12px;
  color: #9CA3AF;
  line-height: 1.3;
  margin-top: 2px;
}

.action-chevron {
  color: #D1D5DB;
  margin-left: auto;
}

/* Section divider */
.section-divider {
  font-size: 13px;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 32px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid #E5E7EB;
}

/* History cards (patient dashboard summary view) */
.history-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  transition: all 0.2s ease;
  text-align: left;
}

.history-card:hover {
  box-shadow: 0 6px 16px rgba(59, 130, 246, 0.08), 0 2px 6px rgba(0,0,0,0.04);
  border-color: #93C5FD;
}

.history-card .entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid #F3F4F6;
}

.history-card .entry-number {
  font-size: 13px;
  font-weight: 600;
  color: #1E40AF;
  background: #EFF6FF;
  padding: 2px 10px;
  border-radius: 20px;
}

.history-card .entry-date {
  font-size: 12px;
  color: #6B7280;
}

.history-card .demographics {
  font-size: 13px;
  color: #374151;
  margin-bottom: 6px;
}

.history-card .top-meds .med-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 3px 0;
  font-size: 13px;
}

.history-card .top-meds .med-rank {
  font-weight: 600;
  color: #1E40AF;
  width: 24px;
}

.history-card .top-meds .med-name {
  flex: 1;
  color: #1F2937;
}

.history-card .top-meds .med-score {
  font-weight: 600;
  color: #059669;
}

.history-card .weights-summary {
  font-size: 12px;
  color: #6B7280;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid #F3F4F6;
}

/* No history state */
.no-history {
  text-align: center;
  padding: 40px 20px;
  color: #6B7280;
}

.no-history svg {
  margin-bottom: 12px;
  opacity: 0.4;
}

.no-history p {
  font-size: 14px;
  color: #9CA3AF;
}

/* ============================================
   optimizer.css — Medication optimizer wizard
   + optimizer history page
   ============================================ */

/* Optimizer Container */
.optimizer-container {
  max-width: 920px;
  margin: 0 auto;
  padding: 16px 24px;
  background-color: transparent;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.optimizer-step {
  animation: fadeIn 0.3s ease-out;
  padding-bottom: 16px;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Progress Bar */
/* ⚠ `.progress-dots` and `.progress-dot` are DEAD as of 2026-08-30. Three flat unnamed bars
   said nothing about where the run was, and activity1 — the only page that ever carried them
   — now uses the named stepper in the PETRA THEME section at the end of this file
   (`.petra-wiz`). Kept and marked rather than deleted, like `.weight-slider` above. */
.progress-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 24px;
}

.progress-dot {
  width: 100%;
  max-width: 120px;
  height: 3px;
  background-color: #D1D5DB;
  border-radius: 2px;
  transition: all 0.3s ease;
}

.progress-dot.active {
  background-color: #3B82F6;
  box-shadow: 0 0 8px rgba(59, 130, 246, 0.4);
}

/* Step icon circles (matches login-icon-circle pattern) */
.step-icon-circle {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.step-icon-blue { background: #EFF6FF; }
.step-icon-red { background: #FEF2F2; }
.step-icon-amber { background: #FFFBEB; }
.step-icon-green { background: #ECFDF5; }

/* Step Header */
.step-header {
  margin-bottom: 20px;
  text-align: center;
}

.step-title {
  font-size: 24px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.step-title i {
  color: #3B82F6;
}

.step-subtitle {
  font-size: 13px;
  color: #6B7280;
  font-weight: 400;
  line-height: 1.3;
}

/* Form Sections */
.form-section {
  margin-bottom: 20px;
}

.form-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #374151;
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Baseline questionnaire — required-field validation highlight.
   Applied to a .form-section by validateRequired() when its field is empty. */
.form-section.field-missing {
  border-left: 3px solid #EF4444;
  background-color: #FEF2F2;
  border-radius: 6px;
  padding: 10px 12px;
  margin-left: -12px;
}

.form-section.field-missing .form-section-title {
  color: #B91C1C;
}

/* Sex Selection Buttons */
.sex-button-group {
  display: flex;
  gap: 10px;
}

.sex-button-group input[type="radio"] {
  display: none;
}

.sex-button-group label {
  flex: 1;
  padding: 14px;
  background-color: #F3F4F6;
  border: 2px solid transparent;
  border-radius: 10px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: #6B7280;
  cursor: pointer;
  transition: all 0.2s ease;
}

.sex-button-group label:hover {
  background-color: #E5E7EB;
}

.sex-button-group input[type="radio"]:checked + label {
  background-color: #DBEAFE;
  border-color: #3B82F6;
  color: #1E40AF;
  font-weight: 600;
}

/* Age Slider */
.age-input-wrapper {
  margin-bottom: 16px;
}

.age-slider-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-size: 13px;
  color: #6B7280;
}

.age-value {
  color: #3B82F6;
  font-weight: 700;
  font-size: 15px;
}

.age-slider {
  width: 100%;
  height: 6px;
  background: #E5E7EB;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
}

.age-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: #3B82F6;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.age-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

.age-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: #3B82F6;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
  box-shadow: 0 2px 4px rgba(59, 130, 246, 0.3);
}

.age-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 8px rgba(59, 130, 246, 0.4);
}

/* Weight Management */
.total-weight-box-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 16px;
  border-bottom: 2px solid #E5E7EB;
}

.total-label {
  font-size: 14px;
  font-weight: 600;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.total-weight-value-large {
  font-size: 32px;
  font-weight: 700;
  color: #1F2937;
}

/* Weight Item */
.weight-item {
  margin-bottom: 8px;
  padding: 0;
}

.weight-item.efficacy-item {
  padding-bottom: 12px;
  margin-bottom: 4px;
  border-bottom: 1px solid #E5E7EB;
}

.weight-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.weight-label-text {
  font-size: 14px;
  font-weight: 500;
  color: #1F2937;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.weight-label-text svg {
  flex-shrink: 0;
}

.weight-info-icon {
  width: 15px;
  height: 15px;
  color: #9CA3AF;
  flex-shrink: 0;
  cursor: help;
}

.weight-value-display {
  font-size: 14px;
  font-weight: 700;
  color: #3B82F6;
  min-width: 55px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.weight-hint {
  font-size: 12px;
  color: #9CA3AF;
  margin-top: 6px;
  line-height: 1.4;
}

/* Slider Styling */
.weight-slider {
  width: 100%;
  height: 5px;
  background: #E5E7EB;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  margin: 0;
}

.weight-slider::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
}

.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  background: #FFFFFF;
  border: 2px solid #3B82F6;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.25);
  margin-top: -10px;
}

.weight-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
  border-color: #2563EB;
}

.weight-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: #FFFFFF;
  border: 2px solid #3B82F6;
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 4px rgba(59, 130, 246, 0.25);
}

.weight-slider::-moz-range-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.35);
  border-color: #2563EB;
}

/* Efficacy Slider - Visual Lock Indicator */
.efficacy-slider-wrapper {
  position: relative;
  width: 100%;
}

.efficacy-slider-track {
  position: relative;
  height: 5px;
  margin-bottom: 0;
}

.efficacy-locked-section {
  position: absolute;
  left: 0;
  top: 0;
  width: 20%;
  height: 5px;
  background: linear-gradient(90deg, #92400E, #B45309);
  border-radius: 3px 0 0 3px;
  z-index: 0;
}

.efficacy-slider {
  position: absolute;
  left: 20%;
  top: 0;
  width: 80%;
  background: #E5E7EB;
}

.efficacy-slider::-webkit-slider-thumb {
  background: #FFFFFF;
  border-color: #B45309;
  box-shadow: 0 1px 4px rgba(180, 83, 9, 0.25);
}

.efficacy-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35);
  border-color: #92400E;
}

.efficacy-slider::-moz-range-thumb {
  background: #FFFFFF;
  border-color: #B45309;
  box-shadow: 0 1px 4px rgba(180, 83, 9, 0.25);
}

.efficacy-slider::-moz-range-thumb:hover {
  box-shadow: 0 2px 8px rgba(180, 83, 9, 0.35);
  border-color: #92400E;
}

/* Section Divider */
.adverse-section-divider {
  margin: 24px 0 12px 0;
  text-align: center;
  position: relative;
}

.adverse-section-divider::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: linear-gradient(90deg, transparent, #D1D5DB, transparent);
  z-index: 0;
}

.divider-text {
  display: inline-block;
  background: #FFFFFF;
  padding: 0 16px;
  font-size: 11px;
  font-weight: 700;
  color: #6B7280;
  text-transform: uppercase;
  letter-spacing: 1px;
  position: relative;
  z-index: 1;
}

/* Exclusion Groups */
.exclusion-group {
  margin-bottom: 24px;
}

.exclusion-group h5 {
  color: #1F2937;
  margin-bottom: 0;
  padding: 10px 0;
  border-bottom: 2px solid #E5E7EB;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.exclusion-group h5 svg {
  flex-shrink: 0;
}

/* Exclusion Rows — compact table style */
.exclusion-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  min-height: 44px;
  border-bottom: 1px solid #F3F4F6;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}

.exclusion-item:last-child {
  border-bottom: none;
}

.exclusion-item:hover {
  background-color: #F9FAFB;
}

.exclusion-item.excluded {
  opacity: 0.6;
}

.exclusion-item.excluded:hover {
  opacity: 0.8;
}

/* Status dot */
.excl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #10B981;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}

.exclusion-item.excluded .excl-dot {
  background-color: #EF4444;
}

/* Medication name */
.excl-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #1F2937;
  transition: all 0.2s ease;
}

.exclusion-item.excluded .excl-name {
  text-decoration: line-through;
  color: #9CA3AF;
}

/* Med code */
.med-code {
  color: #9CA3AF;
  font-size: 12px;
  font-weight: 400;
  min-width: 70px;
}

.exclusion-item.excluded .med-code {
  color: #D1D5DB;
}

/* Action button / label */
.excl-action {
  font-size: 12px;
  font-weight: 600;
  color: #6B7280;
  padding: 4px 12px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-width: 72px;
  text-align: center;
}

.exclusion-item:hover .excl-action {
  border-color: #D1D5DB;
  color: #374151;
  background-color: #F9FAFB;
}

.exclusion-item.excluded .excl-action {
  border-color: transparent;
  background: none;
  color: #EF4444;
  font-weight: 700;
  padding: 4px 0;
  letter-spacing: 0.3px;
}

/* Navigation Buttons */
.nav-button-group {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid #E5E7EB;
}

.back-btn {
  background: none;
  border: none;
  color: #6B7280;
  font-size: 14px;
  cursor: pointer;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
  transition: all 0.2s;
}

.back-btn:hover {
  color: #1F2937;
}

.continue-btn {
  flex: 1;
  padding: 12px 16px;
  background-color: #3B82F6;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.continue-btn:hover {
  background-color: #2563EB;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.continue-btn:active {
  transform: translateY(0);
}

.continue-btn:disabled {
  background-color: #E5E7EB;
  color: #9CA3AF;
  cursor: not-allowed;
}

/* Results */
.results-header {
  margin-bottom: 16px;
}

.results-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.results-subtitle {
  font-size: 13px;
  color: #6B7280;
}

.result-item {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
  background-color: #FFFFFF;
  transition: all 0.2s ease;
  overflow: hidden;
}

.result-item:hover {
  border-color: #3B82F6;
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.1);
}

.result-top-row {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 12px;
  align-items: start;
}

.result-rank {
  font-size: 24px;
  font-weight: 700;
  color: #3B82F6;
  text-align: center;
}

/* CI Legend */
.ci-legend {
  background: #F0F9FF;
  border: 1px solid #BAE6FD;
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #0369A1;
  line-height: 1.4;
}
.ci-legend i { margin-right: 4px; }

/* Tier Headers */
.tier-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  margin-top: 12px;
  margin-bottom: 0;
  border-radius: 8px 8px 0 0;
  font-size: 13px;
  font-weight: 600;
}
.tier-header .tier-label { font-weight: 700; }
.tier-header .tier-count { font-weight: 400; opacity: 0.7; }

.tier-header.tier-1 { background: #ECFDF5; color: #065F46; border: 1px solid #A7F3D0; border-bottom: none; }
.tier-header.tier-2 { background: #FEF9C3; color: #713F12; border: 1px solid #FDE68A; border-bottom: none; }
.tier-header.tier-3 { background: #FFF7ED; color: #9A3412; border: 1px solid #FED7AA; border-bottom: none; }
.tier-header.tier-4 { background: #FEF2F2; color: #991B1B; border: 1px solid #FECACA; border-bottom: none; }
.tier-header.tier-5 { background: #F3F4F6; color: #374151; border: 1px solid #D1D5DB; border-bottom: none; }
.tier-header.tier-6 { background: #EDE9FE; color: #5B21B6; border: 1px solid #C4B5FD; border-bottom: none; }
.tier-header.tier-7 { background: #F0F9FF; color: #075985; border: 1px solid #BAE6FD; border-bottom: none; }

/* Tier Containers */
.tier-container {
  margin-bottom: 16px;
  border-radius: 0 0 8px 8px;
  padding: 8px;
}
.tier-container .result-item:last-child { margin-bottom: 0; }

.tier-container.tier-1 { background: #F0FDF4; border: 1px solid #A7F3D0; border-top: none; }
.tier-container.tier-2 { background: #FFFBEB; border: 1px solid #FDE68A; border-top: none; }
.tier-container.tier-3 { background: #FFF7ED; border: 1px solid #FED7AA; border-top: none; }
.tier-container.tier-4 { background: #FEF2F2; border: 1px solid #FECACA; border-top: none; }
.tier-container.tier-5 { background: #F9FAFB; border: 1px solid #D1D5DB; border-top: none; }
.tier-container.tier-6 { background: #F5F3FF; border: 1px solid #C4B5FD; border-top: none; }
.tier-container.tier-7 { background: #F0F9FF; border: 1px solid #BAE6FD; border-top: none; }

/* Show-placebo toggle (PPI item 6, reworked): placebo is DEFAULT-HIDDEN and never
   ranked — it renders as a separate unranked "Reference" section after the tiers.
   .placebo-hidden (the default; applied by optimizer.js applyPlaceboVisibility) hides
   that whole section, the placebo comparison line inside every medication card, and
   the "(compared with placebo)" hint. Toggled on #results-list. */
.placebo-hidden .result-item.is-placebo { display: none; }
.placebo-hidden .ae-bar-line-plb { display: none; }
.placebo-hidden .placebo-ref-section { display: none; }
.placebo-hidden .profile-hint-plb { display: none; }

/* Neutral (grey) styling for the unranked placebo Reference section + its card
   header — deliberately outside the tier colour scale. */
.tier-section.tier-ref { background: #F9FAFB; border-color: #D1D5DB; }
.tier-section.tier-ref .tier-section-badge { background: #F3F4F6; color: #4B5563; border-color: #D1D5DB; }
.result-card-header.tier-ref .rch-rank { color: #6B7280; }

/* Tier group section (PPI item 7): a clearly delineated box per tier — a colored
   header (tier name + option count + plain-language description) above the
   horizontal strip of that tier's cards. The tinted box + pill make the tier
   band unmistakable for patients without relying on the small in-card label. */
.tier-section {
  border: 1px solid #E5E7EB;
  border-radius: 16px;
  padding: 14px 16px 16px;
  margin-bottom: 18px;
  background: #FFFFFF;
}
.tier-section-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.tier-section-badge {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.tier-section-count {
  font-size: 12px;
  font-weight: 600;
  color: #6B7280;
}
.tier-section-desc {
  font-size: 12.5px;
  color: #9CA3AF;
  margin-left: auto;
  line-height: 1.35;
}

/* Per-tier tints: a soft section background so the white cards lift off it, plus
   a stronger colored pill. Mirrors the rank/score accent colors already used in
   the card headers. */
.tier-section.tier-1 { background: #F4FDF8; border-color: #BBF7D0; }
.tier-section.tier-1 .tier-section-badge { background: #ECFDF5; color: #065F46; border-color: #A7F3D0; }
.tier-section.tier-2 { background: #FFFDF4; border-color: #FDE68A; }
.tier-section.tier-2 .tier-section-badge { background: #FEF9C3; color: #713F12; border-color: #FDE68A; }
.tier-section.tier-3 { background: #FFFAF4; border-color: #FED7AA; }
.tier-section.tier-3 .tier-section-badge { background: #FFEDD5; color: #9A3412; border-color: #FED7AA; }
.tier-section.tier-4 { background: #FFF8F8; border-color: #FECACA; }
.tier-section.tier-4 .tier-section-badge { background: #FEE2E2; color: #991B1B; border-color: #FECACA; }
.tier-section.tier-5 { background: #FAFBFC; border-color: #E5E7EB; }
.tier-section.tier-5 .tier-section-badge { background: #F3F4F6; color: #374151; border-color: #E5E7EB; }
.tier-section.tier-6 { background: #FBFAFF; border-color: #DDD6FE; }
.tier-section.tier-6 .tier-section-badge { background: #EDE9FE; color: #5B21B6; border-color: #C4B5FD; }
.tier-section.tier-7 { background: #F6FCFF; border-color: #BAE6FD; }
.tier-section.tier-7 .tier-section-badge { background: #E0F2FE; color: #075985; border-color: #BAE6FD; }

/* Same-tier cards on one horizontal row. Cards now FLEX-GROW to fill the strip
   so 1–2 cards use the available width instead of being pinned to a fixed,
   compressed size. Many-card tiers exceed the row and scroll horizontally. */
/* Same-tier cards: a WRAPPING grid, not a horizontal scroller. The old overflow-x strip
   compressed 3-up tiers until bars and names truncated behind a scrollbar; auto-fit +
   minmax keeps every card at a readable width and simply wraps 3 cards to 2+1 (then 1-col
   on phones) inside the tinted tier box, so the tier grouping cue survives without any
   hidden content. Cards in the same row stretch to equal height for honest comparison. */
.tier-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 14px;
  align-items: stretch;
}
.tier-strip > .result-item {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.tier-strip > .result-item .result-card-body {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}
.tier-strip > .result-item .collapsible-details { margin-top: auto; }
/* Dense AE bars need a tighter label column at the narrower card width. */
.tier-strip > .result-item .ae-bar-label {
  min-width: 100px;
  width: 100px;
}

/* ---- Medication concerns (PPI item 3) ---- */
/* Editor pills on the patient dashboard + read-only recap in activity1 step 2. */
.concern-group {
  border: 1px solid #F3F4F6;
  border-radius: 8px;
  overflow: hidden;
}
.concern-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 8px;
  min-height: 44px;
  border-bottom: 1px solid #F3F4F6;
  cursor: pointer;
  transition: background 0.15s ease;
  user-select: none;
}
.concern-item:last-child { border-bottom: none; }
.concern-item:hover { background-color: #FFFBEB; }
.concern-item.flagged { background-color: #FFFBEB; }
.concern-item-readonly { cursor: default; }
.concern-item-readonly:hover { background-color: #FFFBEB; }
.concern-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #D1D5DB;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
}
.concern-item.flagged .concern-dot { background-color: #F59E0B; }
.concern-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #1F2937;
}
.concern-item.flagged .concern-name { color: #92400E; }
.concern-action {
  font-size: 12px;
  font-weight: 600;
  color: #6B7280;
  padding: 4px 12px;
  border: 1px solid #E5E7EB;
  border-radius: 6px;
  transition: all 0.15s ease;
  white-space: nowrap;
  min-width: 78px;
  text-align: center;
}
.concern-item:hover .concern-action {
  border-color: #FCD34D;
  color: #92400E;
  background-color: #FEF3C7;
}
.concern-item.flagged .concern-action {
  border-color: #F59E0B;
  background-color: #FEF3C7;
  color: #92400E;
  font-weight: 700;
}
.concern-item-readonly .concern-action {
  border-color: #F59E0B;
  background-color: #FEF3C7;
  color: #92400E;
  font-weight: 700;
}
.concern-empty {
  font-size: 13px;
  color: #6B7280;
  padding: 12px 8px;
}

/* Read-only profile recap shown as step 1 when demographics come from the profile. */
.profile-recap {
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 4px 16px;
  margin-bottom: 16px;
  background-color: #F9FAFB;
}
.profile-recap-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid #EEF0F2;
}
.profile-recap-row:last-of-type { border-bottom: none; }
.profile-recap-label {
  font-size: 13px;
  font-weight: 500;
  color: #6B7280;
}
.profile-recap-value {
  font-size: 15px;
  font-weight: 600;
  color: #1F2937;
}
.profile-recap-note {
  font-size: 12px;
  color: #9CA3AF;
  margin: 4px 0 12px;
}

/* Patient-reported error alarm banner on the clinician's patient sheet. */
.patient-alert {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background-color: #FFFBEB;
  border: 1px solid #F59E0B;
  border-left-width: 4px;
  border-radius: 10px;
}
.patient-alert-icon { flex-shrink: 0; }
.patient-alert-body { flex: 1; min-width: 0; }
.patient-alert-title {
  font-size: 14px;
  font-weight: 700;
  color: #92400E;
}
.patient-alert-msg {
  font-size: 13px;
  color: #78350F;
  margin-top: 2px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* Warning badge + card accent on the results page for flagged medications. */
.rch-concern {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  color: #92400E;
  background-color: #FEF3C7;
  border: 1px solid #F59E0B;
  border-radius: 6px;
  padding: 2px 8px;
  white-space: nowrap;
}
.result-item.has-concern {
  border-left: 3px solid #F59E0B;
}

.result-details h5 {
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Result card header — two stacked rows so the medication name always has the
   full card width to itself. In the narrow (340px) tier-strip cards a single
   flex row left almost no room for the name and `overflow-wrap: anywhere` then
   shattered long names ("Lisdexamfetamine") one character per line.
   Line 1: rank + name.  Line 2: tier badge (left) + PETRA score (right). */
.result-card-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 9px 9px 0 0;
  margin: -14px -14px 0;
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
}
.rch-line-1 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  min-width: 0;
}
.rch-line-2 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rch-rank {
  font-size: 18px;
  font-weight: 800;
  min-width: 24px;
  color: #374151;
  flex-shrink: 0;
}
.result-card-header.tier-1 .rch-rank { color: #059669; }
.result-card-header.tier-2 .rch-rank { color: #D97706; }
.result-card-header.tier-3 .rch-rank { color: #EA580C; }
.result-card-header.tier-4 .rch-rank { color: #DC2626; }

.rch-name {
  font-size: 15px;
  font-weight: 600;
  color: #1F2937;
  flex: 1;
  min-width: 0;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.rch-tier {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 3px 10px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  border: 1px solid;
}
.result-card-header.tier-1 .rch-tier { background: #F0FDF4; color: #166534; border-color: #BBF7D0; }
.result-card-header.tier-2 .rch-tier { background: #FEFCE8; color: #854D0E; border-color: #FEF08A; }
.result-card-header.tier-3 .rch-tier { background: #FFF7ED; color: #9A3412; border-color: #FED7AA; }
.result-card-header.tier-4 .rch-tier { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }
.result-card-header.tier-5 .rch-tier { background: #F9FAFB; color: #6B7280; border-color: #E5E7EB; }
.result-card-header.tier-6 .rch-tier { background: #F5F3FF; color: #7C3AED; border-color: #DDD6FE; }
.result-card-header.tier-7 .rch-tier { background: #F0F9FF; color: #0369A1; border-color: #BAE6FD; }

.rch-tier-count {
  font-weight: 400;
  opacity: 0.7;
  margin-left: 2px;
}

/* In-card position indicator ("Option 1 of 2") on header line 2. The full tier
   name now lives in the tier-section header above, so the card only needs to
   say where this option sits within its tier. */
.rch-position {
  font-size: 11px;
  font-weight: 600;
  color: #6B7280;
  white-space: nowrap;
}

.rch-score-wrap {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  flex-shrink: 0;
}

.rch-score-label {
  font-size: 8px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9CA3AF;
  line-height: 1;
  margin-bottom: 1px;
}

.rch-score {
  font-size: 22px;
  font-weight: 800;
  color: #059669;
  line-height: 1;
}

.rch-ci {
  font-size: 10px;
  font-weight: 400;
  color: #9CA3AF;
  line-height: 1;
  margin-top: 1px;
}

.result-card-body {
  padding: 14px 16px 0;
}

@media (max-width: 576px) {
  .result-item { padding: 10px; }
  .tier-section { padding: 12px 10px 12px; border-radius: 12px; }
  .tier-section-desc { margin-left: 0; flex-basis: 100%; }
  .tier-strip { grid-template-columns: 1fr; }
  .result-card-header {
    gap: 6px;
    padding: 10px 10px;
    margin: -10px -10px 0;
  }
  .result-card-body { padding: 10px 10px 0; }
  .rch-rank { font-size: 15px; min-width: 18px; }
  .rch-name { font-size: 13px; }
  .rch-tier { font-size: 8px; padding: 2px 6px; letter-spacing: 0.3px; }
  .rch-score { font-size: 18px; }
  .rch-score-label { font-size: 7px; letter-spacing: 0.5px; }
  .rch-ci { font-size: 9px; }
}

.result-details .badge {
  font-size: 11px;
  padding: 2px 6px;
}

.result-details p {
  font-size: 12px;
  color: #6B7280;
  margin-bottom: 2px;
  line-height: 1.3;
}

.result-details strong {
  color: #374151;
  font-weight: 600;
}

.result-score-container {
  text-align: right;
  white-space: nowrap;
}

.result-score-label {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #9CA3AF;
  line-height: 1;
  margin-bottom: 2px;
}

.result-score {
  font-size: 24px;
  font-weight: 800;
  color: #059669;
  line-height: 1;
}

.ci-score-text {
  font-size: 12px;
  color: #6B7280;
  font-weight: 400;
}

/* Full-width CI bar below medication details */
.ci-bar-section {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #F3F4F6;
}

.ci-bar-labels {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
  font-size: 11px;
  color: #9CA3AF;
}

.ci-bar-labels .ci-label-score {
  font-weight: 600;
  color: #059669;
}

.score-bar-wrapper {
  position: relative;
  height: 18px;
  background: rgba(243, 244, 246, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 9px;
  overflow: hidden;
}

.score-bar-ci {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.15), rgba(16, 185, 129, 0.35), rgba(16, 185, 129, 0.15));
  border-radius: 9px;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.score-bar-point {
  position: absolute;
  top: 2px;
  height: calc(100% - 4px);
  width: 6px;
  background: #059669;
  border-radius: 3px;
  box-shadow: 0 0 4px rgba(5, 150, 105, 0.5);
}

/* Tick marks on CI bar */
.ci-bar-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 2px;
  font-size: 9px;
  color: #D1D5DB;
  padding: 0 1px;
}

/* Summary Overview Section */
.summary-overview {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 16px;
}

.summary-title {
  font-size: 14px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.summary-title i { color: #3B82F6; font-size: 13px; }

.summary-tier-group {
  margin-bottom: 10px;
}

.summary-tier-group:last-child { margin-bottom: 0; }

.summary-tier-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 4px;
  display: inline-block;
  margin-bottom: 6px;
}

.summary-tier-label.tier-1 { background: #ECFDF5; color: #065F46; }
.summary-tier-label.tier-2 { background: #FEF9C3; color: #713F12; }
.summary-tier-label.tier-3 { background: #FFF7ED; color: #9A3412; }
.summary-tier-label.tier-4 { background: #FEF2F2; color: #991B1B; }
.summary-tier-label.tier-5 { background: #F3F4F6; color: #374151; }
.summary-tier-label.tier-6 { background: #EDE9FE; color: #5B21B6; }
.summary-tier-label.tier-7 { background: #F0F9FF; color: #075985; }

.summary-bar-row {
  display: grid;
  grid-template-columns: 110px 1fr 55px;
  gap: 8px;
  align-items: center;
  margin-bottom: 4px;
}

.summary-med-name {
  font-size: 11px;
  font-weight: 500;
  color: #374151;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-bar-track {
  position: relative;
  height: 14px;
  background: rgba(243, 244, 246, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(209, 213, 219, 0.5);
  border-radius: 7px;
  overflow: hidden;
}

.summary-bar-ci {
  position: absolute;
  top: 0;
  height: 100%;
  background: linear-gradient(90deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.30), rgba(16, 185, 129, 0.12));
  border-radius: 7px;
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.summary-bar-point {
  position: absolute;
  top: 2px;
  height: calc(100% - 4px);
  width: 5px;
  background: #059669;
  border-radius: 2.5px;
  box-shadow: 0 0 3px rgba(5, 150, 105, 0.4);
}

.summary-score-text {
  font-size: 11px;
  font-weight: 600;
  color: #059669;
  text-align: right;
}

.summary-scale {
  display: grid;
  grid-template-columns: 110px 1fr 55px;
  gap: 8px;
  margin-top: 6px;
  padding-top: 4px;
  border-top: 1px solid #F3F4F6;
}

.summary-scale-ticks {
  display: flex;
  justify-content: space-between;
  font-size: 9px;
  color: #D1D5DB;
  padding: 0 1px;
}

/* Profile sections (efficacy + AE bars) */
.profile-sections {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #F3F4F6;
}

/* Column headers row — aligns with the ae-bar-row grid */
.ae-column-headers {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid #F3F4F6;
}

.ae-col-weight {
  width: 28px;
  flex-shrink: 0;
  font-size: 9px;
  font-weight: 700;
  color: #9CA3AF;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  text-align: center;
}

.ae-col-criterion {
  min-width: 140px;
  width: 140px;
  flex-shrink: 0;
}

.ae-col-bars {
  flex: 1;
}

/* Section label row — uses the bar-row grid so it aligns with bars */
.ae-section-label-row {
  margin-bottom: 4px;
}

.profile-section-label {
  font-size: 11px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0;
}

.profile-section-hint {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: #9CA3AF;
  font-size: 10px;
}

@media (max-width: 480px) {
  .ae-col-criterion { min-width: 80px; width: 80px; }
}

/* Efficacy bar */
.efficacy-bar-section {
  margin-bottom: 10px;
}

.efficacy-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.efficacy-bar-track {
  flex: 1;
  height: 12px;
  background: #F3F4F6;
  border: 1px solid #D1D5DB;
  border-radius: 6px;
  overflow: hidden;
}

.efficacy-bar-fill {
  height: 100%;
  border-radius: 6px;
  border: 1px solid #047857;
  transition: width 0.3s ease;
}

.efficacy-level {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 90px;
  text-align: right;
}

/* Adverse effect bars */
.ae-profile-section {
  margin-bottom: 6px;
}

.ae-bar-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

/* Weight circle indicator — positioned before the label */
.ae-weight-circle {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.ae-weight-circle-svg {
  width: 28px;
  height: 28px;
}

.ae-bar-label {
  font-size: 11px;
  color: #6B7280;
  min-width: 140px;
  width: 140px;
  text-align: right;
  flex-shrink: 0;
}

/* Dual bar layout (medication + placebo) — same height bars */
.ae-dual-bars {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.ae-bar-line {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ae-bar-track {
  flex: 1;
  height: 10px;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 5px;
  overflow: hidden;
}

/* Right-side tag: medication name + value */
.ae-bar-tag {
  font-size: 10px;
  color: #374151;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 110px;
}

.ae-bar-tag strong {
  font-weight: 700;
}

.ae-bar-tag-plb {
  color: #9CA3AF;
}

.ae-bar-fill {
  height: 100%;
  border-radius: 5px;
  transition: width 0.3s ease;
}

.ae-bar-fill.ae-high { background: linear-gradient(90deg, #DC2626, #EF4444); }
.ae-bar-fill.ae-high-dim { background: linear-gradient(90deg, rgba(220,38,38,0.3), rgba(239,68,68,0.3)); }
.ae-bar-fill.ae-efficacy { background: linear-gradient(90deg, #059669, #10B981); }
.ae-bar-fill.ae-efficacy-dim { background: linear-gradient(90deg, rgba(5,150,105,0.3), rgba(16,185,129,0.3)); }
.ae-bar-fill.ae-placebo { background: #D1D5DB; }

/* Collapsible details toggle */
.collapsible-details {
  margin-top: 6px;
  border-top: 1px solid #F3F4F6;
  padding-top: 4px;
}

.details-toggle {
  background: none;
  border: none;
  color: #6B7280;
  font-size: 11px;
  cursor: pointer;
  padding: 4px 0;
  transition: color 0.2s;
}

.details-toggle:hover { color: #3B82F6; }

.details-toggle i {
  transition: transform 0.2s;
  margin-right: 4px;
}

.details-content {
  display: none;
  padding: 6px 0 2px;
  font-size: 12px;
  color: #6B7280;
  line-height: 1.4;
}

.result-item.details-open .details-content { display: block; }
.result-item.details-open .details-toggle i { transform: rotate(180deg); }

.result-action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.result-action-buttons button {
  padding: 10px 14px;
  font-size: 13px;
  border-radius: 8px;
  border: none;
  font-weight: 500;
  transition: all 0.2s;
}

.result-action-buttons .btn-secondary {
  background-color: #6B7280;
  color: white;
  flex: 1;
  min-width: 150px;
}

.result-action-buttons .btn-secondary:hover {
  background-color: #4B5563;
}

.result-action-buttons .btn-outline-primary {
  background-color: transparent;
  color: #3B82F6;
  border: 2px solid #3B82F6;
  flex: 1;
  min-width: 150px;
}

.result-action-buttons .btn-outline-primary:hover {
  background-color: #EBF5FF;
  border-color: #2563EB;
  color: #2563EB;
}

/* ============================================
   Results Action Row — rendered between the Overview and the detail cards.
   Layout: borderless "go back" link on the left, two CTAs grouped on the right.
   ============================================ */
.results-action-row {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
}

.results-action-group {
  display: inline-flex;
  gap: 8px;
  align-items: stretch;
  margin-left: auto;
}

/* Tertiary "link" button — no border, no background, subtle */
.results-action-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 2px;
  background: none;
  border: none;
  color: #6B7280;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.2;
  cursor: pointer;
  transition: color 0.15s ease;
  white-space: nowrap;
}

.results-action-link:hover {
  color: #111827;
}

.results-action-link:active {
  color: #374151;
}

.results-action-link svg {
  flex-shrink: 0;
  transition: transform 0.15s ease;
}

.results-action-link:hover svg {
  transform: translateX(-2px);
}

/* Shared CTA button base */
.results-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
  white-space: nowrap;
}

.results-action-btn svg {
  flex-shrink: 0;
}

.results-action-btn:active {
  transform: translateY(1px);
}

.results-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Secondary CTA — clean white with subtle border (Download PDF) */
.results-action-btn-secondary {
  background-color: #FFFFFF;
  color: #374151;
  border-color: #D1D5DB;
}

.results-action-btn-secondary:hover {
  background-color: #F9FAFB;
  border-color: #9CA3AF;
  color: #111827;
}

/* Primary CTA — solid brand blue (Save Results) */
.results-action-btn-primary {
  background-color: #2563EB;
  color: #FFFFFF;
  border-color: #2563EB;
  box-shadow: 0 1px 2px rgba(37, 99, 235, 0.18);
}

.results-action-btn-primary:hover {
  background-color: #1D4ED8;
  border-color: #1D4ED8;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}

/* Narrow screens: stack the link above the CTAs; CTAs fill the row */
@media (max-width: 520px) {
  .results-action-row {
    gap: 10px;
    align-items: stretch;
  }
  .results-action-link {
    align-self: flex-start;
  }
  .results-action-group {
    width: 100%;
    margin-left: 0;
  }
  .results-action-btn {
    flex: 1 1 0;
  }
}

/* ============================================
   Optimizer History Page — Production Redesign
   ============================================ */

/* History Header */
.history-header {
  text-align: center;
  padding-top: 40px;
  padding-bottom: 8px;
}

.history-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #1F2937;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.history-header p {
  font-size: 14px;
  color: #6B7280;
}

/* ---- Run Card (collapsible) ---- */
.run-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: left;
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.run-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.run-card.latest {
  border-color: #93C5FD;
  box-shadow: 0 2px 12px rgba(59, 130, 246, 0.08);
}

/* Run header — clickable to collapse/expand */
.run-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.run-header:hover {
  background: #F9FAFB;
}

.run-chevron {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: #D1D5DB;
  transition: transform 0.3s ease, color 0.2s;
}

.run-card.open .run-chevron {
  transform: rotate(90deg);
  color: #3B82F6;
}

.run-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 20px;
  white-space: nowrap;
  flex-shrink: 0;
}

.run-badge.latest {
  background: #EFF6FF;
  color: #1E40AF;
}

.run-badge.older {
  background: #F3F4F6;
  color: #6B7280;
}

.run-meta {
  flex: 1;
  min-width: 0;
}

.run-date {
  font-size: 13px;
  font-weight: 600;
  color: #1F2937;
}

.run-date-abs {
  font-size: 11px;
  color: #9CA3AF;
  margin-left: 6px;
}

.run-pills {
  display: flex;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.run-pill {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #F3F4F6;
  color: #6B7280;
  white-space: nowrap;
}

/* Collapsed summary — top 3 meds as compact line */
.run-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.run-summary-med {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #374151;
}

.run-summary-med .sum-rank {
  font-weight: 700;
  font-size: 11px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sum-rank.r1 { background: #FEF3C7; color: #92400E; }
.sum-rank.r2 { background: #F3F4F6; color: #6B7280; }
.sum-rank.r3 { background: #FED7AA; color: #9A3412; }

.run-summary-med .sum-name {
  font-weight: 500;
}

.run-summary-med .sum-score {
  font-weight: 700;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
}

.sum-score.high { background: #DCFCE7; color: #166534; }
.sum-score.mid { background: #FEF9C3; color: #854D0E; }
.sum-score.low { background: #F3F4F6; color: #6B7280; }

.run-summary-more {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 500;
}

/* Run body — collapsible content */
.run-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease;
}

.run-card.open .run-body {
  max-height: 5000px;
}

.run-body-inner {
  padding: 0 20px 20px;
}

/* ---- Tier grouping ---- */
.tier-group {
  margin-bottom: 16px;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  overflow: hidden;
  background: #FFFFFF;
}

.tier-label-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 12px;
  font-weight: 600;
  color: #6B7280;
  background: #F9FAFB;
  border-bottom: 1px solid #E5E7EB;
}

.tier-label-bar .tier-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.tier-label-bar.t1 .tier-badge { background: #ECFDF5; color: #065F46; }
.tier-label-bar.t2 .tier-badge { background: #FEF9C3; color: #854D0E; }
.tier-label-bar.t3 .tier-badge { background: #FFEDD5; color: #9A3412; }
.tier-label-bar.t4 .tier-badge { background: #FEE2E2; color: #991B1B; }
.tier-label-bar.t5 .tier-badge { background: #F3F4F6; color: #6B7280; }

.tier-label-bar .tier-desc {
  font-size: 11px;
  font-weight: 400;
  color: #9CA3AF;
}

.tier-meds {
  background: #FFFFFF;
}

/* ---- Medication row ---- */
.med-item {
  border: none;
  border-bottom: 1px solid #F3F4F6;
  border-radius: 0;
  margin-bottom: 0;
  overflow: hidden;
  transition: background 0.15s;
}

.med-item:last-child {
  border-bottom: none;
}

.med-item:hover {
  background: #FAFBFF;
}

.med-item-header {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  cursor: pointer;
  background: transparent;
  gap: 10px;
}

.med-item-header:hover {
  background: transparent;
}

.med-rank {
  font-weight: 700;
  font-size: 12px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: #F3F4F6;
  color: #6B7280;
}

.med-rank.top-1 { background: #FEF3C7; color: #92400E; }
.med-rank.top-2 { background: #F3F4F6; color: #4B5563; }
.med-rank.top-3 { background: #FED7AA; color: #9A3412; }

.med-name-col {
  flex: 1;
  min-width: 0;
}

.med-name-col .med-name {
  font-size: 14px;
  font-weight: 600;
  color: #1F2937;
}

.med-name-col .med-formulation {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 400;
  margin-left: 4px;
}

/* Score badge — colored by tier */
.med-score-badge {
  font-weight: 700;
  font-size: 13px;
  padding: 3px 10px;
  border-radius: 8px;
  flex-shrink: 0;
  min-width: 48px;
  text-align: center;
  background: #F3F4F6;
  color: #6B7280;
}

.med-score-badge.score-t1 { background: #ECFDF5; color: #065F46; }
.med-score-badge.score-t2 { background: #FEF9C3; color: #854D0E; }
.med-score-badge.score-t3 { background: #FFEDD5; color: #9A3412; }
.med-score-badge.score-t4 { background: #FEE2E2; color: #991B1B; }
.med-score-badge.score-t5 { background: #F3F4F6; color: #6B7280; }

/* Fallback for legacy score-based classes */
.med-score-badge.score-high { background: #ECFDF5; color: #065F46; }
.med-score-badge.score-mid { background: #FEF9C3; color: #854D0E; }
.med-score-badge.score-low { background: #F3F4F6; color: #6B7280; }

/* CI bar in medication rows */
.med-ci-bar {
  position: relative;
  width: 120px;
  height: 16px;
  background: #F3F4F6;
  border-radius: 8px;
  overflow: hidden;
  flex-shrink: 0;
  border: 1px solid #E5E7EB;
}

.med-ci-range {
  position: absolute;
  top: 0;
  height: 100%;
  border-radius: 8px;
  opacity: 0.35;
}

/* CI range colored by tier */
.med-ci-range.ci-t1 { background: #10B981; }
.med-ci-range.ci-t2 { background: #F59E0B; }
.med-ci-range.ci-t3 { background: #F97316; }
.med-ci-range.ci-t4 { background: #EF4444; }
.med-ci-range.ci-t5 { background: #9CA3AF; }

/* Legacy fallback */
.med-ci-range.ci-high { background: #10B981; }
.med-ci-range.ci-mid { background: #F59E0B; }
.med-ci-range.ci-low { background: #9CA3AF; }

.med-ci-point {
  position: absolute;
  top: 2px;
  height: calc(100% - 4px);
  width: 5px;
  border-radius: 2.5px;
  box-shadow: 0 0 4px rgba(0,0,0,0.2);
}

/* CI point colored by tier */
.med-ci-point.pt-t1 { background: #059669; }
.med-ci-point.pt-t2 { background: #D97706; }
.med-ci-point.pt-t3 { background: #EA580C; }
.med-ci-point.pt-t4 { background: #DC2626; }
.med-ci-point.pt-t5 { background: #6B7280; }

/* Legacy fallback */
.med-ci-point.pt-high { background: #059669; }
.med-ci-point.pt-mid { background: #D97706; }
.med-ci-point.pt-low { background: #6B7280; }

.med-ci-text {
  font-size: 10px;
  color: #9CA3AF;
  text-align: center;
  margin-top: 2px;
  line-height: 1;
  white-space: nowrap;
}

/* Score bar fallback (no CI) */
.score-bar-bg {
  width: 50px;
  height: 4px;
  background: #E5E7EB;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
}

.score-bar-fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s ease;
}

.score-bar-fill.fill-t1 { background: #10B981; }
.score-bar-fill.fill-t2 { background: #F59E0B; }
.score-bar-fill.fill-t3 { background: #F97316; }
.score-bar-fill.fill-t4 { background: #EF4444; }
.score-bar-fill.fill-t5 { background: #9CA3AF; }

/* Legacy fallback */
.score-bar-fill.fill-high { background: #10B981; }
.score-bar-fill.fill-mid { background: #F59E0B; }
.score-bar-fill.fill-low { background: #D1D5DB; }

.med-expand-icon {
  color: #D1D5DB;
  font-size: 10px;
  flex-shrink: 0;
  transition: transform 0.25s ease;
}

.med-item.expanded .med-expand-icon {
  transform: rotate(90deg);
  color: #3B82F6;
}

.med-details {
  display: none;
  padding: 12px 14px 14px 52px;
  font-size: 13px;
  line-height: 1.5;
  background: #FAFBFF;
  border-top: 1px solid #F3F4F6;
}

.med-item.expanded .med-details {
  display: block;
}

.med-detail-label {
  font-weight: 600;
  color: #374151;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
  margin-top: 10px;
}

.med-detail-label:first-child {
  margin-top: 0;
}

.med-detail-value {
  color: #4B5563;
  font-size: 13px;
}

/* ---- Run footer (settings/exclusions) ---- */
.run-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding-top: 12px;
  margin-top: 12px;
  border-top: 1px solid #F3F4F6;
}

.run-footer-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: #6B7280;
}

.efficacy-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 600;
  font-size: 12px;
}

.efficacy-mini-bar {
  width: 40px;
  height: 4px;
  background: #E5E7EB;
  border-radius: 2px;
  overflow: hidden;
}

.efficacy-mini-fill {
  height: 100%;
  border-radius: 2px;
  background: #3B82F6;
}

.excl-pill {
  font-size: 11px;
  padding: 1px 8px;
  border-radius: 10px;
  background: #FEF2F2;
  color: #991B1B;
  text-decoration: line-through;
}

/* ---- History toolbar (manage button) ---- */
.history-toolbar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.manage-runs-btn {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  color: #6B7280;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.manage-runs-btn:hover {
  border-color: #3B82F6;
  color: #3B82F6;
  background: #EFF6FF;
}

.manage-runs-btn.active {
  background: #FEF2F2;
  border-color: #FECACA;
  color: #EF4444;
}

/* ---- Select mode ---- */
.run-select-check {
  display: none;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  cursor: pointer;
  accent-color: #3B82F6;
}

.select-mode .run-select-check {
  display: block;
}

.select-mode .run-chevron,
.select-mode .run-header-delete {
  display: none;
}

.run-card.selected {
  border-color: #3B82F6;
  background: #F0F7FF;
}

.run-card.selected .run-header {
  background: #EFF6FF;
}

/* ---- Floating action bar ---- */
.select-action-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: #1F2937;
  padding: 12px 20px;
  z-index: 1000;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.15);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

.select-action-bar.visible {
  transform: translateY(0);
}

.select-action-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.select-action-count {
  color: rgba(255,255,255,0.8);
  font-size: 14px;
  font-weight: 600;
}

.select-delete-btn {
  background: #EF4444;
  color: #FFFFFF;
  border: none;
  padding: 8px 20px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s;
}

.select-delete-btn:hover {
  background: #DC2626;
}

/* ---- Delete button on run header ---- */
.run-header-delete {
  background: none;
  border: none;
  color: #D1D5DB;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  display: flex;
  align-items: center;
}

.run-header-delete:hover {
  color: #EF4444;
  background: #FEF2F2;
}

/* ---- Delete run button (in footer) ---- */
.run-delete-btn {
  background: none;
  border: 1px solid #E5E7EB;
  color: #9CA3AF;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s;
}

.run-delete-btn:hover {
  color: #EF4444;
  border-color: #FECACA;
  background: #FEF2F2;
}

.run-footer .ms-auto {
  margin-left: auto;
}

/* ---- Tried medication ---- */
.med-tried-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #F3F4F6;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tried-btn {
  background: #F9FAFB;
  border: 1px solid #E5E7EB;
  color: #6B7280;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all 0.15s;
}

.tried-btn:hover {
  border-color: #3B82F6;
  color: #3B82F6;
  background: #EFF6FF;
}

.tried-btn.active {
  background: #FEF3C7;
  border-color: #F59E0B;
  color: #92400E;
}

.tried-btn.active:hover {
  background: #FDE68A;
}

.tried-btn.done {
  background: #ECFDF5;
  border-color: #10B981;
  color: #065F46;
}

.tried-dates {
  font-size: 11px;
  color: #9CA3AF;
  font-weight: 500;
}

/* Tried indicator on med row header */
.tried-indicator {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  background: #FEF3C7;
  color: #92400E;
  margin-left: 6px;
  vertical-align: middle;
}

.med-item.tried {
  border-left: 3px solid #F59E0B;
}

/* ---- Backward compat: .history-card (for latest results standalone) ---- */
.history-card {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  text-align: left;
}

/* ---- Legacy compat ---- */
.weights-summary {
  font-size: 12px;
  color: #6B7280;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #F3F4F6;
}

.no-history {
  text-align: center;
  padding: 60px 20px;
  color: #6B7280;
}

.no-history p {
  font-size: 15px;
  color: #9CA3AF;
}

/* Responsive */
@media (max-width: 480px) {
  .step-title {
    font-size: 24px;
  }

  .weight-slider-container {
    padding: 12px;
  }

  .result-top-row {
    grid-template-columns: 36px 1fr auto;
    gap: 8px;
  }
  .result-score { font-size: 18px; }
  .score-bar-wrapper { height: 14px; }
  .ae-bar-label { min-width: 80px; width: 80px; font-size: 10px; }
  .ae-bar-tag { min-width: 80px; font-size: 9px; }
  .ae-weight-circle { width: 24px; height: 24px; }
  .ae-weight-circle-svg { width: 24px; height: 24px; }
  .efficacy-level { min-width: 70px; font-size: 11px; }

  .summary-bar-row {
    grid-template-columns: 80px 1fr 45px;
    gap: 4px;
  }
  .summary-med-name { font-size: 10px; }
  .summary-score-text { font-size: 10px; }
  .summary-bar-track { height: 12px; }
}

/* ============================================
   PATIENT PROFILE FORM — q_baseline_1.html
   ============================================ */

/* Select dropdowns */
.profile-select {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #D1D5DB;
  border-radius: 10px;
  font-size: 14px;
  color: #30384d;
  background: #fff;
  appearance: auto;
  transition: border-color 0.2s;
}
.profile-select:focus {
  border-color: var(--bs-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* Number/text inputs */
.profile-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #D1D5DB;
  border-radius: 10px;
  font-size: 14px;
  color: #30384d;
  background: #fff;
  transition: border-color 0.2s;
}
.profile-input:focus {
  border-color: var(--bs-primary);
  outline: none;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

.profile-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: #6B7280;
  margin-bottom: 4px;
}

/* BMI display */
.bmi-display {
  padding: 10px 14px;
  background: #F3F4F6;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 600;
  color: #30384d;
  text-align: center;
}

/* CGI-S severity scale */
.cgis-scale {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.cgis-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
}
.cgis-option:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
}
.cgis-option input[type="radio"] {
  accent-color: var(--bs-primary);
}
.cgis-option input[type="radio"]:checked ~ .cgis-label {
  color: var(--bs-primary);
  font-weight: 700;
}
.cgis-label {
  font-weight: 600;
  font-size: 14px;
  color: #30384d;
  min-width: 20px;
}
.cgis-desc {
  font-size: 13px;
  color: #6B7280;
}

/* Checkbox grid (comorbidities, medications, family history) */
.checkbox-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.checkbox-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #E5E7EB;
  border-radius: 10px;
  font-size: 13px;
  color: #30384d;
  cursor: pointer;
  transition: all 0.2s;
}
.checkbox-item:hover {
  background: #F9FAFB;
  border-color: #D1D5DB;
}
.checkbox-item input[type="checkbox"] {
  accent-color: var(--bs-primary);
  flex-shrink: 0;
}

@media (max-width: 576px) {
  .checkbox-grid {
    grid-template-columns: 1fr;
  }
  .cgis-scale {
    gap: 4px;
  }
  .cgis-option {
    padding: 6px 10px;
  }
}

/* ============================================
   EDIT BUTTON (patient table)
   ============================================ */
.btn-edit {
  background: transparent;
  color: #3B82F6;
  border: 1px solid #93C5FD;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-edit:hover {
  background: #EFF6FF;
  border-color: #3B82F6;
}

.btn-remove {
  background: transparent;
  color: #EF4444;
  border: 1px solid #FECACA;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-remove:hover {
  background: #FEF2F2;
  border-color: #EF4444;
}

/* Patient demo notice — LOUD amber warning. In demo mode the medicines, order and scores are
   fictitious and reshuffle on every run, so this must be impossible to mistake for real results. */
.patient-demo-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  background: #FEF3C7;            /* amber-100 */
  border: 2px solid #F59E0B;     /* amber-500 */
  border-left-width: 8px;
  border-radius: 10px;
  color: #92400E;                /* amber-800 */
  line-height: 1.45;
}
.patient-demo-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #B45309;                /* amber-700 — icon stroke inherits via currentColor */
}
.patient-demo-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.patient-demo-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.01em;
}
.patient-demo-body {
  font-size: 14px;
  font-weight: 500;
}

/* Fail-closed block — the viewer's role could not be confirmed, so NO scores are shown (neither
   real nor demo). Deliberately alarming so a broken-role session is noticed, not trusted. */
.results-blocked-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px;
  margin-bottom: 16px;
  background: #FEF2F2;            /* red-50 */
  border: 2px solid #EF4444;     /* red-500 */
  border-left-width: 8px;
  border-radius: 10px;
  color: #991B1B;                /* red-800 */
  line-height: 1.45;
}
.results-blocked-notice svg {
  flex-shrink: 0;
  margin-top: 2px;
  color: #DC2626;                /* red-600 — icon stroke inherits via currentColor */
}
.results-blocked-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 800;
}
.results-blocked-body {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
}

/* Local preview indicator — dev-only, shown when the app runs from disk/localhost (never live).
   Dashed slate border signals a temporary, non-production state. */
.local-preview-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  background: #F1F5F9;          /* slate-100 */
  border: 1px dashed #94A3B8;   /* slate-400 */
  border-radius: 8px;
  font-size: 13px;
  color: #334155;              /* slate-700 */
  line-height: 1.45;
}
.local-preview-notice svg {
  flex-shrink: 0;
  margin-top: 1px;
  color: #64748B;              /* slate-500 */
}

/* Something about how these numbers were produced that the reader has to know, on a screen that
   is otherwise showing a recommendation. Amber, which everywhere in this app means "the numbers
   are not what they appear to be": a characteristic scored at the sample average because the
   models cannot express it, or figures that are still placeholders. Solid rather than dashed,
   because unlike the preview notice above this one appears on the live site. */
.results-caveat-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: #FFFBEB;          /* amber-50 */
  border: 1px solid #FCD34D;    /* amber-300 */
  border-radius: 8px;
  font-size: 13px;
  color: #78350F;               /* amber-900 */
  line-height: 1.45;
}
.results-caveat-notice svg { flex-shrink: 0; margin-top: 1px; color: #B45309; }

/* Under a field on the baseline form, when the honest answer is one the models cannot carry.
   Quiet rather than alarming: the clinician has answered correctly and is being told what the
   tool will do about it, not warned off. */
/* WHAT IS STILL MISSING, MARKED WHERE IT IS MISSING.
   Green once a required field is satisfied, red once it has been visited and left wrong, and
   nothing at all on a form nobody has touched yet. An untouched form is not a list of mistakes. */
.req-mark { color: #DC2626; font-weight: 700; }
.petra-req-legend {
  margin: 0 0 14px;
  font-size: 12px;
  color: var(--petra-ink-3, #64748B);
}
.petra-input.is-ok, .form-select.is-ok {
  border-color: #16A34A;                       /* green-600 */
  box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.10);
}
.petra-input.is-bad, .form-select.is-bad {
  border-color: #DC2626;                       /* red-600 */
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.10);
}

/* What happened to a participant link, on the dashboard the person landed on instead of the page
   they expected. Rare by design, so it sits above everything and is allowed to be noticed. */
.link-flow-note {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 11px 15px;
  margin-bottom: 16px;
  background: #EFF6FF;          /* blue-50 */
  border: 1px solid #BFDBFE;    /* blue-200 */
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #1E3A8A;               /* blue-900 */
}
.link-flow-btn {
  border: 1px solid #1D4ED8;
  background: #1D4ED8;
  color: #fff;
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}
.link-flow-btn:hover { background: #1E40AF; border-color: #1E40AF; }

.qb-f-note {
  margin: 6px 0 0;
  font-size: 11.5px;
  line-height: 1.45;
  color: var(--qb-ink-3, #64748B);
}

/* ============================================
   VIEW PATIENT DATA — Extended profile section
   ============================================ */
.vpd-profile-extended {
  border-top: 1px solid #E5E7EB;
  padding-top: 16px;
  margin-top: 4px;
}
.vpd-profile-details {
  padding: 0 8px;
}
.vpd-detail-row {
  display: flex;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #F3F4F6;
  font-size: 13px;
}
.vpd-detail-row:last-child {
  border-bottom: none;
}
.vpd-detail-label {
  font-weight: 600;
  color: #6B7280;
  min-width: 120px;
  flex-shrink: 0;
}
.vpd-detail-value {
  color: #30384d;
}

/* ============================================
   PETRA HERO — patient dashboard optimizer launch
   ============================================ */
.petra-hero {
    background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
    border: 1px solid #DBEAFE;
    border-radius: 16px;
    padding: 22px 24px;
    text-align: center;
}
.petra-hero-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 10px;
    border-radius: 50%;
    background: #3B82F6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(59, 130, 246, 0.28);
}
.petra-hero-title {
    font-size: 24px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 4px;
}
.petra-hero-desc {
    font-size: 14px;
    color: #6B7280;
    max-width: 560px;
    margin: 0 auto 12px;
    line-height: 1.5;
}
.petra-hero-cta {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.petra-hero-note {
    margin-top: 8px;
    font-size: 12px;
    color: #9CA3AF;
}
.petra-hero-timeline {
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 0;
    max-width: 520px;
    margin: 2px auto 14px;
}
.petra-hero-timeline-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    width: 120px;
}
.petra-hero-timeline-num {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid #3B82F6;
    color: #1D4ED8;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 10px rgba(59, 130, 246, 0.18);
    position: relative;
    z-index: 1;
}
.petra-hero-timeline-label {
    font-size: 12px;
    color: #374151;
    font-weight: 500;
    line-height: 1.3;
    text-align: center;
}
.petra-hero-timeline-connector {
    flex: 1 1 auto;
    height: 2px;
    background: linear-gradient(90deg, #BFDBFE 0%, #3B82F6 50%, #BFDBFE 100%);
    margin-top: 19px;
    max-width: 60px;
    min-width: 20px;
}
@media (max-width: 480px) {
    .petra-hero-timeline-step {
        width: auto;
        min-width: 72px;
    }
    .petra-hero-timeline-label {
        font-size: 11px;
    }
    .petra-hero-timeline-connector {
        max-width: 30px;
    }
}

/* ============================================
   PETRA PANEL — clinician dashboard quick-run CTA
   ============================================ */
.petra-panel {
    display: flex;
    align-items: stretch;
    gap: 28px;
    background: linear-gradient(135deg, #EFF6FF 0%, #F5F3FF 100%);
    border: 1px solid #DBEAFE;
    border-radius: 14px;
    padding: 24px 28px;
}
.petra-panel-content {
    flex: 1 1 auto;
}
.petra-panel .petra-hero-timeline {
    margin: 4px 0 0;
    justify-content: flex-start;
}
.petra-panel-title {
    font-size: 20px;
    font-weight: 700;
    color: #1F2937;
    margin: 0 0 6px;
}
.petra-panel-desc {
    font-size: 14px;
    color: #6B7280;
    margin: 0 0 14px;
    line-height: 1.5;
}
.petra-panel-cta-col {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 200px;
}
.petra-panel-cta-icon {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: #3B82F6;
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.25);
}
.petra-panel-cta {
    font-size: 15px;
    font-weight: 600;
    padding: 10px 26px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.petra-panel-cta-sub {
    font-size: 12px;
    color: #9CA3AF;
}

@media (max-width: 640px) {
    .petra-panel {
        flex-direction: column;
        text-align: center;
        padding: 20px 16px;
    }
    .petra-panel-cta-col {
        min-width: 0;
        width: 100%;
    }
    /* Timeline inside the panel: re-center (panel override set flex-start)
       and let the steps shrink so the row never exceeds the panel width. */
    .petra-panel .petra-hero-timeline {
        justify-content: center;
        max-width: 100%;
    }
    .petra-panel .petra-hero-timeline-step {
        width: auto;
        min-width: 0;
        flex: 1 1 0;
    }
    .petra-panel .petra-hero-timeline-connector {
        min-width: 12px;
        max-width: 24px;
    }
    .petra-panel .petra-hero-timeline-label {
        font-size: 11px;
    }
}

/* ============================================
   DASHBOARD REFRESH — row avatars, split
   status chips (errors / flags columns), and
   the CTU "tabbed workspace" console.

   Shared bits (.dash-bg, .name-cell, .dash-avatar,
   .cell-chip, .cell-none) apply to BOTH the
   clinician and CTU dashboards because both render
   their patient table via patients.js. The
   .dash-console / .dash-tab* block is CTU-only.
   ============================================ */

/* Soft page background so the white cards/console lift off the page */
.dash-bg { background: #F7F8FA; }

/* Compact left-aligned dashboard header (icon tile + title) */
.dash-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 8px 0 22px;
}
.dash-head-ic {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: #30384d;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.dash-head h1 {
  font-size: 25px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: #1F2937;
  margin: 0 0 3px;
}
.dash-head p {
  font-size: 13.5px;
  color: #6B7280;
  margin: 0;
}

/* Row avatar (initials) — used in the Name cell of both tables */
.name-cell {
  display: flex;
  align-items: center;
  gap: 11px;
}
.dash-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1;
  flex-shrink: 0;
}
.av-blue   { background: #EFF6FF; color: #1E40AF; }
.av-violet { background: #F3E8FF; color: #6B21A8; }
.av-teal   { background: #CCFBF1; color: #0F766E; }
.av-amber  { background: #FEF3C7; color: #92400E; }
.av-rose   { background: #FFE4E6; color: #9F1239; }

/* Status chips for the Errors / Flags columns */
.cell-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 7px;
  padding: 3px 8px;
  white-space: nowrap;
}
.cell-chip svg { flex-shrink: 0; }
.cell-error { color: #92400E; background: #FEF3C7; border: 1px solid #F59E0B; }
.cell-flag  { color: #1E40AF; background: #EFF6FF; border: 1px solid #93C5FD; }
.cell-none  { color: #D1D5DB; font-weight: 600; }
.cell-complete   { color: #166534; background: #F0FDF4; border: 1px solid #86EFAC; }
.cell-incomplete { color: #92400E; background: #FFFBEB; border: 1px solid #FCD34D; }

/* ---- CTU tabbed workspace console ---- */
.dash-console {
  background: #FFFFFF;
  border: 1px solid #E5E7EB;
  border-radius: 18px;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
  overflow: hidden;
}
.dash-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px;
  border-bottom: 1px solid #E5E7EB;
  flex-wrap: wrap;
}

/* Segmented tab control */
.dash-tabs {
  display: inline-flex;
  background: #F7F8FA;
  border: 1px solid #E5E7EB;
  border-radius: 11px;
  padding: 4px;
  gap: 2px;
}
.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  background: none;
  font-size: 13.5px;
  font-weight: 600;
  color: #6B7280;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
}
.dash-tab .tab-count {
  font-size: 11px;
  font-weight: 700;
  background: #E5E7EB;
  color: #6B7280;
  border-radius: 999px;
  padding: 1px 8px;
}
.dash-tab.active {
  background: #FFFFFF;
  color: #30384d;
  box-shadow: 0 1px 3px rgba(16, 24, 40, 0.12);
}
.dash-tab.active .tab-count { background: #3B82F6; color: #FFFFFF; }
.dash-tab:hover:not(.active) { color: #374151; }

.dash-tools-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Search box */
.dash-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #F7F8FA;
  border: 1px solid #E5E7EB;
  border-radius: 9px;
  padding: 8px 12px;
  min-width: 210px;
}
.dash-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  color: #1F2937;
  width: 100%;
  font-family: inherit;
}
.dash-search input::placeholder { color: #9CA3AF; }

/* Context-aware invite button */
.dash-invite {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
  background: #30384d;
  border: none;
  border-radius: 9px;
  padding: 9px 15px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.dash-invite:hover { background: #252b3d; color: #FFFFFF; }

/* Tab panes. The active pane scrolls internally (capped height) so the toolbar
   (tabs / search) AND the sticky column headers stay visible while a long list
   scrolls. Short lists never reach the cap, so no scrollbar appears. */
.dash-pane { display: none; }
.dash-pane.active {
  display: block;
  max-height: 70vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}
.dash-pane .empty-state { padding: 40px 20px; }

/* The table sits flush inside the console — the card already supplies the
   border + radius, so drop the table's own frame to avoid a double border. */
.dash-console .patients-table {
  border: none;
  border-radius: 0;
}

@media (max-width: 680px) {
  .dash-toolbar { flex-direction: column; align-items: stretch; }
  .dash-tabs { justify-content: center; }
  .dash-tools-right { justify-content: space-between; }
  .dash-search { min-width: 0; flex: 1; }
}

/* Patient dashboard — error-report acknowledgement banner. Lives inside the
   "All about my child" card (the report is about the child's profile). Clean
   soft-tint banner, no heavy left accent bar. */
.patient-notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 16px;
}
.patient-notice svg { flex-shrink: 0; margin-top: 1px; }
.patient-notice strong { font-weight: 700; }
.patient-notice-ok { background: #ECFDF5; border: 1px solid #A7F3D0; color: #065F46; }
.patient-notice-pending { background: #FFFBEB; border: 1px solid #FDE68A; color: #78350F; }

/* ---- Easy-win polish ---- */

/* 1. Keyboard focus rings. :focus-visible keeps them off mouse clicks, so they
      only appear for keyboard users — pure accessibility gain, no visual change
      for mouse users. Matters for a clinical tool. */
.dash-tab:focus-visible,
.dash-invite:focus-visible,
.btn-view:focus-visible,
.btn-edit:focus-visible,
.btn-optimize:focus-visible,
.btn-remove:focus-visible,
.btn-section-action:focus-visible {
  outline: 2px solid #3B82F6;
  outline-offset: 2px;
}

/* 2. Search box lights up while typing — mirrors the login-card input pattern. */
.dash-search:focus-within {
  border-color: #3B82F6;
  background: #FFFFFF;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}
.dash-search input:focus-visible { outline: none; }

/* 3. Flush the clinician dashboard's patient table inside its card — drop the
      table's own border/radius so it isn't a frame-within-a-frame (matches the
      clean look already used in the CTU console). */
.patients-section .patients-table {
  border: none;
  border-radius: 0;
}

/* 5. Sticky column headers — keep them visible while scrolling a long patient
      list. The table's base overflow:hidden (used elsewhere for corner
      rounding) traps a sticky header, so lift it in these two contexts — safe
      because both already drop the table border/radius. */
.dash-console .patients-table,
.patients-section .patients-table {
  overflow: visible;
}
.patients-table thead th {
  position: sticky;
  top: 56px;            /* sits just below the 56px-tall sticky app navbar */
  z-index: 2;
}
/* In the CTU console the pane scrolls internally (.dash-pane.active), so the
   header sticks to the top of the pane (0), not 56px down the page. */
.dash-console .patients-table thead th {
  top: 0;
}

/* 6. Row action buttons — a single tidy control cluster: three quiet icon-only secondaries
      (View / Edit / Remove) and one labelled primary ("Explore"). One accent, uniform height,
      so the group no longer reads as four competing colours or wraps into a staggered stack. */
.td-actions .row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
.row-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 30px;
  margin: 0;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
  border-radius: 7px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
/* pointer-events:none => a click on the icon lands on the button, keeping the row-click guard
   and each handler's stopPropagation() correct. */
.row-actions button svg { width: 14px; height: 14px; pointer-events: none; }

/* Icon-only secondaries — square, quiet neutral. Accessible names live in title/aria-label. */
.row-actions .btn-view,
.row-actions .btn-edit,
.row-actions .btn-remove {
  width: 30px;
  padding: 0;
  background: #FFFFFF;
  border-color: #E5E7EB;
  color: #4B5563;
}
.row-actions .btn-view:hover,
.row-actions .btn-edit:hover {
  background: #F9FAFB;
  border-color: #CBD5E1;
  color: #111827;
}
/* Remove reveals its danger only on intent. */
.row-actions .btn-remove:hover {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #DC2626;
}

/* Explore — the one primary action in the row. */
.row-actions .btn-optimize {
  background: #059669;
  border-color: #059669;
  color: #FFFFFF;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.2);
}
.row-actions .btn-optimize:hover {
  background: #047857;
  border-color: #047857;
  color: #FFFFFF;
}
/* Long emails were forcing the actions column to wrap. Cap + ellipsis (full
   address still available via the title tooltip on hover). */
.patients-table .patient-email {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

/* 7. Fixed column proportions per table variant + ellipsis truncation. Guarantees the table
      stays exactly the width of its card — a long free-text value (an email used as a patient
      name, a long address) clips with "…" instead of pushing the whole table past the edge. */
.patients-table td,
.patients-table th { overflow: hidden; }
.patients-table .name-cell { min-width: 0; }
.patients-table .dash-avatar { flex-shrink: 0; }
.patients-table .patient-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Patient table: Name · Email · Registered · Profile · Errors · Flags · Actions */
/* Eight columns since the rating scale joined: name, email, registered, baseline, rating
   scale, errors, concerns, actions. The map has to cover every one of them - an unlisted
   column takes no width and the browser reflows the rest around it. */
.patients-table--patients th:nth-child(1), .patients-table--patients td:nth-child(1) { width: 15%; }
.patients-table--patients th:nth-child(2), .patients-table--patients td:nth-child(2) { width: 16%; }
.patients-table--patients th:nth-child(3), .patients-table--patients td:nth-child(3) { width: 12%; }
.patients-table--patients th:nth-child(4), .patients-table--patients td:nth-child(4) { width: 10%; }
.patients-table--patients th:nth-child(5), .patients-table--patients td:nth-child(5) { width: 11%; }
.patients-table--patients th:nth-child(6), .patients-table--patients td:nth-child(6) { width: 9%; }
.patients-table--patients th:nth-child(7), .patients-table--patients td:nth-child(7) { width: 7%; }
.patients-table--patients th:nth-child(8), .patients-table--patients td:nth-child(8) { width: 20%; }
/* Clinician table: Name · Email · Registered · Actions */
.patients-table--clinicians th:nth-child(1), .patients-table--clinicians td:nth-child(1) { width: 32%; }
.patients-table--clinicians th:nth-child(2), .patients-table--clinicians td:nth-child(2) { width: 44%; }
.patients-table--clinicians th:nth-child(3), .patients-table--clinicians td:nth-child(3) { width: 12%; }
.patients-table--clinicians th:nth-child(4), .patients-table--clinicians td:nth-child(4) { width: 12%; }

/* ============================================
   PRIORITIES (optimizer step 3) — points/stepper
   weighting UI. Replaces the old sliders. One
   accent (blue), hierarchy from type + hairlines,
   per-row + top point dots. All .pri-* prefixed to
   avoid collisions. Lives here because LifeGuard
   only serves CSS from styles.css.
   ============================================ */

/* Points bank — calm neutral surface, fills with accent dots */
.pri-bank {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 13px 18px;
  margin-bottom: 26px;
  background: #FBFBFC;
  border: 1px solid #EAECEF;
  border-radius: 12px;
}
.pri-bank-left { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; }
.pri-bank-num { font-size: 24px; font-weight: 800; color: #111827; line-height: 1; font-variant-numeric: tabular-nums; }
.pri-bank-text { font-size: 12.5px; color: #6B7280; font-weight: 500; }
.pri-bank-tokens { flex: 1; display: flex; flex-wrap: wrap; gap: 5px; justify-content: center; }
.pri-tok { width: 14px; height: 14px; border-radius: 50%; box-sizing: border-box; transition: all .18s cubic-bezier(.34,1.56,.64,1); }
.pri-tok.left { background: #2563EB; }
.pri-tok.assigned { background: #D1D5DB; }
.pri-bank-count { font-size: 12px; color: #9CA3AF; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pri-bank.done .pri-bank-num { color: #059669; }

/* Section header — title + helper, no box */
/* The priorities step is TWO PARALLEL SECTIONS with one grammar. Each section is the
   same panel: a header band (icon + title + one-line help, separated by a hairline)
   over rows that all read identically — name + info chip · n/20 · − n + · pip meter.
   The efficacy row is one of those rows (pri-ae-row), NOT a heading: only the two
   pri-sec-titles sit at heading level, so the two-section structure is unmistakable. */
.pri-sec-block {
  border: 1px solid #E5E7EB;
  border-radius: 14px;
  background: #FFFFFF;
  padding: 16px 18px 10px;
  margin-bottom: 14px;
}
.pri-sec { padding-bottom: 12px; border-bottom: 1px solid #F1F3F5; margin-bottom: 2px; }
.pri-sec-title { font-size: 15px; font-weight: 700; color: #111827; margin: 0; display: flex; align-items: center; gap: 8px; }
.pri-sec-title svg { width: 17px; height: 17px; color: #6B7280; flex-shrink: 0; }
.pri-sec-help { font-size: 12.5px; color: #9CA3AF; margin: 3px 0 0; line-height: 1.45; }

/* Rows — hairline separators, two columns for the side effects, one row for efficacy.
   The panel's own bottom padding closes each section, so bottom-row hairlines go. */
.pri-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 30px; }
.pri-ae-row { padding: 11px 2px; border-bottom: 1px solid #F1F3F5; }
.pri-grid > .pri-ae-row:nth-last-child(-n+2) { border-bottom: none; }
.pri-row-efficacy { border-bottom: none; }
/* The efficacy row's floor note wears the same chip as the risk labels — same slot,
   same shape, so every row scans identically. */
.pri-chip-note { font-weight: 500; color: #8792A2; }
.pri-ae-row-top { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.pri-ae-name { font-size: 14px; font-weight: 500; color: #374151; transition: color .15s, font-weight .15s; min-width: 0; }
.pri-ae-row.on .pri-ae-name { color: #111827; font-weight: 600; }

/* Per-side-effect chip — sits inline on the name row (flex-shrink:0 + nowrap keep the chip
   itself intact, so a long name wraps inside its own column instead of crushing the chip).
   It carries a FIGURE, not a word: how many children in 100 are predicted
   to report the side effect on the dummy pill ("12 in 100"), set by renderCriterionInfo.
   Earlier rounds put a word here — a risk level, then a three-band label for how much the
   medications differ ("Varies widely") — and both were read as a verdict rather than a fact.
   TWO NUMBERS, TWO REGISTERS. The chip is a FACT about the side effect, the stepper is a CONTROL
   VALUE, and the row is built so they can never be mistaken for each other: the fact LEADS the
   row in a fixed-width slot at the far left, tight against the name it describes, in soft violet
   with a child glyph and no container; the control sits at the far right, dark and heavy, with
   its unit spelled out ("3 points"). A fixed slot also lines the eight percentages into a column
   the reader can run straight down, which is the same order the rows are sorted in.
   ONE flat tint for every figure, deliberately: the number carries the magnitude, so a colour
   scale on top of it would only add a good/bad valence the number does not have. The
   across-medication range lives in the hover tooltip. */
.pri-ae-row-top .pri-ae-name { flex: 1 1 auto; }
.pri-ae-chip { display: inline-flex; align-items: center; gap: 4px; flex-shrink: 0; white-space: nowrap;
  margin-right: 12px; font-size: 11.5px; font-weight: 600; color: #5F6B7A; background: #F1F4F7;
  border-radius: 999px; padding: 2px 9px; font-variant-numeric: tabular-nums; cursor: help; }
/* display:inline-flex above would defeat the [hidden] attribute (author styles beat the
   UA sheet) — without this, an unpopulated chip renders as a tiny empty pill. */
.pri-ae-chip[hidden] { display: none; }
/* The leading prevalence figure — PLAIN TEXT, not a pill. A tinted pill at the head of the row
   read as a second control sitting opposite the stepper; stripped back to a glyph and a
   percentage it reads as what it is, a quiet annotation on the name it belongs to. It keeps a
   fixed slot, with the glyph flush LEFT and the number flush RIGHT, so the eight percentages
   still align into a column AND every one of them lands immediately before its name whatever
   its width. The GLYPH carries the violet and the number stays in the body colour: the colour
   is there to mark what kind of thing this is, not to make the figure itself shout. Violet
   because it has no good/bad valence and is clear of both the blue point dots and the navy
   brand. */
.pri-chip-lead { min-width: 42px; margin-right: 6px; padding: 0; gap: 4px;
  background: none; border-radius: 0; }
.pri-chip-figures { color: #374151; }
.pri-chip-icon { display: block; flex-shrink: 0; color: #7A6BAE; }
.pri-chip-figure { flex: 1 1 auto; text-align: right; font-size: 12.5px; font-weight: 700;
  letter-spacing: -0.01em; }

/* ---- Blood pressure — two directions, no columns -----------------------------------------
   It used to be a 2 × 2: one column per measurement, systolic and diastolic, each with a rising
   and a falling row. Four steppers, and a parent asked to price a distinction parents do not
   have. The measurements were merged on 2026-08-31 — the points go on the direction and are
   split equally between them — so the block is a heading, a help line and TWO rows.
   The rows sit in .pri-grid, the same two-column grid the eight adverse effects use, so the
   panel keeps one rhythm and this block needs no layout of its own.
   No mmHg on the panel: figures on a screen that already shows one per side-effect row was the
   clutter this step keeps falling into, and mmHg is not a quantity most families can weigh. The
   predicted reading, the across-medication range and the usual level for this child all live in
   the heading's hover tooltip, given as a pair ("112 / 68") so neither half has to be named. */
.pri-bp-block { margin-top: 6px; padding-top: 15px; border-top: 1px solid #E6EAEF; }
.pri-bp-block[hidden] { display: none; }
.pri-bp-head { margin-bottom: 11px; }
.pri-bp-title { font-size: 13.5px; font-weight: 700; color: #111827; margin: 0; }
/* Only a heading carrying a tooltip advertises itself as one. */
.pri-bp-title.has-detail { cursor: help; }
.pri-bp-help { font-size: 12.5px; color: #9CA3AF; margin: 3px 0 0; line-height: 1.45; }

/* Point dots — grey placeholder, accent when assigned */
.pri-pip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pri-pip { width: 11px; height: 11px; border-radius: 50%; background: #E5E7EB; transition: all .15s; }
.pri-pip.on { background: #2563EB; }

/* Stepper. There is no separate "n/20" readout — see criterionRowHtml. One number per row. */
.pri-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.pri-step { display: inline-flex; align-items: center; gap: 2px; }
.pri-step-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none;
  background: #F3F4F6; color: #374151;
  font-size: 17px; font-weight: 500; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all .13s; user-select: none;
}
.pri-step-btn:hover:not(:disabled) { background: #EFF4FF; color: #2563EB; }
.pri-step-btn:active:not(:disabled) { transform: scale(.9); }
.pri-step-btn:disabled { opacity: .4; cursor: default; }
/* Number + unit, as one fixed-width block so every row's − and + line up in a column. */
.pri-step-val { display: inline-flex; align-items: baseline; gap: 4px; justify-content: center;
  min-width: 66px; }
.pri-step-num { font-size: 15px; font-weight: 700; color: #111827; font-variant-numeric: tabular-nums; }
.pri-step-unit { font-size: 11.5px; font-weight: 600; color: #9CA3AF; }

@media (max-width: 600px) {
  .pri-grid { grid-template-columns: 1fr; column-gap: 0; }
  /* Single column: only the true last row loses its hairline (the 2-col rule above
     also stripped the second-to-last, which is mid-list here). */
  .pri-grid > .pri-ae-row:nth-last-child(2) { border-bottom: 1px solid #F1F3F5; }
}

/* ============================================
   PROFILE SUMMARY (optimizer step 1) — read-only
   recap of demographics + medical info + flagged
   concerns. Demo runs show a note + "—" for the
   fields that come from the profile in real use.
   ============================================ */
.psum-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 18px;
  background: #EFF6FF;
  border: 1px solid #BFDBFE;
  border-radius: 10px;
  font-size: 13px;
  color: #1E40AF;
  line-height: 1.45;
}
.psum-note svg { flex-shrink: 0; margin-top: 1px; }
.psum-section { margin-bottom: 20px; }
.psum-section-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #6B7280;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid #EAECEF;
}
.psum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.psum-cell {
  background: #FBFBFC;
  border: 1px solid #EDEFF2;
  border-radius: 10px;
  padding: 10px 13px;
}
.psum-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #9CA3AF;
}
.psum-value {
  font-size: 14.5px;
  font-weight: 600;
  color: #1F2937;
  margin-top: 3px;
  word-break: break-word;
}
.psum-na { color: #C7CDD4; font-weight: 500; }
.psum-hint { font-size: 12px; color: #9CA3AF; margin: 10px 0 0; line-height: 1.45; }

/* ============================================
   PROFILE SUMMARY — ADHD severity prompt
   Shown on step 1 of the optimizer only when the record carries no CGI-S rating
   and the viewer is a clinician or CTU. It is the one editable control on an
   otherwise read-only screen, so it is styled as an amber request rather than as
   part of the summary grid. Same 1-7 scale and wording as the baseline
   questionnaire (.cgis-scale above) so the question reads identically in both places.
   ============================================ */
.psum-cgis {
  margin-top: 12px;
  padding: 14px 16px;
  background: #FFFBEB;
  border: 1px solid #FDE68A;
  border-radius: 10px;
}
.psum-cgis-missing {
  border-color: #F87171;
  background: #FEF2F2;
}
.psum-cgis-head {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.45;
  color: #92400E;
  margin-bottom: 12px;
}
.psum-cgis-missing .psum-cgis-head { color: #991B1B; }
.psum-cgis-head svg { flex-shrink: 0; margin-top: 1px; }
.psum-cgis-scale {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
}
.psum-cgis-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px;
  background: #fff;
  border: 1.5px solid #E5E7EB;
  border-radius: 8px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.psum-cgis-option:hover { border-color: #F59E0B; background: #FFFBEB; }
.psum-cgis-option input[type="radio"] { display: none; }
.psum-cgis-num {
  font-size: 15px;
  font-weight: 700;
  color: #374151;
  line-height: 1;
}
.psum-cgis-desc {
  font-size: 10px;
  color: #6B7280;
  line-height: 1.2;
}
.psum-cgis-option input[type="radio"]:checked ~ .psum-cgis-num { color: #B45309; }
.psum-cgis-option:has(input[type="radio"]:checked) {
  border-color: #D97706;
  background: #FEF3C7;
}

@media (max-width: 640px) {
  .psum-cgis-scale { grid-template-columns: repeat(4, 1fr); }
  .psum-cgis-desc { font-size: 9px; }
}

/* ============================================
   RUN PROVENANCE — the version stamp under the results
   Added 2026-08-18. The version of the tool and of the model data that produced the ranking,
   printed where a reader can see it rather than only inside the saved record. Deliberately
   quiet — it is a fact about the run, not part of the advice.
   ============================================ */
.run-provenance {
  margin-top: 1.25rem;
  padding-top: 0.75rem;
  border-top: 1px solid #E5E7EB;
  font-size: 0.75rem;
  color: #9CA3AF;
  text-align: center;
}

/* ============================================
   BASELINE FORM (q_baseline_1) — the three states
   ============================================

   red    .is-empty   nothing there, somebody has to answer it
   amber  .is-check   a value arrived from the saved record and nobody here has looked at it
   green  .is-done    answered here, or explicitly checked here

   A field that still needs the clinician is LOUD. A field that is done recedes. Scanning the
   page is then scanning for colour, and the two counts in the sticky bar say how many of each
   are left and jump to the first one. Nothing is read-only — editing a value counts as
   checking it. */

:root {
  --qb-red:     #B3261E;
  --qb-red-bg:  #FCEBE9;
  --qb-red-bd:  #DD8B84;
  --qb-amb:     #A6600A;
  --qb-amb-bg:  #FDF2E0;
  --qb-amb-bd:  #E1A758;
  --qb-grn:     #0B6A55;
  --qb-grn-bg:  #E2F1EC;
  --qb-grn-bd:  #64B2A0;
  --qb-rule:    #CFD7E0;
  --qb-rule-sf: #E1E7ED;
  --qb-ink:     #121821;
  --qb-ink-2:   #454F5E;
  --qb-ink-3:   #77828F;
  --qb-mono:    "Cascadia Mono", Consolas, "SF Mono", ui-monospace, monospace;
}

/* ---------- the sticky count bar ---------- */
.qb-dock {
  position: sticky;
  top: 56px;                       /* .app-navbar-inner height */
  z-index: 30;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--qb-rule);
}
.qb-dock-in {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.qb-dock-title {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.qb-dock-h1 {
  margin: 0;
  font-family: var(--qb-mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--qb-ink);
  font-weight: 700;
}
.qb-dock-sub {
  font-size: 12px;
  color: var(--qb-ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 32ch;
}
/* What the participant link proposed. Wraps rather than clipping, unlike the subtitle above
   it, because the sentence about a code that could not be filled in is the whole point of it
   and an ellipsis would hide exactly the part the clinician has to act on. */
.qb-dock-note {
  margin: 3px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--qb-ink-3);
  max-width: 62ch;
}
.qb-dock-counts {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.qb-count {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  border: 1.5px solid transparent;
  border-radius: 4px;
  padding: 4px 10px;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.2;
}
.qb-count-n {
  font-family: var(--qb-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 700;
}
.qb-count-fill { border-color: var(--qb-red-bd); background: var(--qb-red-bg); color: var(--qb-red); }
.qb-count-val  { border-color: var(--qb-amb-bd); background: var(--qb-amb-bg); color: var(--qb-amb); }
.qb-count-done { border-color: var(--qb-grn-bd); background: var(--qb-grn-bg); color: var(--qb-grn); }
button.qb-count { cursor: pointer; }
button.qb-count:hover:not(:disabled) { filter: brightness(0.96); }
button.qb-count:disabled, .qb-count.is-zero { opacity: 0.34; cursor: default; }
.qb-dock.is-ready .qb-count-done { border-color: var(--qb-grn); }

/* ---------- page and sections ---------- */
.qb-page { max-width: 1100px; }

.qb-sec {
  background: #fff;
  border: 1px solid var(--qb-rule);
  border-radius: 4px;
  box-shadow: 0 1px 1px rgba(18, 24, 33, 0.05),
              0 4px 10px rgba(18, 24, 33, 0.07),
              0 14px 28px rgba(18, 24, 33, 0.06);
  overflow: hidden;
  margin-bottom: 20px;
}
.qb-sec-head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 15px;
  background: #E5EAEF;
  border-bottom: 1px solid var(--qb-rule);
}
.qb-sec-name {
  font-family: var(--qb-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--qb-ink);
  font-weight: 700;
}
.qb-sec-chips { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.qb-chip {
  font-family: var(--qb-mono);
  font-variant-numeric: tabular-nums;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  padding: 2px 6px;
  border-radius: 2px;
}
.qb-chip-fill { color: var(--qb-red); background: var(--qb-red-bg); }
.qb-chip-val  { color: var(--qb-amb); background: var(--qb-amb-bg); }
.qb-chip-done { color: var(--qb-grn); background: var(--qb-grn-bg); }
.qb-sec-body { padding: 14px 15px 16px; }

/* ---------- the grid: whole columns, so every field lines up ---------- */
.qb-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.qb-sp2 { grid-column: span 2; }
.qb-sp3 { grid-column: span 3; }
.qb-sp4 { grid-column: span 4; }
@media (max-width: 1040px) {
  .qb-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qb-sp3, .qb-sp4 { grid-column: span 2; }
}
@media (max-width: 600px) {
  .qb-grid { grid-template-columns: 1fr; }
  .qb-sp2, .qb-sp3, .qb-sp4 { grid-column: span 1; }
}

/* ---------- one field panel ---------- */
.qb-f {
  border: 1px solid var(--qb-rule-sf);
  border-radius: 4px;
  background: #fff;
  padding: 6px 9px 9px;
  display: grid;
  gap: 6px;
  align-content: start;
  min-width: 0;
  transition: background-color 0.18s ease, border-color 0.18s ease;
}
.qb-f.is-empty { border-color: var(--qb-red-bd); border-style: dashed; background: var(--qb-red-bg); }
.qb-f.is-check { border-color: var(--qb-amb-bd); background: var(--qb-amb-bg); }
.qb-f.is-done  { border-color: var(--qb-grn-bd); background: #fff; }
.qb-f.is-error { border-color: var(--qb-red); background: var(--qb-red-bg); }
.qb-f.qb-derived { background: transparent; border-style: dashed; border-color: var(--qb-rule); }
.qb-f.is-hunted { box-shadow: 0 0 0 3px rgba(27, 111, 181, 0.35); }
.qb-f.field-missing { box-shadow: 0 0 0 2px var(--qb-red); }

.qb-f-top {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  min-height: 24px;
  font-family: var(--qb-mono);
  font-size: 10.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--qb-ink);
  font-weight: 700;
}
.qb-f-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qb-f-unit { color: var(--qb-ink-3); font-weight: 500; letter-spacing: 0.05em; white-space: nowrap; }
.qb-f.is-empty .qb-f-name, .qb-f.is-empty .qb-f-unit { color: var(--qb-red); }
.qb-f.is-check .qb-f-name, .qb-f.is-check .qb-f-unit { color: var(--qb-amb); }
.qb-f.is-error .qb-f-name, .qb-f.is-error .qb-f-unit { color: var(--qb-red); }

/* the check button — only while a value is waiting to be looked at */
.qb-ok {
  margin-left: auto;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 24px;
  padding: 0 9px 0 7px;
  border: 1.5px solid var(--qb-grn);
  background: var(--qb-grn-bg);
  color: var(--qb-grn);
  border-radius: 3px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  cursor: pointer;
}
.qb-ok:hover { background: var(--qb-grn); color: #fff; }
.qb-ok svg { display: block; }

/* ---------- controls ---------- */
.qb-f .sex-button-group.qb-seg {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  margin: 0;
}
.qb-f .qb-seg label {
  flex: 1 1 auto;
  margin: 0;
  border: 1px solid var(--qb-rule);
  background: #fff;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--qb-ink-2);
  text-align: center;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease, color 0.12s ease;
}
.qb-f .qb-seg input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.qb-f .qb-seg label:hover { border-color: var(--qb-ink-3); color: var(--qb-ink); }
.qb-f .qb-seg input[type="radio"]:checked + label {
  font-weight: 650;
  border-color: var(--qb-grn);
  background: var(--qb-grn-bg);
  color: var(--qb-grn);
}
.qb-f.is-check .qb-seg input[type="radio"]:checked + label {
  border-color: var(--qb-amb);
  background: #fff;
  color: var(--qb-amb);
}
.qb-f .qb-seg input[type="radio"]:focus-visible + label {
  outline: 2px solid #1B6FB5;
  outline-offset: 2px;
}

.qb-f .profile-select,
.qb-f input.qb-num {
  width: 100%;
  min-width: 0;
  margin: 0;
  padding: 5px 8px;
  border: 1px solid var(--qb-rule);
  border-radius: 4px;
  background: #fff;
  font-size: 14px;
}
.qb-f input.qb-num {
  font-family: var(--qb-mono);
  font-variant-numeric: tabular-nums;
  font-weight: 650;
  text-align: right;
}
.qb-f input.qb-num::placeholder { color: var(--qb-red); font-weight: 700; letter-spacing: 0.12em; }
.qb-f.is-done input.qb-num { border-color: var(--qb-grn); background: var(--qb-grn-bg); color: var(--qb-grn); }
.qb-f.is-check input.qb-num { border-color: var(--qb-amb); color: var(--qb-amb); }
.qb-f.is-check .profile-select { border-color: var(--qb-amb); color: var(--qb-amb); }
.qb-f.is-done .profile-select { border-color: var(--qb-grn); background: var(--qb-grn-bg); color: var(--qb-grn); }
.qb-f.is-error input.qb-num { border-color: var(--qb-red); background: var(--qb-red-bg); color: var(--qb-red); }

.qb-f input.age-slider { width: 100%; margin: 0; }

/* .bmi-display carries this too, and both are single classes — win on specificity rather
   than on which happens to come later in the file. */
.qb-f .qb-der {
  font-family: var(--qb-mono);
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 650;
  color: var(--qb-ink-2);
  padding: 5px 8px;
  text-align: right;
  background: none;
  border: 0;
}

/* the z-score proposal — offered, never written on its own */
.qb-propose {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--qb-mono);
  font-size: 12px;
  color: var(--qb-grn);
}
.qb-propose-v { font-variant-numeric: tabular-nums; font-weight: 700; }
.qb-propose-btn {
  border: 1.5px solid var(--qb-grn);
  background: var(--qb-grn-bg);
  color: var(--qb-grn);
  border-radius: 3px;
  padding: 1px 8px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}
.qb-propose-btn:hover { background: var(--qb-grn); color: #fff; }

/* blood pressure — two named boxes, one reading */
.qb-bp { display: grid; grid-template-columns: 1fr auto 1fr; gap: 6px; align-items: start; }
.qb-bp-one { display: grid; gap: 3px; min-width: 0; }
.qb-bp-sep { font-family: var(--qb-mono); font-size: 18px; color: var(--qb-ink-3); padding-top: 3px; }
.qb-bp-cap {
  font-family: var(--qb-mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--qb-ink-2);
  text-align: center;
  font-weight: 600;
}
.qb-bp-one.is-empty .qb-bp-cap { color: var(--qb-red); font-weight: 700; }
.qb-bp-one.is-done .qb-bp-cap { color: var(--qb-grn); }
.qb-bp-one.is-check .qb-bp-cap { color: var(--qb-amb); }

/* CGI-S — seven equal cells */
.qb-f .cgis-scale.qb-scale {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 3px;
  margin: 0;
}
@media (max-width: 780px) { .qb-f .cgis-scale.qb-scale { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 440px) { .qb-f .cgis-scale.qb-scale { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.qb-f .qb-scale .cgis-option {
  margin: 0;
  border: 1px solid var(--qb-rule);
  background: #fff;
  border-radius: 4px;
  padding: 4px 3px 5px;
  text-align: center;
  min-width: 0;
  cursor: pointer;
  display: block;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.qb-f .qb-scale .cgis-option input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.qb-f .qb-scale .cgis-label {
  display: block;
  font-family: var(--qb-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--qb-ink-2);
}
.qb-f .qb-scale .cgis-desc {
  display: block;
  font-size: 10px;
  line-height: 1.2;
  color: var(--qb-ink-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.qb-f .qb-scale .cgis-option:hover { border-color: var(--qb-ink-3); }
.qb-f .qb-scale input[type="radio"]:checked ~ .cgis-label,
.qb-f .qb-scale input[type="radio"]:checked ~ .cgis-desc { color: var(--qb-grn); }
.qb-f .qb-scale .cgis-option:has(input:checked) {
  border-color: var(--qb-grn);
  background: var(--qb-grn-bg);
}
.qb-f.is-check .qb-scale .cgis-option:has(input:checked) {
  border-color: var(--qb-amb);
  background: #fff;
}
.qb-f.is-check .qb-scale input[type="radio"]:checked ~ .cgis-label,
.qb-f.is-check .qb-scale input[type="radio"]:checked ~ .cgis-desc { color: var(--qb-amb); }

/* ---------- the action row ---------- */
.qb-actions { margin-top: 4px; align-items: center; }
.qb-actions-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qb-actions-note {
  font-size: 13px;
  font-weight: 600;
  color: var(--qb-amb);
}

@media (prefers-reduced-motion: reduce) {
  .qb-f, .qb-count, .qb-ok, .qb-f .qb-seg label { transition: none; }
}

/* ============================================
   RESULTS SCREEN — 2026-08-28 redesign
   ============================================

   Replaces the look of step 3 only. Deliberately NEW class names (res-*) rather than edits
   to .ae-bar-* — history-rendered.js draws the saved-run pages with .ae-bar-row /
   .ae-bar-label / .ae-bar-track / .ae-bar-fill, and those rules must keep working.

   THE COLOUR RULE. Green is how well a medication works, red is side effects and blood
   pressure, slate is anything that ranks (the score, the band, the probabilities), amber is
   a warning and nothing else. Red and green name the KIND of outcome and every card carries
   the same two, so no medication is ever the green one. The tier colour ramp (green, amber,
   orange, red on the group boxes) is gone. It read as good-to-bad, which is the claim the
   caveat panel explicitly disclaims.
   ============================================ */

/* Step 3 runs wider than the 920px wizard. This is what lets a card hold 13 outcomes in two
   columns without truncating, which the old 330px tier-strip column could not do. */
.optimizer-step-wide { margin-left: -130px; margin-right: -130px; }
@media (max-width: 1240px) {
  .optimizer-step-wide { margin-left: 0; margin-right: 0; }
}

/* ---- Group container ---------------------------------------------------- */
/* Superseded 2026-10-06: a numbered group now takes its own colour (THE GROUP COLOURS, near
   the end of this file). The colour tells groups apart and says nothing about the medications. */
.res-group { border: 1px solid #DDE4EC; border-radius: 16px; margin-bottom: 16px;
             background: #F1F5F9; overflow: hidden; }
.res-group-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
                  padding: 11px 16px; background: #E2E8F0; border-bottom: 1px solid #D3DCE6; }
.res-group-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.res-group-count { font-size: 12px; font-weight: 600; color: #6B7280; }
.res-group-desc { font-size: 12.5px; color: #6B7280; margin-left: auto; line-height: 1.35; }

/* The unranked placebo section. Grey, outside the group scale, never a recommendation. */
.res-group.res-ref { background: #F9FAFB; border-color: #D1D5DB; }
.res-group.res-ref .res-group-head { background: #EDEFF2; border-bottom-color: #DFE3E8; }

.res-pill { font-size: 11.5px; font-weight: 700; color: #334155; background: #FFFFFF;
            border: 1px solid #CBD5E1; border-radius: 999px; padding: 3px 11px; white-space: nowrap; }
/* Repeated on every card, so a card read on its own still says which group it is in. */
.res-pill-card { font-size: 10.5px; padding: 2px 9px; background: #EEF2F7; border-color: #DDE4EC; }

/* ---- Medication card ---------------------------------------------------- */
.res-card { border: 1px solid #E5E7EB; border-radius: 10px; background: #FFFFFF; overflow: hidden; }
/* A concern is flagged with a wide hatched band, not a thin coloured border. */
.res-card.res-concern {
  background-image: repeating-linear-gradient(45deg, #B45309 0 7px, #F59E0B 7px 14px);
  background-size: 14px 100%;
  background-repeat: no-repeat;
  background-position: left top;
  padding-left: 14px;
}
.res-card-head { display: flex; align-items: center; gap: 12px; padding: 11px 16px;
                 background: #F9FAFB; border-bottom: 1px solid #E5E7EB; flex-wrap: wrap; }
.res-rank { font-size: 18px; font-weight: 800; color: #374151; min-width: 18px; }
.res-med { font-size: 15px; font-weight: 600; color: #1F2937; overflow-wrap: anywhere; }
.res-pos { font-size: 11.5px; color: #6B7280; white-space: nowrap; }
.res-score-wrap { margin-left: auto; display: inline-flex; align-items: baseline; gap: 7px; }
.res-score-label { font-size: 11px; color: #6B7280; }
.res-score { font-size: 19px; font-weight: 800; color: #1F2937; line-height: 1; }
.res-score-ci { font-size: 11px; color: #6B7280; }
.res-card-body { padding: 12px 16px 13px; }
.res-body-head { display: flex; align-items: baseline; justify-content: space-between;
                 gap: 12px; margin-bottom: 8px; flex-wrap: wrap; }
.res-sec-label { font-size: 12.5px; font-weight: 700; color: #374151; }
.res-sec-hint { font-weight: 400; color: #6B7280; font-size: 11.5px; }
.res-sec-note { font-size: 11px; color: #6B7280; line-height: 1.4; margin: 7px 0 0; }

/* Solid amber block. An outlined pill was a thin rounded coloured border, the same problem
   as the card edge it sits on. */
.res-concern-flag { display: inline-flex; align-items: center; gap: 5px; font-size: 11px;
                    font-weight: 700; color: #FFFFFF; background: #B45309;
                    border-radius: 4px; padding: 3px 9px; white-space: nowrap; }

/* ---- Outcome rows ------------------------------------------------------- */
/* Two columns, and one row per outcome on ONE shared axis. The medication is the filled bar,
   placebo is the rule crossing it. Thirteen rows, not twenty-six. */
.res-grid { display: grid; grid-template-columns: 1fr 1fr; column-gap: 34px; }
@media (max-width: 900px) { .res-grid { grid-template-columns: 1fr; } }
/* The value column was 88px, sized for "118 mmHg" and "12%". A blood-pressure row prints BOTH
   readings now ("110 / 67 mmHg") with a "placebo 113 / 70 mmHg" line under it, which wrapped at
   88px. 104px fits the longest of them; the track is 1fr and simply gives up the difference. */
.res-row { display: grid; grid-template-columns: 26px minmax(0, 200px) 1fr 104px;
           gap: 10px; align-items: center; padding: 4px 0; }
.res-row-name { font-size: 12.5px; color: #374151; line-height: 1.25; }
.res-row-val { text-align: right; font-size: 12.5px; font-weight: 600; color: #1F2937; line-height: 1.2; }
.res-row-plb { display: block; font-size: 10px; font-weight: 400; color: #6B7280; margin-top: 1px; }
/* Outcomes the family gave no points to are dimmed, never dropped. */
.res-row-quiet .res-row-name { color: #6B7280; }
.res-row-quiet .res-row-val { color: #4B5563; font-weight: 500; }

.res-trk { position: relative; height: 9px; background: #F1F5F9; border: 1px solid #E2E8F0;
           border-radius: 5px; }
.res-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: #DC2626; }
.res-fill-eff { background: #059669; }
.res-row-quiet .res-fill { background: rgba(220, 38, 38, 0.55); }
.res-row-quiet .res-fill-eff { background: rgba(5, 150, 105, 0.55); }
/* Placebo. Dark with a white outline so it reads on the pale track AND on a coloured bar. */
.res-pmk { position: absolute; top: -5px; bottom: -5px; width: 3px; background: #1F2937;
           border-radius: 1.5px; box-shadow: 0 0 0 1.5px #FFFFFF; }
.placebo-hidden .res-pmk { display: none; }
.placebo-hidden .res-row-plb { display: none; }
/* A value past an end of the bar (placebo only, DECISIONS.md 4 October 2026 item 10). The bar or
   marker stops at the end of the track, and a small arrow just outside that end points away from
   the bar. The arrow is 5px wide and sits in the 10px gap beside the track, so it never leaves the
   card, and on a narrow screen the track has the card padding (16px) beside it. */
.res-off { position: absolute; top: 50%; width: 0; height: 0; margin-top: -4px;
           border: 4px solid transparent; }
.res-off-lo { right: 100%; margin-right: 1px; border-right: 5px solid #DC2626; border-left-width: 0; }
.res-off-hi { left: 100%; margin-left: 1px; border-left: 5px solid #DC2626; border-right-width: 0; }
.res-off-lo.res-off-eff { border-right-color: #059669; }
.res-off-hi.res-off-eff { border-left-color: #059669; }
.res-pmk-lo::before, .res-pmk-hi::before { content: ""; position: absolute; top: 50%; width: 0; height: 0;
           margin-top: -4px; border: 4px solid transparent; }
.res-pmk-lo::before { right: 100%; margin-right: 2px; border-right: 5px solid #1F2937; border-left-width: 0; }
.res-pmk-hi { margin-left: -3px; }
.res-pmk-hi::before { left: 100%; margin-left: 2px; border-left: 5px solid #1F2937; border-right-width: 0; }
.placebo-hidden .res-off-note { display: none; }

/* Points ring, showing how many of the 20 priority points sit on this outcome. */
.res-ring { position: relative; width: 26px; height: 26px; border-radius: 50%;
            display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.res-ring::after { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #FFFFFF; }
.res-ring-n { position: relative; z-index: 1; font-size: 9.5px; font-weight: 700; color: #374151; }
.res-ring-0 .res-ring-n { color: #6B7280; }

/* ---- Disclosure --------------------------------------------------------- */
.res-disc { margin-top: 10px; padding-top: 9px; border-top: 1px solid #F3F4F6;
            display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.res-disc-btn { display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
                font-weight: 600; color: #1D4ED8; background: none; border: none;
                padding: 4px 0; cursor: pointer; }
.res-disc-btn:hover { color: #1E3A8A; text-decoration: underline; }
.res-disc-btn svg { transition: transform 0.2s; }
.res-disc-rest { font-size: 11.5px; color: #6B7280; }
.res-hidden-rows { display: none; }
.res-card.res-open .res-hidden-rows { display: grid; }
.res-card.res-open .res-disc-btn svg { transform: rotate(180deg); }

/* ---- Overview ----------------------------------------------------------- */
.res-overview { background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: 12px;
                padding: 16px 18px; margin-bottom: 14px; }
.res-ov-head { display: flex; align-items: baseline; justify-content: space-between;
               gap: 16px; margin-bottom: 12px; flex-wrap: wrap; }
.res-ov-title { font-size: 15px; font-weight: 700; color: #1F2937; }
.res-ov-scale { font-size: 11.5px; color: #6B7280; }
/* The same grouping language as the cards below, so the two read as one structure. */
.res-ov-group { margin-bottom: 10px; background: #F1F5F9; border: 1px solid #DDE4EC;
                border-radius: 10px; padding: 10px 12px 11px; }
.res-ov-group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.res-ov-group-note { font-size: 11.5px; color: #64748B; }
.res-ov-row { display: grid; grid-template-columns: 190px 1fr 54px; gap: 12px;
              align-items: center; margin-bottom: 7px; }
.res-ov-row:last-child { margin-bottom: 0; }
.res-ov-name { font-size: 12.5px; font-weight: 500; color: #374151;
               white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-ov-trk { position: relative; height: 16px; background: #F8FAFC; border: 1px solid #E5E7EB;
              border-radius: 8px; }
/* Slate, not green. The score is the thing that ranks, and nothing that ranks is coloured. */
.res-ov-band { position: absolute; top: -1px; bottom: -1px; background: #E2E8F0;
               border: 1px solid #CBD5E1; border-radius: 8px; }
.res-ov-pt { position: absolute; top: 2px; bottom: 2px; width: 5px; background: #334155;
             border-radius: 3px; }
.res-ov-score { font-size: 12.5px; font-weight: 700; color: #1F2937; text-align: right; }
.res-ov-ticks { display: grid; grid-template-columns: 190px 1fr 54px; gap: 12px;
                padding-top: 6px; border-top: 1px solid #F3F4F6; }
.res-ov-ticks-inner { display: flex; justify-content: space-between; font-size: 10px; color: #6B7280; }

/* ---- Probability block -------------------------------------------------- */
/* Deliberately NOT the overview row. A different column rhythm, the percentage leading on the
   left and no right-hand numeral, so this can never be read as a continuation of the ranked
   table above it. A probability must never sit beside a rank number. */
.res-pbest { background: #FFFFFF; border: 1px solid #E5E7EB; border-left: 3px solid #E2E8F0;
             border-radius: 12px; padding: 16px 18px; margin-bottom: 16px; }
.res-pbest-title { font-size: 14px; font-weight: 700; color: #1F2937; margin-bottom: 4px; }
.res-pbest-note { font-size: 12.5px; color: #4B5563; line-height: 1.55; margin: 0 0 13px; max-width: 830px; }
.res-pbest-row { display: grid; grid-template-columns: 62px 236px 1fr; gap: 12px;
                 align-items: center; margin-bottom: 9px; }
.res-pbest-pct { font-size: 13px; font-weight: 600; color: #475569; text-align: right; }
.res-pbest-name { font-size: 12.5px; font-weight: 500; color: #374151;
                  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.res-pbest-trk { position: relative; height: 12px; background: #F8FAFC; border: 1px solid #E5E7EB;
                 border-radius: 6px; }
.res-pbest-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #94A3B8; border-radius: 5px; }
.res-pbest-foot { display: grid; grid-template-columns: 62px 236px 1fr; gap: 12px;
                  margin-top: 7px; padding-top: 8px; border-top: 1px solid #F3F4F6; }
/* A bar filling 38% of its track reads as a magnitude unless something says it is a share. */
.res-pbest-sum { font-size: 11.5px; color: #6B7280; }
.res-pbest-ticks { display: flex; justify-content: space-between; font-size: 10px; color: #6B7280; }

/* ---- Caveat and the boundary note --------------------------------------- */
.res-caveat { background: #FFFFFF; border: 1px solid #E5E7EB; border-radius: 12px;
              padding: 15px 18px; margin-bottom: 16px; display: flex; gap: 12px; align-items: flex-start; }
.res-caveat svg { flex-shrink: 0; margin-top: 2px; }
.res-caveat p { font-size: 13.5px; color: #374151; line-height: 1.5; margin: 0; }
.res-concern-note { font-size: 11.5px; color: #4B5563; line-height: 1.45; margin: 0 0 14px; }
.res-boundary { display: flex; align-items: center; gap: 14px; margin: 0 0 16px; padding: 0 4px; }
.res-boundary-rule { flex: 1; border-top: 1px dashed #CBD5E1; }
.res-boundary-text { font-size: 11.5px; color: #4B5563; text-align: center; max-width: 640px; line-height: 1.45; }

@media (max-width: 640px) {
  .res-row { grid-template-columns: 26px 1fr 94px; }
  .res-row .res-trk { grid-column: 1 / -1; }
  .res-ov-row, .res-ov-ticks { grid-template-columns: 120px 1fr 46px; }
  .res-pbest-row, .res-pbest-foot { grid-template-columns: 50px 1fr; }
  .res-pbest-row .res-pbest-trk, .res-pbest-foot .res-pbest-ticks { grid-column: 1 / -1; }
}

/* ---- The notice stack -------------------------------------------------------
   Up to four blocks can sit above the results at once. Only ONE of them is coloured.
   Amber above the results means the numbers are not real, and nothing else, which is
   what keeps the demonstration banner unmissable when three other notices join it. */

/* The two or three run conditions, as rows of one neutral panel rather than separate
   amber alerts. The caveat above answers "how do I read any result"; this answers
   "what happened on this run", and the heading says which before the reader starts. */
.res-run-panel { background: #F8FAFC; border: 1px solid #E2E8F0; border-radius: 12px;
                 padding: 13px 18px 14px; margin-bottom: 16px; }
.res-run-title { font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px; color: #64748B;
                 padding-bottom: 8px; margin: 0; border-bottom: 1px solid #E8EDF3; }
.res-run-row { display: flex; gap: 11px; align-items: flex-start; padding: 12px 0;
               border-bottom: 1px solid #E8EDF3; }
.res-run-row:last-child { border-bottom: none; padding-bottom: 0; }
.res-run-row svg { flex-shrink: 0; margin-top: 2px; }
.res-run-lead { font-size: 13px; font-weight: 700; color: #1F2937; margin: 0 0 3px; }
.res-run-body { font-size: 12.5px; color: #4B5563; line-height: 1.5; margin: 0; }

/* The demonstration banner keeps its amber and gains a hatched band, so it reads as the
   one hazard on the page rather than as the first of several coloured boxes. */
.patient-demo-notice {
  border-left-width: 2px;
  padding-left: 32px;
  background-color: #FEF3C7;
  background-image: repeating-linear-gradient(45deg, #B45309 0 7px, #F59E0B 7px 14px);
  background-size: 14px 100%;
  background-repeat: no-repeat;
  background-position: left top;
}

/* The fail-closed panel, same treatment in red. Replaces an 8px flat coloured edge. */
.results-blocked-notice {
  border-width: 1px;
  border-color: #F0A5A5;
  border-left-width: 1px;
  padding-left: 44px;
  background-color: #FEF2F2;
  background-image: repeating-linear-gradient(45deg, #991B1B 0 7px, #DC2626 7px 14px);
  background-size: 16px 100%;
  background-repeat: no-repeat;
  background-position: left top;
  overflow: hidden;
}

/* ============================================
   PETRA THEME — 2026-08-30
   ============================================

   One theme colour (#26619b) and one panel grammar across the three steps of activity1.

   WHY. The three steps drew boxes at four different weights and nested them two and three
   deep, so no boundary meant anything in particular. Step 1 was the worst: fourteen bordered
   .psum-cell boxes on a WHITE page with no parent panel at all. Step 2 put bordered
   blood-pressure column boxes (.pri-bp-col, removed with the columns on 2026-08-31) inside a
   bordered .pri-sec-block. Step 3 wrapped white .res-card boxes in a tinted .res-group box.

   THE SYSTEM. Three surfaces, and one law.
     Level 0 — the page. A tinted clinical ground (.optimizer-canvas). This does most of the
       work: a white panel with a hairline border needs something to separate itself from.
     Level 1 — the panel. The only box. White, one border, one radius, one light shadow, and
       a tinted header band carrying icon + title + right-aligned meta.
     Level 2 — rows inside a panel. No fill, no border, no radius. Hairlines and padding only,
       horizontal between rows AND vertical between columns.
     The law: never a box inside a box. Anything set apart inside a panel gets a heading and
       a rule, not a border and a background.

   THE COLOUR RULE ON STEP 3 IS UNTOUCHED. Green is how well a medication works, red is side
   effects and blood pressure, slate is anything that ranks, amber is a warning and nothing
   else. The theme colour is none of those, so nothing on that screen changes meaning. It is
   used for chrome, state and controls, and — since the "ranking figures" section at the very
   end of this file — for the uncertainty band and the probability bars, which rank but carry
   no valence. It is never used for the green/red pair that names a KIND of outcome.

   This section is LAST in styles.css on purpose: it overrides the .psum-*, .pri-* and .res-*
   rules above at equal specificity, so those sections keep their comments and their history
   and this one keeps the whole redesign in one readable place.
   ============================================ */

:root {
  --petra-brand: #26619B;
  --petra-brand-700: #1E4E7E;
  --petra-brand-800: #173F66;
  --petra-brand-300: #95BBDA;
  --petra-brand-200: #C2D9EC;
  --petra-brand-100: #E1EDF8;
  --petra-brand-050: #F2F7FC;

  --petra-page: #EEF3F9;
  --petra-panel: #FFFFFF;
  --petra-band: #F5F9FD;
  --petra-line: #D4DFEA;
  --petra-line-soft: #E2EAF3;
  --petra-hair: #EBF0F6;

  --petra-ink: #0F2739;
  --petra-ink-2: #33465A;
  --petra-ink-3: #63788C;
  --petra-ink-4: #8FA2B4;
  --petra-ink-5: #B9C6D3;

  --petra-shadow: 0 1px 2px rgba(15, 39, 57, 0.05), 0 1px 1px rgba(15, 39, 57, 0.04);
}

/* ---- Chrome ------------------------------------------------------------------------- */
/* Shared across every page, which is the point of a theme colour. */
.app-navbar {
  background: var(--petra-brand);
  border-bottom-color: var(--petra-brand-800);
  box-shadow: 0 2px 6px rgba(15, 39, 57, 0.18);
}
/* 0.80, not 0.72. Composited on the old slate #30384d the idle link was 5.96:1; the lighter
   brand bar dropped the same alpha to 4.20:1, under AA for 12px text (11px at <=480px).
   0.80 restores 4.76:1. */
.app-navbar-link { color: rgba(255, 255, 255, 0.80); }
.app-navbar-link:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.14); }
.landing-footer-blue { background: var(--petra-brand-800); }

/* ---- Level 0: the page ground -------------------------------------------------------
   Scoped to a class on <main> rather than to <body>, because LifeGuard may strip or replace
   body classes (see "LifeGuard CSS Constraints" in build/README.md) and .optimizer-container
   is a centred 920px column, so painting it would leave the margins white.
   The gradient is two layers: a faint brand wash falling from above the fold, over a cool
   vertical ramp. Both are low-contrast on purpose — this is a ground, not a feature.
   THREE NAMES, ONE RULE (2026-08-30, see "SHARED COMPONENTS" at the end of this file).
   .optimizer-canvas stays activity1's name, .dash-bg is grouped in so the three dashboards
   convert with no markup edit (this beats .dash-bg at styles.css:4675 on file order at equal
   specificity), and .petra-canvas is what every other page puts on its <main>. A second rule
   with the same values would be two grounds that drift. */
.optimizer-canvas, .petra-canvas, .dash-bg {
  background-color: var(--petra-page);
  background-image:
    radial-gradient(1100px 420px at 50% -140px, rgba(38, 97, 155, 0.13), rgba(38, 97, 155, 0) 72%),
    linear-gradient(180deg, #E7EFF8 0%, #EDF3F9 38%, #F5F9FD 100%);
  background-repeat: no-repeat;
  background-size: 100% 100%, 100% 100%;
}

/* ---- The stepper --------------------------------------------------------------------
   Three flat bars with no names said nothing: not which step you were on, not what the other
   two were, not whether one was finished. One segment per step now, ruled apart, each with a
   numbered marker, its name and its state, over a progress rule that fills across the bar. */
.petra-wiz {
  position: relative;
  display: flex;
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  overflow: hidden;
  margin-bottom: 24px;
}
.petra-wiz-seg {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 18px 15px;
  border-left: 1px solid var(--petra-hair);
}
.petra-wiz-seg:first-child { border-left: none; }
.petra-wiz-seg.is-current { background: var(--petra-brand-050); }
.petra-wiz-mark {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12.5px;
  font-weight: 700;
  background: #EFF2F6;
  color: var(--petra-ink-4);
  border: 1.5px solid transparent;
}
.petra-wiz-seg.is-current .petra-wiz-mark {
  background: var(--petra-brand);
  color: #FFFFFF;
  box-shadow: 0 0 0 3px var(--petra-brand-100);
}
.petra-wiz-seg.is-done .petra-wiz-mark {
  background: #FFFFFF;
  color: var(--petra-brand);
  border-color: var(--petra-brand-300);
}
.petra-wiz-text { min-width: 0; }
.petra-wiz-name { display: block; font-size: 13.5px; font-weight: 700; color: var(--petra-ink-4); line-height: 1.2; }
.petra-wiz-state { display: block; font-size: 11px; font-weight: 500; color: var(--petra-ink-4); margin-top: 2px; }
.petra-wiz-seg.is-current .petra-wiz-name { color: var(--petra-ink); }
.petra-wiz-seg.is-current .petra-wiz-state { color: var(--petra-brand); font-weight: 600; }
.petra-wiz-seg.is-done .petra-wiz-name { color: var(--petra-ink-2); }
/* A done segment is ENABLED, so its caption is live text and owes AA: ink-4 was 2.63:1. */
.petra-wiz-seg.is-done .petra-wiz-state { color: var(--petra-ink-3); }
/* pointer-events: none is load-bearing. The rule is a positioned SIBLING of the three
   segment buttons, which are in flow and never positioned, so it paints and HIT-TESTS above
   them: without this, a click on the bottom 3px of a segment — inside its own 15px of
   padding — found the rule instead of the button and did nothing, and the hover highlight
   died over the same band. */
.petra-wiz-prog { position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
                  background: var(--petra-brand-100); pointer-events: none; }
/* width: 0 is not cosmetic. With width unset the block fills its absolutely-positioned
   parent, so the rule painted FULL WIDTH from first paint until updateProgressBar ran — and
   init() waits on ten blocking scripts. It then snapped to a third (auto is not an
   interpolable width, so the transition cannot ease out of it). */
.petra-wiz-prog-fill { display: block; width: 0; height: 100%; background: var(--petra-brand); transition: width 0.3s ease; }

@media (max-width: 700px) {
  .petra-wiz-seg { padding: 11px 12px 13px; gap: 8px; }
  /* Kept, not hidden: on a not-yet-reached segment this caption is the ONLY visible reason
     the control is inert (a disabled button shows no tooltip). Shrunk instead. */
  .petra-wiz-state { font-size: 10px; }
  .petra-wiz-name { font-size: 12px; }
}

/* ---- Step header --------------------------------------------------------------------- */
.step-icon-blue { background: var(--petra-brand-100); }
.step-icon-amber { background: var(--petra-brand-100); }
.step-title { color: var(--petra-ink); letter-spacing: -0.015em; }
.step-subtitle { color: var(--petra-ink-3); font-size: 13px; line-height: 1.5; max-width: 720px; margin-left: auto; margin-right: auto; }
.step-header { margin-bottom: 22px; }

/* ---- Level 1: the panel --------------------------------------------------------------
   NO GENERIC .petra-panel RULE LIVES HERE, and that is deliberate. The name was already
   taken: the "PETRA PANEL — clinician dashboard quick-run CTA" section above owns
   .petra-panel / .petra-panel-title / .petra-panel-desc / .petra-panel-cta-* for the launch
   card on dashboard.html. Because this section is last in the file, a .petra-panel rule here
   would silently win over that one — it shrank that card's 20px heading to 13.5px and flattened
   its blue-to-violet tint to plain white, leaving the CTA indistinguishable from the ordinary
   patient table beneath it.
   The panel look on the three steps is applied through each step's OWN classes instead —
   .psum-section on step 1, .pri-sec-block on step 2, .res-* on step 3 — which is why those
   blocks below repeat the same border, radius, shadow and band rather than inheriting them.
   Only the shared header meta slot is generic, and it is named clear of that family. */
.petra-head-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--petra-ink-3);
}

/* ---- Buttons ------------------------------------------------------------------------- */
.continue-btn, .results-action-btn-primary {
  background: var(--petra-brand);
  border-color: var(--petra-brand);
}
.continue-btn:hover, .results-action-btn-primary:hover {
  background: var(--petra-brand-700);
  border-color: var(--petra-brand-700);
}
.petra-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  font-family: inherit;
  color: var(--petra-brand);
  background: #FFFFFF;
  border: 1px solid var(--petra-brand-200);
  border-radius: 7px;
  padding: 6px 11px;
  min-height: 32px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.petra-edit-btn:hover { background: var(--petra-brand-050); border-color: var(--petra-brand-300); }
.petra-edit-btn svg { width: 13px; height: 13px; }

/* ============================================
   STEP 1 — the record, as panels
   ============================================ */

/* The demonstration / role note. */
.psum-note {
  background: var(--petra-brand-050);
  border-color: var(--petra-brand-200);
  color: var(--petra-brand-800);
  border-radius: 10px;
  padding: 11px 15px;
  line-height: 1.5;
}

/* The old .psum-section / .psum-grid / .psum-cell stack is now panel + definition grid.
   The classes are kept — history-rendered.js and the PDF path do not draw this screen, and
   keeping them means renderProfileSummary changes shape, not vocabulary. */
.psum-section {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  margin-bottom: 14px;
  overflow: hidden;
}
.psum-section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 11px 14px 11px 18px;
  background: var(--petra-band);
  border-bottom: 1px solid var(--petra-line-soft);
  font-size: 13.5px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--petra-ink);
}
.psum-section-title > svg { width: 16px; height: 16px; color: var(--petra-brand); flex-shrink: 0; }

/* Level 2: a definition grid ruled by hairlines. No cell is a box. */
.psum-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0;
}
.psum-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.psum-cell {
  background: none;
  border: none;
  border-radius: 0;
  border-left: 1px solid var(--petra-hair);
  padding: 13px 18px;
  min-width: 0;
}
/* :not(.psum-grid-3) is load-bearing — renderProfileSummary emits BOTH classes on the
   three-column panels (class="psum-grid psum-grid-3"), so an unqualified 4n+1 also matched
   them and stripped the hairline from the Health panel cell 5, leaving row 2 ruled between
   columns 2 and 3 but not between 1 and 2. */
.psum-grid:not(.psum-grid-3) > .psum-cell:nth-child(4n + 1) { border-left: none; }
.psum-grid-3 > .psum-cell:nth-child(3n + 1) { border-left: none; }
.psum-grid-3 > .psum-cell:nth-child(n + 4) { border-top: 1px solid var(--petra-hair); }
.psum-label { font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; color: var(--petra-ink-3); }
.psum-value { font-size: 15px; font-weight: 600; color: var(--petra-ink); margin-top: 4px; line-height: 1.3; }
.psum-na { color: var(--petra-ink-5); font-weight: 500; }
.psum-hint { padding: 11px 18px; margin: 0; font-size: 12px; color: var(--petra-ink-3); line-height: 1.55; }

@media (max-width: 760px) {
  .psum-grid, .psum-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* :nth-child(n) buys the specificity to beat the desktop 3n+1 / 4n+1 rules above, which
     otherwise keep stripping a border from whichever cell they matched in the wider grid —
     Heart rate lost its left hairline in the two-column layout. Matches every cell. */
  .psum-grid > .psum-cell:nth-child(n), .psum-grid-3 > .psum-cell:nth-child(n) { border-left: 1px solid var(--petra-hair); border-top: 1px solid var(--petra-hair); }
  .psum-grid > .psum-cell:nth-child(2n + 1), .psum-grid-3 > .psum-cell:nth-child(2n + 1) { border-left: none; }
  .psum-grid > .psum-cell:nth-child(-n + 2), .psum-grid-3 > .psum-cell:nth-child(-n + 2) { border-top: none; }
}

/* Flagged medications, as rows on the panel surface. */
.psum-section .concern-group { padding: 0; }
.psum-section .concern-item-readonly {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 18px;
  border: none;
  border-bottom: 1px solid var(--petra-hair);
  border-radius: 0;
  background: none;
}
.psum-section .concern-empty { padding: 13px 18px; margin: 0; font-size: 13.5px; color: var(--petra-ink-3); }

/* The severity prompt keeps its amber, because it is a REQUEST and not part of the record.
   It sits inside the ADHD panel, so it loses its own border and becomes a banded footer. */
.psum-cgis {
  margin: 0;
  border: none;
  border-top: 1px solid #F5E3B4;
  border-radius: 0;
  padding: 14px 18px;
}
.psum-cgis-missing { border-top-color: #F5B4B4; }

/* ============================================
   STEP 1 — clinician editing
   ============================================
   The panel is the unit of editing, which is only legible because the panel is now the unit
   of structure — one boundary doing both jobs. The FORM behind it is q_baseline_1, the
   baseline questionnaire, which already owns the vetted write path (qb_write_ok and its
   sixteen savevalues, plus profile_data and profile_complete) and already routes back here.
   Nothing on this screen writes to a record. */
.psum-section.is-editing { border-color: var(--petra-brand-300); box-shadow: 0 0 0 3px var(--petra-brand-050), var(--petra-shadow); }
.psum-section.is-editing .psum-section-title { background: var(--petra-brand-100); border-bottom-color: var(--petra-brand-200); }
.petra-edit-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #FFFFFF;
  background: var(--petra-brand);
  border-radius: 5px;
  padding: 3px 8px;
}

/* ============================================
   STEP 2 — the priorities, as panels
   ============================================ */
.pri-bank {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  padding: 14px 18px;
  margin-bottom: 18px;
}
.pri-bank-num { color: var(--petra-ink); font-size: 26px; }
.pri-bank-text { color: var(--petra-ink-3); }
.pri-bank-count { color: var(--petra-ink-3); }
.pri-tok.left { background: var(--petra-brand); }

/* The section header becomes a band, not a title with a rule under it inside a box. */
.pri-sec-block {
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  padding: 0;
  margin-bottom: 14px;
  overflow: hidden;
}
.pri-sec {
  padding: 11px 14px 11px 18px;
  margin: 0;
  border-bottom: 1px solid var(--petra-line-soft);
  background: var(--petra-band);
}
.pri-sec-title { font-size: 13.5px; color: var(--petra-ink); }
.pri-sec-title svg { width: 16px; height: 16px; color: var(--petra-brand); }
.pri-sec-help { display: none; }
/* The one-line help moves out of the band and onto the panel body, so the band stays one
   line tall and reads as a header on all three steps. */
.pri-sec-block .pri-sec-note {
  padding: 10px 18px 0;
  margin: 0;
  font-size: 12.5px;
  color: var(--petra-ink-3);
  line-height: 1.5;
}
.pri-sec-block .pri-rows { padding: 14px 18px; }

/* Two columns need a rule between them. Without it the eight side effects read as one ragged
   list and the eye cannot tell which stepper belongs to which name. */
.pri-grid { column-gap: 0; }
.pri-ae-row { border-bottom: 1px solid var(--petra-hair); }
.pri-grid > .pri-ae-row:nth-child(2n + 1) { padding-right: 22px; }
.pri-grid > .pri-ae-row:nth-child(2n) { padding-left: 22px; border-left: 1px solid var(--petra-hair); }
.pri-ae-name { color: var(--petra-ink-2); }
.pri-ae-row.on .pri-ae-name { color: var(--petra-ink); }
.pri-step-num { color: var(--petra-ink); }
.pri-step-btn:hover:not(:disabled) { background: var(--petra-brand-050); color: var(--petra-brand); }
.pri-pip.on { background: var(--petra-brand); }
.pri-chip-icon { color: var(--petra-brand-700); }
.pri-chip-figures { color: var(--petra-ink-2); }

/* Blood pressure — a sub-section of the same panel, ruled and not boxed. Two bordered boxes
   inside a bordered panel was the box-in-a-box the law above forbids.

   THE COLUMNS ARE GONE (2026-08-31), and with them .pri-bp-cols / .pri-bp-col / -col-head /
   -col-title, which existed only to draw the systolic and diastolic pair. The block is a
   heading and two rows now, and the rows are emitted into .pri-grid — so the 22px gutter, the
   hairline between the two columns and the mobile collapse all reach them through the rules the
   eight adverse-effect rows already use, and this section needs none of its own. */
.pri-bp-block { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--petra-line-soft); }
.pri-bp-title { font-size: 12.5px; color: var(--petra-ink); }
.pri-bp-help { color: var(--petra-ink-3); }

@media (max-width: 600px) {
  .pri-grid > .pri-ae-row:nth-child(2n),
  .pri-grid > .pri-ae-row:nth-child(2n + 1) { padding-left: 0; padding-right: 0; border-left: none; }
}

/* ============================================
   STEP 3 — the results, one level flatter
   ============================================ */

/* Section labels on the page ground, OUTSIDE every box. Four kinds of content were stacked
   as near-identical panels with nothing above them saying where one part ended and the next
   began; this is what gives the page a visible outline. */
.res-seclab { display: flex; align-items: baseline; gap: 10px; margin: 26px 2px 9px; }
.res-seclab-t { font-size: 11.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--petra-ink-3); }
.res-seclab-n { font-size: 11.5px; color: var(--petra-ink-3); }
.res-seclab-rule { flex: 1; border-top: 1px solid var(--petra-line); }
.res-seclab:first-child { margin-top: 8px; }

/* The group was a tinted box wrapping white cards wrapping ruled rows. It became a labelled
   band here; since 2026-10-06 a numbered group is tinted again (THE GROUP COLOURS, below). */
.res-group { background: none; border: none; border-radius: 0; margin-bottom: 6px; overflow: visible; }
.res-group-head {
  background: none;
  border-bottom: 1px solid var(--petra-line);
  padding: 0 2px 7px;
  margin-bottom: 12px;
}
.res-group-body { padding: 0; gap: 12px; }
.res-group.res-ref { background: none; border: none; }
.res-group.res-ref .res-group-head { background: none; border-bottom-color: var(--petra-line); }
.res-pill { background: #FFFFFF; border-color: var(--petra-line); color: var(--petra-ink-2); }
.res-pill-card { background: var(--petra-band); border-color: var(--petra-line-soft); }

.res-card { border-color: var(--petra-line); border-radius: 12px; box-shadow: var(--petra-shadow); }
.res-card-head { background: var(--petra-band); border-bottom-color: var(--petra-line-soft); }
.res-med, .res-score { color: var(--petra-ink); }
.res-sec-label { color: var(--petra-ink-3); font-size: 12px; letter-spacing: 0.05em; text-transform: uppercase; }
.res-disc-btn { color: var(--petra-brand); }
.res-disc-btn:hover { color: var(--petra-brand-800); }

/* The panels. Same border, radius and shadow as every other panel in the app. */
.res-overview, .res-pbest, .res-caveat, .res-run-panel {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
}
/* A thin coloured left edge is the thin-coloured-border problem this file already rejected
   once on .res-card. The probability block is set apart by its own column rhythm. */
.res-pbest { border-left-width: 1px; border-left-color: var(--petra-line); }
.res-run-panel { padding: 0; }
.res-run-title { padding: 11px 18px; margin: 0; background: var(--petra-band); border-bottom: 1px solid var(--petra-line-soft); }
.res-run-row { padding: 13px 18px; border-bottom-color: var(--petra-hair); }
.res-run-row:last-child { padding-bottom: 13px; }

/* The overview's group boxes go the same way as the cards' (tinted per group since 2026-10-06). */
.res-ov-group { background: none; border: none; border-radius: 0; padding: 0; margin-bottom: 14px; }
.res-ov-group-head {
  padding: 0 0 7px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--petra-line-soft);
}
.res-ov-trk, .res-pbest-trk { background: #F7FAFD; border-color: var(--petra-line-soft); }
.res-trk { background: #F7FAFD; border-color: var(--petra-line-soft); }

/* The local-preview notice is developer chrome. It stays dashed and grey so it can never be
   mistaken for one of the run notices. */
.local-preview-notice { border-color: var(--petra-ink-4); color: var(--petra-ink-2); }

/* ============================================
   STEPPER — navigable segments (2026-08-30)
   ============================================
   A segment is a <button> now. Back to any step already completed; never forward to one not
   yet reached, because step 2 scores against validated step 1 data and step 3 against the
   allocated points, so a skip would either fail the same gate the Continue button runs or
   rank an incomplete run. The disabled state carries that rule visually.
   ============================================ */
.petra-wiz-seg {
  font: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: none;
  border-left: 1px solid var(--petra-hair);
  border-radius: 0;
  cursor: default;
  transition: background 0.15s;
}
.petra-wiz-seg:first-child { border-left: none; }
.petra-wiz-seg.is-clickable { cursor: pointer; }
.petra-wiz-seg.is-clickable:hover { background: var(--petra-brand-050); }
.petra-wiz-seg.is-clickable:hover .petra-wiz-name { color: var(--petra-brand-800); }
.petra-wiz-seg.is-clickable:hover .petra-wiz-mark { border-color: var(--petra-brand); }
.petra-wiz-seg.is-clickable:active { background: var(--petra-brand-100); }
.petra-wiz-seg:focus-visible {
  outline: 2px solid var(--petra-brand);
  outline-offset: -3px;
}
/* A step not yet reached: quiet, and visibly not a control. Never dimmed with opacity — the
   current step is disabled too (pressing it would do nothing) and must stay fully legible. */
.petra-wiz-seg:disabled { cursor: default; }
.petra-wiz-seg:disabled:not(.is-current):not(.is-done) .petra-wiz-mark { background: #F2F5F8; color: var(--petra-ink-5); }
.petra-wiz-seg:disabled:not(.is-current):not(.is-done) .petra-wiz-name { color: var(--petra-ink-5); }
.petra-wiz-seg:disabled:not(.is-current):not(.is-done) .petra-wiz-state { color: var(--petra-ink-5); }

/* ============================================
   STEP 1 — what is still missing
   ============================================
   The baseline questionnaire marks every value "to fill", "to validate" or "done". Only
   "to fill" survives into a saved record — anything stored was validated on that form before
   it could be saved — so the recap carries that one state, in the same words and the same
   amber, and marks the cells it counted. It is a DISPLAY: the gate that stops an incomplete
   record reaching this page at all is mainLogic's baseline-first route, on profile_complete.
   ============================================ */
.psum-gap-chip {
  display: inline-flex;
  align-items: center;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #8A5200;
  background: #FFF4DC;
  border: 1px solid #F2D9A6;
  border-radius: 999px;
  padding: 2px 9px;
  white-space: nowrap;
}
.psum-section-title.has-gap { background: #FFFBF2; border-bottom-color: #F2E3C6; }
/* The cell keeps the grid's hairlines — a fill would make it a box, and the panel is the box.
   A dotted underline under the dash marks the blank as deliberate rather than broken. */
.psum-cell-gap .psum-label { color: #A97B2F; }
.psum-cell-gap .psum-value { color: #C08A3E; }
.psum-cell-gap .psum-na {
  color: #C08A3E;
  border-bottom: 1px dashed #E3C68C;
  padding-bottom: 1px;
}
/* A value the tool has REFUSED, which is not the same statement as a blank one and must not
   read as one. The gap ink above says nobody has filled this in and the record is merely
   incomplete; this says what is here cannot be used, so it takes the refusal red the blocked
   panel above the summary is drawn in and the two are recognisably one message. No fill and no
   border, like the gap: the panel is the box, and the grid keeps its hairlines. */
.psum-cell-bad .psum-label { color: #B91C1C; }
.psum-cell-bad .psum-value { color: #991B1B; font-weight: 700; }

/* ============================================
   RESULTS — the ranking figures take the theme colour (2026-08-30)
   ============================================
   The uncertainty band and its point marker on the Overview, and the probability bars under
   "How likely each medication is to come out top", are drawn in the theme lapis rather than
   slate. Requested, and it holds the line the original rule was protecting.

   THE RULE, RESTATED. The 2026-08-28 section above put it as "slate is anything that ranks",
   but the reason given there is the one that matters: the tier ramp had to go because green
   through red "read as good-to-bad, which is the claim the caveat panel explicitly
   disclaims". What is barred is a VALENCE — a colour that tells the reader which medication
   is the good one. Lapis is the app's own chrome colour, carries no valence, and is applied
   identically to every row, so nothing here says one medication is better than another; the
   position on the scale still does all the ordering.

   What stays untouched is the pair that DOES carry meaning: green for how well a medication
   works and red for side effects, on the outcome rows inside each card. Those name a kind of
   outcome, and the theme colour must never be used for one of them.
   ============================================ */
.res-ov-band { background: var(--petra-brand-100); border-color: var(--petra-brand-200); }
.res-ov-pt { background: var(--petra-brand); }
.res-pbest-fill { background: var(--petra-brand); }

/* ============================================
   THE LOADING SPINNER WAS INVISIBLE (2026-08-30)
   ============================================
   Bootstrap reads `.text-primary` as "text in the primary colour". Line 46 of this file
   overrides it with `--primary-text-color`, one of the LifeGuard template variables from the
   original upload, whose value is `white` — that variable means "text ON a primary ground",
   the opposite thing. Seven spinners carry the class and nothing else in the app does, so all
   seven were white. Four of them sit on white: home.html, where the spinner is the ONLY
   content on the page and the whole screen is a redirect the reader waits through, plus
   login_success, invite_sent and thank_you.

   Fixed here rather than at line 46 because the legacy :root block is wired to the bootstrap
   overrides with !important and is a trap, not a palette. !important is required to beat the
   !important already on that rule.
   ============================================ */
.text-primary { color: var(--petra-brand) !important; }

/* ============================================
   SHARED COMPONENTS — one grammar for every page (2026-08-30)
   ============================================
   The theme above brought the three steps of activity1 under one panel grammar. The other
   twenty-six pages never joined it, so the app draws boxes at five weights again — a table
   framed inside a framed card, a sign-in card with a large soft shadow nothing else uses, a
   tinted gradient CTA, a bordered tinted questionnaire cell inside a bordered questionnaire
   panel. This section is that grammar, named so any page can use it.

   ONE GROUND, THREE NAMES. The rule is not duplicated: .optimizer-canvas keeps its name on
   activity1, .dash-bg is named so the three dashboards convert with no markup edit at all
   (the theme section is later in the file than styles.css:4675 and wins the background at
   equal specificity), and .petra-canvas is what every other page adds to its <main>. Writing
   optimizer-canvas onto login.html would be a lie; a second rule with the same values would
   be two grounds that drift.

   SO THE GROUND IS NOT REPEATED BELOW. The selector list at styles.css:6113 was extended in
   place to `.optimizer-canvas, .petra-canvas, .dash-bg` — the one edit this section makes
   outside its own banner, and the reason there is no ground rule here.

   ON <main>, NEVER <body>. LifeGuard may strip body classes, and the content column is
   centred, so painting the column would leave the margins white.

   THE ONE THING TO CHECK BEFORE ADDING A RULE HERE. Being last in the file only wins at
   EQUAL specificity. Every override below is written in the incumbent selector shape —
   `.qb-f .sex-button-group.qb-seg`, not `.qb-seg`; `.run-summary-med .sum-rank`, not
   `.sum-rank` — because a bare class written against a two-class incumbent lands only the
   declarations nothing competes for, which is how half a component gets shipped.
   ============================================ */

/* ---- Level 1: the panel, at last generic ---------------------------------------------
   THE NAME. This is NOT .petra-panel and must never become it. That name is owned by the
   clinician dashboard quick-run CTA at styles.css:4568, and because this section is last a
   generic rule under that name silently wins over it — it shrank that card's 20px heading to
   13.5px and flattened its blue-to-violet tint to plain white. grep -rn "petra-panel"
   --include=*.html --include=*.js . returns eight lines, all in dashboard.html. When that
   markup moves to .petra-surface + .petra-launch the old name is VACATED AND STAYS VACATED,
   so nobody has to carry the exception in their head again.

   WHY A GENERIC PANEL NOW, when the theme above deliberately refused one. Up there the only
   consumers were three steps that already had their own class names, and repeating the
   anatomy three times was cheaper than fighting a collision. Down here the consumers are
   twenty-six pages, and repeating it twenty-six times is how the app got five box weights in
   the first place.

   ONE BAND PER PANEL. A panel that already has a titled band must not also tint its table
   head or its footer — two tinted strips separated by one hairline read as one tall band.
   That single rule decides the data table and the dialog footer below.

   .dash-console AND .dash-toolbar ARE GROUPED IN rather than given new markup. Both are
   single classes, so file order settles them, and the CTU console is otherwise the last box
   in the app still wearing an 18px radius, an #E5E7EB border and a black-tinted shadow. Its
   toolbar IS that panel's header band, which is what leaves the table head below with no tint
   left to spend.
   ============================================ */
.petra-surface,
.dash-console {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  margin-bottom: 14px;
  overflow: hidden;
  padding: 0;
}
/* Width is a modifier, not a second panel class. A sign-in card, a registration form and a
   reading page are the same box at three measures.
   .petra-measure IS THE SAME NUMBER UNDER AN HONEST NAME. The four reading pages need the
   920px column on the WRAPPER and not on a panel — methodology has two panels side by side
   on the ground, and .method-notice takes max-width: none from a LATER rule so it could not
   carry the measure itself. Those wrappers wore .petra-surface-lg, which said panel about a
   bare <div class="container">. Same declarations, so nothing moves a pixel; the name now
   says which of the two jobs it is doing. -lg keeps its place beside -sm and -md so the set
   of three is complete for the day a panel needs the wide measure. */
.petra-surface-sm { max-width: 440px; margin-left: auto; margin-right: auto; }
.petra-surface-md { max-width: 620px; margin-left: auto; margin-right: auto; }
.petra-surface-lg,
.petra-measure { max-width: 920px; margin-left: auto; margin-right: auto; }
.petra-surface.is-editing {
  border-color: var(--petra-brand-300);
  box-shadow: 0 0 0 3px var(--petra-brand-050), var(--petra-shadow);
}

/* The header band. Icon, then title, then the existing .petra-head-meta slot. The 18px left
   against 14px right is not a typo — it is the theme band padding, and it puts the icon on
   the same vertical as the first cell gutter below it. */
.petra-surface-head,
.dash-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 11px 14px 11px 18px;
  background: var(--petra-band);
  border-bottom: 1px solid var(--petra-line-soft);
  font-size: 13.5px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: -0.005em;
  color: var(--petra-ink);
}
/* A DIRECT child, so the glyph must not be nested inside the title span. `stroke` is declared
   because most of these icons carry a literal stroke="…" markup attribute, and a CSS stroke
   declaration beats a presentation attribute — unlike an inline style="…", which beats CSS. */
.petra-surface-head > svg {
  width: 16px;
  height: 16px;
  color: var(--petra-brand);
  stroke: var(--petra-brand);
  flex-shrink: 0;
}
.petra-surface-head.has-gap { background: #FFFBF2; border-bottom-color: #F2E3C6; }
.petra-surface.is-editing .petra-surface-head {
  background: var(--petra-brand-100);
  border-bottom-color: var(--petra-brand-200);
}
/* .patients-section h2 at styles.css:1172 is (0,1,1) and OUT-SPECIFIES .petra-surface-head at
   (0,1,0) on the one element this component was drawn for — the band would keep 15px/600
   #374151 type and, worse, a 12px bottom margin inside an overflow:hidden panel, which leaves
   a white strip between the tinted band and the table. Matched here with the band class in the
   selector, so it fires only where the markup has opted in and today's card is left alone.
   The svg reset is the stray 4px that would otherwise sit on top of the 9px flex gap. */
.patients-section h2.petra-surface-head {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--petra-ink);
  margin: 0;
}
.patients-section h2.petra-surface-head svg { margin-right: 0; stroke: var(--petra-brand); }

/* The body, and the footer that carries the panel's controls. The footer is the .psum-cgis
   shape — no border, no radius, one top rule — which the file already names as the model for
   anything that must sit inside a panel and lose its own edge. Deliberately NOT
   .nav-button-group, whose top rule was still the pre-theme #E5E7EB. */
.petra-surface-body { padding: 14px 18px 16px; }
.petra-surface-foot {
  margin: 0;
  border: none;
  border-top: 1px solid var(--petra-line-soft);
  border-radius: 0;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
/* The band sets align-items: center, and the CTU toolbar stacks its rows at 680px and needs
   stretch. That media query is EARLIER in the file (styles.css:4870) at the same (0,1,0), and
   an earlier media query loses to a later plain rule, so it has to be restated here. */
@media (max-width: 680px) {
  .dash-toolbar { align-items: stretch; }
}

/* ---- The page header -----------------------------------------------------------------
   Four page headers existed and disagreed: .page-header (dead — grep -rln "page-header"
   --include=*.html . returns NOTHING), .step-header (the one the theme converted),
   .history-header, and .dash-head. One component now, in two arrangements.

   CENTRED for a document, LEFT-ALIGNED for a working console. A dashboard is not a wizard
   step, and a centred title above a left-aligned table reads as a caption for something else.
   The three legacy names are grouped in, so the dashboards and the history pages take the
   type with no markup edit.

   THE MARK IS A DISC, not a 14px rounded square. 14px is the PANEL radius, so a 52px tile
   wearing it reads as a tiny panel sitting on the ground.

   THE SUBTITLE IS ink-2, NOT ink-3, and this is the one value the spec got wrong. The 4.57:1
   certified for ink-3 is measured against #FFFFFF, and this text now sits on the tinted
   ground — 4.10:1 on --petra-page, and 3.68:1 under the radial wash at the top of the page.
   Both are under the 4.5:1 floor for 13px body text, and two families would have got WORSE
   than they are today (.history-header p is #6B7280 at 14px on white, 4.83:1; .dash-head p is
   4.55:1 on #F7F8FA). ink-2 is 7.72:1 on the worst of those grounds. The lesson generalises:
   ink-3 is the floor for live text ON A PANEL, never for live text on Level 0.

   ⚠ THE GLYPH IS A MARKUP ATTRIBUTE, AND CSS DOES REACH IT. dashboard.html:54,
   ctu_dashboard.html:57 and patient_dashboard.html:48 write stroke="#FFFFFF" on the <svg>,
   and the two history pages write stroke="#3B82F6". A `stroke` PRESENTATION ATTRIBUTE ranks
   BELOW any CSS declaration — unlike an inline style="…" attribute, which ranks above one —
   so the rules below declare `stroke` and no white glyph survives on the new pale disc. That
   is the difference from the activity1 case the theme banner records: nothing there ever
   declared `stroke`, so nothing there ever beat the attribute.
   ============================================ */
.petra-page-head,
.page-header,
.history-header {
  text-align: center;
  padding: 0;
  margin-bottom: 22px;
}
/* padding: 0 is load-bearing — .history-header carries padding-top: 40px at styles.css:3372,
   a different property from the margin here, so nothing else would reset it. */
.petra-page-head h1,
.page-header h1,
.history-header h1 {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: var(--petra-ink);
  letter-spacing: -0.015em;
  margin: 0 0 6px;
}
/* display: block for the same reason — .history-header h1 is a centred flex row with gap 10px
   at styles.css:3381, so the icon needs an inline margin back once that gap is gone. */
.petra-page-head h1 svg,
.page-header h1 svg,
.history-header h1 svg {
  vertical-align: -3px;
  margin-right: 6px;
  stroke: var(--petra-brand);
}
.petra-page-head p,
.page-header p,
.history-header p {
  font-size: 13px;
  font-weight: 400;
  color: var(--petra-ink-2);
  line-height: 1.5;
  max-width: 720px;
  margin: 0 auto;
}

/* The working-console arrangement. Left aligned, mark beside the title rather than above it. */
.petra-page-head.is-row,
.dash-head {
  text-align: left;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0;
  margin: 8px 0 22px;
}
.petra-page-head.is-row h1,
.dash-head h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--petra-ink);
  letter-spacing: -0.015em;
  margin: 0 0 3px;
}
.petra-page-head.is-row p,
.dash-head p {
  font-size: 13px;
  color: var(--petra-ink-2);
  line-height: 1.5;
  max-width: 720px;
  margin: 0;
}
.petra-page-head-ic,
.dash-head-ic {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--petra-brand-100);
  color: var(--petra-brand);
}
/* The disc moved from the old slate #30384d to a pale brand fill, so a white glyph on it would
   be invisible. See the ⚠ above — this is a presentation attribute and CSS outranks it. */
.petra-page-head-ic svg,
.dash-head-ic svg { stroke: var(--petra-brand); }

/* ---- Controls: one primary, one secondary, one ring ----------------------------------
   THE LARGEST SINGLE CHANGE IN THIS FILE, in four lines. The theme above claimed
   .continue-btn and .results-action-btn-primary and stopped there, and NEITHER class appears
   on any auth, registration, confirmation, history or view-patient page. So the app has two
   primary buttons of record: lapis inside activity1, and --primary-bg-color #30384d — the
   old slate the navbar was deliberately moved OFF — everywhere a user signs in. Its hover is
   the same slate (--primary-hover-color is also #30384d), so it has never had a hover state.

   Editing styles.css:61 directly is the wrong fix and this is the right place: the legacy
   block keeps its history, and this section is last so it wins at equal specificity, exactly
   as .psum-* and .pri-* were handled.

   BOOTSTRAP LEAKS PAST A COLOUR-ONLY OVERRIDE, AND PAST AN OUTLINE-ONLY ONE TOO.
   .btn:focus-visible is (0,2,0) and sets background-color AND outline: 0, and
   .btn:first-child:active is (0,3,0) — neither is beaten by a .btn-primary rule that declares
   only an outline. So the fix is in two halves: .btn-primary:focus-visible declares its own
   background-color and border-color as well as the ring, and the --bs-btn-* custom properties
   are redefined on .btn-primary, which is what reaches the (0,3,0) active rule at all. One
   inherited custom property settles hover, focus and press together.

   ONE RING. The theme defines exactly one — outline 2px solid var(--petra-brand) — and
   applies it to exactly one selector. This is the full list. Offset 2px for a free-standing
   control, negative only where the edge is flush with a panel edge, which is why the stepper
   uses -3px and the segmented control below re-declares its own -2px. It also replaces the
   #3B82F6 at styles.css:4901.

   THE TWO ENTRIES THAT WERE HELD BACK ARE IN NOW, and they are the last two lines of this
   block rather than members of the list above, because they need a NEGATIVE offset. When
   this was written .run-header and .concern-item were plain <div>s with an onclick, no
   tabindex and no role, so no focus rule could ever have fired on them and one written here
   would have read as coverage the app does not have. That markup gap is closed:
   history-rendered.js:445 now emits the run header with role="button", tabindex="0" and
   aria-expanded, and patient_dashboard.html sets role, tabindex and an Enter and Space
   handler on the five concern rows. The read-only twin (optimizer.js:596,
   view_patient_data.html) takes no tabindex and so is still not focusable, which is correct
   — it is not a control.

   THREE RESIDUALS the theme's background and border-color overrides never reached, all old
   blue: .continue-btn:hover rgba(59,130,246,0.3) and both .results-action-btn-primary shadows.

   ⚠ .text-primary WAS A LIVE BUG and is already closed — see "THE LOADING SPINNER WAS
   INVISIBLE" immediately above this section. Named here only so this list of controls is
   complete; do not add a second rule for it.
   ============================================ */
.btn-primary {
  --bs-btn-bg: var(--petra-brand);
  --bs-btn-border-color: var(--petra-brand);
  --bs-btn-hover-bg: var(--petra-brand-700);
  --bs-btn-hover-border-color: var(--petra-brand-700);
  --bs-btn-active-bg: var(--petra-brand-700);
  --bs-btn-active-border-color: var(--petra-brand-700);
  --bs-btn-focus-shadow-rgb: 38, 97, 155;
  background-color: var(--petra-brand);
  border-color: var(--petra-brand);
  color: #FFFFFF;
}
.btn-primary:hover,
.btn-primary:active {
  background-color: var(--petra-brand-700);
  border-color: var(--petra-brand-700);
  color: #FFFFFF;
}
/* The half a colour-only override cannot do. Bootstrap repaints the button on keyboard focus
   from --bs-btn-hover-bg and kills the outline, so the colours have to be restated HERE and
   not only on :hover. box-shadow: none because one ring is the rule. */
.btn-primary:focus-visible {
  background-color: var(--petra-brand-700);
  border-color: var(--petra-brand-700);
  color: #FFFFFF;
  box-shadow: none;
}

/* The three legacy blue shadows the theme's fill overrides never reached. */
.continue-btn:hover { box-shadow: 0 4px 12px rgba(38, 97, 155, 0.3); }
.results-action-btn-primary { box-shadow: 0 1px 2px rgba(38, 97, 155, 0.18); }
.results-action-btn-primary:hover { box-shadow: 0 2px 6px rgba(38, 97, 155, 0.3); }

/* The secondary of record is .petra-edit-btn, and the pre-theme twin converges on it rather
   than staying a second grey-bordered white button three points away from it. */
.results-action-btn-secondary {
  background-color: var(--petra-panel);
  color: var(--petra-brand);
  border-color: var(--petra-brand-200);
}
.results-action-btn-secondary:hover {
  background-color: var(--petra-brand-050);
  border-color: var(--petra-brand-300);
  color: var(--petra-brand);
}
/* So the secondary can be an <a> without picking up the browser underline. */
.petra-edit-btn { text-decoration: none; }
.nav-button-group { border-top-color: var(--petra-line-soft); }

/* The bare anchor rule at styles.css:98-108 is literal `blue` from the LifeGuard template
   variables, on about forty links. A link is the brand colour, darkening on hover, and never
   one of the legacy :root values — --primary-link-color is a trap, not a palette. */
a { color: var(--petra-brand); }
a:hover { color: var(--petra-brand-800); }
a:active { color: var(--petra-brand-800); }

/* .feedback resolved to --warning-color, the keyword `red`, which is 4.00:1 on white and
   fails AA. #991B1B is 8.31:1 and is the fail-closed red the results panel already uses. */
.feedback { color: #991B1B; }

/* THE ONE RING, and the whole list of what wears it. */
.btn:focus-visible,
.continue-btn:focus-visible,
.back-btn:focus-visible,
.petra-edit-btn:focus-visible,
.results-action-btn:focus-visible,
.results-action-link:focus-visible,
.dash-tab:focus-visible,
.dash-invite:focus-visible,
.btn-view:focus-visible,
.btn-edit:focus-visible,
.btn-optimize:focus-visible,
.btn-remove:focus-visible,
.btn-section-action:focus-visible,
.manage-runs-btn:focus-visible,
.run-delete-btn:focus-visible,
.tried-btn:focus-visible,
.petra-launch-cta:focus-visible,
.vpd-breadcrumb a:focus-visible,
.qb-ok:focus-visible {
  outline: 2px solid var(--petra-brand);
  outline-offset: 2px;
}
/* Bootstrap draws its own halo beside the outline on .btn. One ring, so it goes. */
.btn:focus-visible { box-shadow: none; }
/* The two flush-edge cases. .run-card carries overflow: hidden for its 14px radius and an
   overflow:hidden ancestor CLIPS a descendant outline, so the 2px offset above would be cut
   off along the card edge — -3px is the value the stepper already uses for the same reason.
   A concern row is flush with the panel edge on both sides, so it takes the -2px the
   segmented control uses. */
.run-header:focus-visible {
  outline: 2px solid var(--petra-brand);
  outline-offset: -3px;
}
.concern-item:focus-visible {
  outline: 2px solid var(--petra-brand);
  outline-offset: -2px;
}

/* ---- Level 2: the form field ---------------------------------------------------------
   Four focus treatments across nine form pages today, and one of them REMOVES the ring from
   the sign-in field itself (.login-card .input-group .form-control:focus sets box-shadow:
   none, styles.css:481). Two are bootstrap default blue, one is the legacy #3B82F6. On
   q_baseline_1 both selects and every number input set outline:none and replace it with a 12
   per cent #3B82F6 halo, roughly 1.05:1 against white — no visible keyboard focus at all on
   the longest form in the app.

   A FIELD IS LEVEL 2, so no card and no tint. Label is .psum-label verbatim, input type is
   .psum-value's, because the field and the recap cell show the same value. Radius 7px is
   the only control radius the theme sets.

   THE RING IS AN OUTLINE, not the 3px --petra-brand-050 glow the editing panel uses. That
   glow is #F2F7FC and the CTU search box sits on a #F5F9FD band — three, two and one point
   apart per channel, so it would be invisible. An outline works on any ground.

   ERROR TEXT IS THE FAIL-CLOSED RED #991B1B, never amber, because amber means still to fill
   in. #991B1B on white is 8.31:1 where the current .feedback red is 4.00:1 and fails AA.

   ⚠ .profile-input AND .profile-select ARE GROUPED IN, NOT RENAMED. tests/mutate.js:515 and
   :737 match those class strings literally; a rename turns two mutants into no-ops that
   report as uncaught rather than failing.

   ⚠ THE QUESTIONNAIRE KEEPS ITS OWN CONTROL ANATOMY. Inside
   .qb-f every property this component sets is already claimed at higher specificity
   (.qb-f .profile-select and .qb-f input.qb-num at styles.css:5637),
   so the ONLY declaration that would reach the baseline form is min-height — and a
   32px floor grows every number box and every select in a forty-field dense grid while
   .qb-f .qb-der beside them stays at 5px 8px, so typed and derived values stop lining up.
   Pinned back below rather than shipped.
   ============================================ */
.petra-field { margin-bottom: 14px; }
/* margin as a shorthand and max-width: none on purpose: questionnaire.css loads BEFORE this
   file on all thirty pages and carries a bare `label` rule under 768px with margin-left 0.5em
   and max-width 70vw. This wins on specificity anyway, but only for what it declares. */
.petra-field-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--petra-ink-3);
  margin: 0 0 5px;
  max-width: none;
}
.petra-input,
.petra-field .form-control,
.petra-field .form-select,
.profile-input,
.profile-select {
  background: #FFFFFF;
  border: 1px solid var(--petra-line);
  border-radius: 7px;
  padding: 6px 11px;
  min-height: 32px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  color: var(--petra-ink);
  width: 100%;
}
.petra-input:focus,
.petra-field .form-control:focus,
.petra-field .form-select:focus,
.profile-input:focus,
.profile-select:focus {
  border-color: var(--petra-brand-300);
  outline: 2px solid var(--petra-brand);
  outline-offset: 2px;
  box-shadow: none;
}
/* See the ⚠ above. The baseline form keeps its own dense anatomy, so the one declaration that
   would have leaked into it is put back. */
.qb-f .profile-select,
.qb-f input.profile-input,
.qb-f input.qb-num { min-height: 0; }

.petra-field-help {
  font-size: 12px;
  color: var(--petra-ink-3);
  line-height: 1.55;
  margin: 5px 0 0;
}
.petra-field-err {
  font-size: 12.5px;
  font-weight: 600;
  color: #991B1B;
  margin: 5px 0 0;
}

/* The CTU search box is recoloured in place rather than given the class — it is one
   icon-prefixed field, and a wrapper abstraction with one user is not a component. */
.dash-search {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 7px;
}
.dash-search:focus-within {
  border-color: var(--petra-brand-300);
  background: var(--petra-panel);
  outline: 2px solid var(--petra-brand);
  outline-offset: 2px;
  box-shadow: none;
}
/* The toolbar around it is now a header band at 13.5px/700, and this input inherits weight. */
.dash-search input { font-weight: 500; color: var(--petra-ink); }
/* #9CA3AF placeholder was about 2.6:1. ink-3 is 4.57:1 on the white field. */
.dash-search input::placeholder { color: var(--petra-ink-3); }

/* ---- The segmented control -----------------------------------------------------------
   The stepper is the theme's only segmented control and it already states the shape: segments
   sit flush inside ONE container, divided by a hairline with the first dropping it, the
   current one takes ground and ink, hover is the brand wash, focus is inset because the edge
   is flush, and an unavailable segment is expressed with colour and never with opacity.

   THE CTU TABS ARE THREE BOXES DEEP TODAY: a tinted bordered rounded .dash-tabs inside the
   white .dash-console, holding a white rounded .dash-tab.active with its own drop shadow.
   Three surfaces for one level of meaning.

   THE CURRENT SEGMENT TAKES AN INSET 2px BRAND RULE, not a border-bottom. A tab has no
   numbered mark to carry its state the way a stepper segment does, so it needs one more
   marker, and the stepper's progress fill scaled to one segment is that marker. Inset, because
   a real border would shift the content two pixels.

   .dash-tab and .qb-seg keep their names — the tab JS toggles .active by name, and the
   questionnaire generates eighteen of its twenty-one groups from a JS template string.

   ⚠ THE CONTAINER SELECTORS ARE WRITTEN AT THREE CLASSES DEEP, and that is the whole
   difference between this working and shipping half of it. The incumbents are
   `.qb-f .sex-button-group.qb-seg` at styles.css:5599 and `.qb-f .cgis-scale.qb-scale` at
   :5719, both (0,3,0). A bare `.qb-f .qb-seg` at (0,2,0) would land the new border, radius
   and overflow — nothing competes for those — and lose gap: 0, so all twenty-one yes-or-no
   groups and the seven-point scale would become a bordered rounded box holding 3px-gapped
   segments with stray hairlines floating in the gaps. Worse than today.

   ⚠ THE RESTING LABEL IS ink-2, NOT ink-4. ink-4 is 2.63:1 on white, 2.28:1 on the red
   .qb-f state ground and 2.37:1 on the amber one, at 13.5px/700, which is not WCAG large
   text — so an ENABLED control label would have gone from 8.29:1 to under a quarter of the
   floor, and the unanswered options would have become the palest text on the page inside the
   very cell that is meant to shout. ink-4 is sanctioned for the not-yet-reached stepper
   segment, which is genuinely disabled and unreachable. A clickable tab is not that.

   ⚠ overflow: hidden CLIPS A DESCENDANT OUTLINE, and the only keyboard focus indicator these
   groups have is drawn OUTSIDE the label box. The radio itself is opacity 0 and absolutely
   positioned, so a :focus-visible rule on the item can never match — the existing
   `input:focus-visible + label` rule at styles.css:5633 is what draws it. It is restated at
   the foot of this block against the same elements, in the brand colour, at offset -2px so
   the ring is drawn INSIDE the clip.
   ============================================ */
.petra-seg,
.dash-tabs {
  display: inline-flex;
  align-items: stretch;
  background: none;
  border: 1px solid var(--petra-line);
  border-radius: 7px;
  overflow: hidden;
  gap: 0;
  padding: 0;
}
/* display and flex-wrap are deliberately NOT declared here: the yes-or-no group fills its
   grid cell today and the labels are flex: 1 1 auto, so re-declaring display would shrink
   twenty-one controls to their content width in a grid where they currently line up. */
.qb-f .sex-button-group.qb-seg {
  gap: 0;
  padding: 0;
  background: none;
  border: 1px solid var(--petra-line);
  border-radius: 7px;
  overflow: hidden;
}
/* The severity scale is the same container drawn as a grid, because seven cells must be equal
   width. It needs its own rule for that reason and not just for specificity. */
.qb-f .cgis-scale.qb-scale {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0;
  margin: 0;
  padding: 0;
  background: none;
  border: 1px solid var(--petra-line);
  border-radius: 7px;
  overflow: hidden;
}

.petra-seg-item,
.dash-tab,
.qb-f .qb-seg label,
.qb-f .qb-scale .cgis-option {
  border: none;
  border-left: 1px solid var(--petra-hair);
  border-radius: 0;
  background: none;
  color: var(--petra-ink-2);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
/* Geometry only for the two that can carry it. The questionnaire keeps 5px 8px and 4px 3px 5px
   — a 9px 16px segment in a forty-field dense grid, and 16px of side padding in a seventh of a
   grid cell, is the same regression the min-height pin above exists to stop. */
.petra-seg-item,
.dash-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  padding: 9px 16px;
}
/* The yes-or-no group interleaves <input> and <label>, so the first LABEL is never the first
   child. :first-of-type is not a nicety here, it is the only thing that matches. */
.petra-seg-item:first-child,
.dash-tab:first-child,
.qb-f .qb-seg label:first-of-type,
.qb-f .qb-scale .cgis-option:first-child { border-left: none; }

/* :not(.active) matches the incumbent .dash-tab:hover:not(.active) at (0,3,0) — a bare
   .dash-tab:hover would lose the colour half of the hover and keep only the ground. */
.petra-seg-item:hover,
.dash-tab:hover:not(.active),
.qb-f .qb-seg label:hover,
.qb-f .qb-scale .cgis-option:hover {
  background: var(--petra-brand-050);
  color: var(--petra-brand-800);
  border-color: var(--petra-hair);
}
.petra-seg-item:active,
.dash-tab:active,
.qb-f .qb-seg label:active,
.qb-f .qb-scale .cgis-option:active { background: var(--petra-brand-100); }

.petra-seg-item.is-active,
.dash-tab.active {
  background: var(--petra-brand-050);
  color: var(--petra-ink);
  box-shadow: inset 0 -2px 0 var(--petra-brand);
}
.dash-tab.active svg { color: var(--petra-brand); }
/* One neutral outlined count in both states. The active count was #3B82F6 filled, which made
   a number look like a control. */
.dash-tab .tab-count,
.dash-tab.active .tab-count {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
}
/* Unavailable is a colour, never opacity — the reason --petra-ink-5 exists at all. */
.petra-seg-item:disabled,
.dash-tab:disabled { color: var(--petra-ink-5); cursor: default; }

/* Offset -2px, not the 2px the general ring uses, because the segment edge is flush with the
   container edge and the container clips. */
.petra-seg-item:focus-visible,
.dash-tab:focus-visible {
  outline: 2px solid var(--petra-brand);
  outline-offset: -2px;
}
/* The radio is the element that actually takes focus, and it is opacity 0 and out of flow, so
   the ring has to be drawn on its sibling. Same selectors as styles.css:5633 so this replaces
   that ring rather than sitting beside it, in the brand colour rather than the one-off #1B6FB5
   that appears nowhere else in the app, and inset so the container clip cannot eat it. The
   seven-point scale had NO focus indicator of any kind, so its half is new. */
.qb-f .qb-seg input[type="radio"]:focus-visible + label,
.qb-f .qb-scale input[type="radio"]:focus-visible ~ .cgis-label {
  outline: 2px solid var(--petra-brand);
  outline-offset: -2px;
}

/* Below 780px the scale wraps to four columns and below 440px to two. Both of those media
   queries live EARLIER in the file (styles.css:5724-5725) at the same (0,3,0) as the rule
   above, and an earlier media query loses to a later plain rule — so grid-template-columns
   has to be restated here or the mobile scale snaps back to seven columns. A wrap also starts
   a new row, so the row-start cell drops its divider and everything below the first row gains
   a top hairline. Same idiom .psum-grid uses at its own breakpoint, including the :nth-child(n)
   reset, which exists purely to buy specificity over the desktop :first-child rule. */
@media (max-width: 780px) {
  .qb-f .cgis-scale.qb-scale { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .qb-f .qb-scale .cgis-option:nth-child(n) { border-left: 1px solid var(--petra-hair); border-top: none; }
  .qb-f .qb-scale .cgis-option:nth-child(4n+1) { border-left: none; }
  .qb-f .qb-scale .cgis-option:nth-child(n+5) { border-top: 1px solid var(--petra-hair); }
}
@media (max-width: 440px) {
  .qb-f .cgis-scale.qb-scale { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qb-f .qb-scale .cgis-option:nth-child(n) { border-left: 1px solid var(--petra-hair); border-top: none; }
  .qb-f .qb-scale .cgis-option:nth-child(2n+1) { border-left: none; }
  .qb-f .qb-scale .cgis-option:nth-child(n+3) { border-top: 1px solid var(--petra-hair); }
}
/* The reduced-motion block at styles.css:5795 already turns the questionnaire transitions off,
   and it is EARLIER in the file at the same (0,2,1) as the item rule above — so a later plain
   rule that names `transition` silently switches motion back on for somebody who asked for
   none. Restated here for every segment this component owns. */
@media (prefers-reduced-motion: reduce) {
  .petra-seg-item,
  .dash-tab,
  .qb-f .qb-seg label,
  .qb-f .qb-scale .cgis-option { transition: none; }
}

/* ---- The data table ---------------------------------------------------------------------
   RECOLOURED IN PLACE, and no shared table class is invented. patients.js writes the entire
   table as a string, including patients-table, sort-active, sort-arrow, name-cell,
   patient-name, patient-email, td-actions, row-actions, patient-row, cell-chip and the five
   cell-* variants. Renaming any of them silently unstyles a column with nothing in the console.

   THE TABLE STOPS DRAWING A BOX. styles.css:1184 gives it a border, a radius and
   overflow:hidden inside a bordered card — a literal box in a box — and two later patches at
   4923 and 4933 exist only to cancel it in the two places it actually renders. It is cancelled
   at the base here instead. The two patches are NOT deleted: they set the same values, so they
   are harmless, and the range 4933-4936 spans a rule boundary — cutting it would leave
   `.dash-console .patients-table,` followed by `position: sticky`, an invalid selector list
   that takes the sticky mitigation down with it when the parser discards the block.

   THE HEAD TAKES NO TINT. Both table panels already have a titled band above them (the
   patients panel gets one, the CTU console's toolbar IS one), and one band per panel is the law.
   A column-header row inside a panel is Level 2, so with the band spent it is uppercase
   11px/700 ink-3 on nothing — which is .med-detail-label exactly. It takes var(--petra-panel)
   rather than transparent only because the header is sticky and rows scroll under it.

   ink-3 and NOT ink-4: ink-4 at 11px uppercase is 2.63:1, ink-3 is 4.57:1. Same call the
   .med-detail-label comment records. (.pri-bp-col-title carried this shape too, and was the
   comment this one used to point at; it went with the blood-pressure columns on 2026-08-31.)

   ⚠ HORIZONTAL PADDING STAYS AT 12px ON THE INNER COLUMNS. table-layout is fixed and the
   seven column widths are pinned, td and th are overflow:hidden, and .cell-chip is
   white-space:nowrap with no ellipsis — so every pixel of extra padding comes out of the chip
   and is cut mid-glyph with nothing to show for it. Concerns is 8 per cent of a 912px table,
   about 73px, and an "Incomplete" chip is already tight in it. The 18px gutter goes on the
   first and last columns only, which are Name at 17 per cent and Actions at 22 per cent.

   ⚠ STICKY IS SCOPED TO THE CTU CONSOLE. .petra-surface carries overflow:hidden for its
   radius, and an overflow:hidden ancestor becomes the sticky element's scroll container, so a
   sticky head inside a page-scrolled panel simply stops sticking. The console pane is a capped
   internal scroller, so it still works there at top:0. Losing it on the clinician dashboard is
   the trade: that list is one clinician's assigned patients, not a roster.

   ⚠ THREE OF SEVEN HEADS CLAIM TO BE CLICKABLE AND ARE NOT. The handler binds th[data-sort],
   and Baseline, Errors and Concerns carry none. The cursor and the hover are scoped to the
   attribute, and the blanket th:hover is turned off first because it is (0,2,2) and an
   attribute-scoped rule alone would not reach it.
   ============================================ */
.patients-table {
  border: none;
  border-radius: 0;
  overflow: visible;
}
.patients-table thead th {
  position: static;
  background: var(--petra-panel);
  color: var(--petra-ink-3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 11px 12px;
  border-bottom: 1px solid var(--petra-line-soft);
  border-left: 1px solid var(--petra-hair);
  white-space: nowrap;
  cursor: default;
  user-select: none;
}
.patients-table thead th:first-child { border-left: none; padding-left: 18px; }
.patients-table thead th:last-child { padding-right: 18px; }
/* Off first, at the same (0,2,2) as styles.css:1210, then back on only where sorting works. */
.patients-table thead th:hover { background: var(--petra-panel); color: var(--petra-ink-3); }
.patients-table thead th[data-sort] { cursor: pointer; }
.patients-table thead th[data-sort]:hover {
  background: var(--petra-brand-050);
  color: var(--petra-ink-2);
}
/* Opacity 0.3 was doing the work of a colour. State is a colour here, as everywhere else. */
.patients-table thead th .sort-arrow { opacity: 1; color: var(--petra-ink-5); }
.patients-table thead th.sort-active .sort-arrow { opacity: 1; color: var(--petra-brand); }

.patients-table tbody td {
  padding: 13px 12px;
  border-bottom: 1px solid var(--petra-hair);
  border-left: 1px solid var(--petra-hair);
  color: var(--petra-ink-2);
  vertical-align: middle;
}
.patients-table tbody td:first-child { border-left: none; padding-left: 18px; }
.patients-table tbody td:last-child { padding-right: 18px; }
.patients-table tbody tr:last-child td { border-bottom: none; }
/* The same hover the clickable stepper segment and .petra-edit-btn use. No zebra striping —
   a fill inside a panel is a box. */
.patients-table tbody tr:hover { background: var(--petra-brand-050); }
.patients-table .patient-name { font-weight: 600; color: var(--petra-ink); }
/* ⚠ This one is dead until the markup changes. patients.js writes the email cell with
   bootstrap's .text-muted, which carries !important, so no rule here can reach it. */
.patients-table .patient-email { color: var(--petra-ink-3); font-size: 12px; }

/* The console pane is a capped internal scroller, so the head sticks to the top of the PANE. */
.dash-console .patients-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--petra-panel);
}
/* Below 576px the table scrolls sideways inside its own container and both paddings drop, at
   styles.css:1301. Same (0,1,2) as the rules above and EARLIER in the file, so the desktop
   padding would win inside that media query and the seven columns would go back to overflowing
   a phone. Restated, gutters included. */
@media (max-width: 576px) {
  .patients-table thead th { padding: 9px 10px; }
  .patients-table tbody td { padding: 10px; }
  .patients-table thead th:first-child,
  .patients-table tbody td:first-child { padding-left: 12px; }
  .patients-table thead th:last-child,
  .patients-table tbody td:last-child { padding-right: 12px; }
}

/* ---- The empty state ---------------------------------------------------------------------
   .empty-state and .no-history are two names for one component, and .no-history is DEFINED
   TWICE with conflicting values (styles.css:1612 padding 40px, styles.css:4129 padding 60px,
   p at 14px then 15px), so the later block silently wins and anyone editing the first sees no
   effect. Grouped and settled here at the theme's 48px 20px.

   IT IS THE BODY OF A PANEL, never a box of its own and never on the bare ground, because the
   ground is not a surface for content. Where it is the only content on the page (the two
   history pages), the block itself becomes the panel — the same reasoning the auth card gets.

   NO OPACITY. The icon goes to ink-4 at FULL strength rather than a 0.4 dim, because this
   system refuses opacity as a way of expressing state — the stepper's own comment says so, and
   the reason --petra-ink-5 exists at all is to avoid it.

   ⚠ THE GLYPH WAS A MARKUP ATTRIBUTE, AND IT WAS NOT WHERE THE SPEC SAID. stroke="#D1D5DB"
   was written by patients.js and by patient_dashboard.html; the two history pages emit no svg
   at all and are a bare <p>. Every one of those literals is now stroke="currentColor", and a
   `stroke` presentation attribute is beaten by a CSS `stroke` declaration either way, so the
   rule below reaches all four whichever the markup says. grep for D1D5DB over every html and
   js file under build/site now returns nothing.

   ✔ .no-history.petra-surface IS LIVE NOW, and this records it as done rather than pending.
   When it was written all six emitters wrote the bare class and none wrote petra-surface. All
   six do now — history-rendered.js:468, optimizer_history.html:134,
   optimizer_history_clinician.html:156, patient_dashboard.html:514 and :524,
   view_patient_data.html:558 — and every one renders straight onto the page ground with no
   card around it, which is the case the compound rule was written for. It is still
   deliberately NOT applied to bare .no-history, so an empty state that ever lands inside a
   panel cannot become a panel inside a panel.

   If it carries an action, that action is .petra-edit-btn and never .continue-btn — a solid
   brand fill in an otherwise empty panel is the loudest thing on the page. The margin that
   holds it off the sentence is in the gaps section at the foot of this file.
   ============================================ */
.empty-state,
.no-history {
  text-align: center;
  padding: 48px 20px;
  color: var(--petra-ink-3);
  font-size: 14px;
}
.empty-state p,
.no-history p {
  font-size: 14px;
  color: var(--petra-ink-3);
  margin: 0;
}
.empty-state svg,
.no-history svg {
  opacity: 1;
  color: var(--petra-ink-4);
  stroke: var(--petra-ink-4);
  margin-bottom: 12px;
}
/* styles.css:4862 scopes a 40px override to the CTU pane at (0,2,0), which the shared rule
   above cannot reach. Matched here so one padding stands everywhere. */
.dash-pane .empty-state { padding: 48px 20px; }
/* Where the empty state is the whole page, the block IS the panel. */
.no-history.petra-surface {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  margin-bottom: 14px;
  overflow: hidden;
}

/* ---- Notices, and the one coloured block ---------------------------------------------------
   AMBER MEANS ONE OF THREE THINGS AND NOTHING ELSE: the numbers are not real, a request to the
   clinician, or still to fill in. Four blocks currently spend it on something else — the
   landing access statement on the first two screens a user ever sees, the change-password
   padlock, a hash-assigned avatar tint, and "currently taking this medication".

   A HAZARD IS A WIDE HATCHED BAND, NEVER A THIN COLOURED EDGE. .patient-alert is still border
   1px solid #F59E0B with border-left-width 4px, the exact pattern removed from
   .patient-demo-notice, from .res-card and from .res-pbest. It gets the 45-degree hatch.

   ⚠ .patient-alert's STYLESHEET RULE IS ALREADY DEAD. view_patient_data.html:375-386 writes six
   .style.cssText strings at runtime, and an inline style beats any rule that is not !important.
   The two have already drifted apart unnoticed (#FCD34D and radius 12 at runtime against
   #F59E0B and radius 10 in the file), which is the proof nobody can see what the stylesheet
   does. Those six lines must be deleted before this block does anything at all — it is written
   now so the deletion has something correct to fall back to, not because it is live.

   THE SUCCESS TICK LOSES ITS GREEN, on the one page where that actually matters.
   .patient-notice-ok was #ECFDF5 with a #059669 glyph — the exact .res-fill-eff efficacy hex —
   and patient_dashboard renders saved medication scores further down the SAME scroll, so a
   reader met green-means-that-worked and green-means-how-well-a-medication-works in one
   screen. It takes the .psum-note brand tint instead. The tick shape and the words are the
   success signal, which is the ruling the confirmation pages already follow.

   SEVERAL CONDITIONS AT ONCE BECOME ONE NEUTRAL PANEL, not N coloured boxes. That is
   .res-run-panel, and it is the general answer wherever a page would otherwise stack alerts.
   The eight bootstrap .alert.alert-danger boxes on the registration pages become
   .petra-field-err lines, keeping every id, because the show and hide logic addresses them by
   id and not by class.
   ============================================ */
.patient-alert {
  align-items: flex-start;
  padding: 16px 18px 16px 32px;
  background-color: #FEF3C7;
  background-image: repeating-linear-gradient(45deg, #B45309 0 7px, #F59E0B 7px 14px);
  background-size: 14px 100%;
  background-repeat: no-repeat;
  background-position: left top;
  border: 2px solid #F59E0B;
  border-left-width: 2px;
  border-radius: 10px;
  color: #92400E;
  line-height: 1.45;
}
.patient-alert-icon { color: #B45309; stroke: #B45309; }
.patient-alert-title { font-size: 16px; font-weight: 800; letter-spacing: 0.01em; color: #92400E; }
.patient-alert-msg { font-size: 14px; font-weight: 500; }

.patient-notice { border-radius: 10px; }
.patient-notice-ok {
  background: var(--petra-brand-050);
  border: 1px solid var(--petra-brand-200);
  color: var(--petra-brand-800);
}
/* patient_dashboard.html:216 writes stroke="#059669" on this glyph. A presentation attribute,
   so CSS reaches it — which matters here, because green on this page names a kind of outcome. */
.patient-notice-ok svg { stroke: var(--petra-brand); }

/* The access statement is not a warning, it is a fact about who the site is for, and it sits
   above the fold on the first two screens anybody sees. Amber there spends the one colour that
   has to still mean something four screens later. */
.landing-banner {
  background: var(--petra-band);
  border-bottom: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
}

/* The methodology closing notice is the only statement in the app about the limits of the tool
   in clinical use, and it was drawn as a grey decorative box. It becomes one neutral panel with
   a lead line and a body — the .res-run-panel row type inside the .res-caveat shell — rather
   than a hazard, because the hazard treatment is reserved for "these numbers are not real" and
   this text is not that. One panel, not a tint. */
.method-notice {
  max-width: none;
  margin: 0 0 14px;
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  padding: 15px 18px;
  gap: 12px;
}
.method-notice-icon { color: var(--petra-brand); stroke: var(--petra-brand); }
.method-notice-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--petra-ink);
  margin-bottom: 3px;
}
.method-notice-text { font-size: 12.5px; color: var(--petra-ink-2); line-height: 1.5; }
/* The wrapper the five method cards sit in caps them at 760px and centres them, which is a
   third measure nothing else in the app uses and which would cap the shared panel too. The
   panel carries its own measure through .petra-surface-lg, so the wrapper stops carrying one. */
.method-grid { max-width: none; margin: 0; }

/* .psum-note is already the informational note of record — brand tint, #C2D9EC hairline,
   --petra-brand-800 text, radius 10px. Named here so nobody derives a second one. */

/* ---- Status chips, counts and the avatar ---------------------------------------------------
   THE THEME GIVES THREE CHIP SHAPES AND THEY MEAN DIFFERENT THINGS, so every chip is picked by
   MEANING and not by look. Rectangular radius 5, filled brand, uppercase (.petra-edit-chip) =
   a live state the app is in. Pill radius 999, outlined (.res-pill) = a neutral label or a
   count. Pill radius 999 in gap amber (.psum-gap-chip) = still to fill in, and nothing else.
   There is no fourth badge colour available without breaking the colour rule.

   WHAT THAT SETTLES, row by row. The baseline-complete chip loses its GREEN — green names a
   kind of outcome and a finished baseline is the resting state, so it becomes the quietest
   thing in the row. The incomplete chip keeps its amber but moves to the EXACT .psum-gap-chip
   values, because it means still to fill in, that amber was borrowed from the baseline
   questionnaire on purpose so the two screens read as one vocabulary, and it is the same
   record. The error chip KEEPS the hazard amber, because a reported error is the one real
   warning in the row, but becomes a SOLID block rather than an outlined pill, which is how it
   outranks the gap chip without inventing a colour. The concerns chip is a COUNT and loses the
   legacy blue.

   Result: at most one coloured chip per row, and only when something needs doing. That is the
   notice-stack law applied to a table row.

   THE MEDAL RAMP AND THE SCORE RAMP GO, and they are written at TWO classes deep because that
   is what the incumbents are. .sum-rank.r1/.r2/.r3 (styles.css:3522) and
   .sum-score.high/.mid/.low (:3537) are (0,2,0); a bare .sum-rank at (0,1,0) written at the end
   of the file loses to both, and the collapsed run header would keep an amber-grey-orange medal
   and a green-yellow-grey score while the expanded rows below it read neutral lapis. #FEF3C7 is
   the reserved hazard ground and #DCFCE7/#166534 is the reserved efficacy green, so this is the
   same good-to-bad ramp the results screen deleted, still drawn on the stored copy.

   .excl-pill LOSES ITS STRIKE-THROUGH, which is the part carrying the false meaning. A struck
   name says the medication was removed from the analysis; the comment three lines above the
   render says the opposite in as many words — a concern never removes a medication, everything
   still scores. It becomes an outlined pill in the hazard amber the glyph beside it now uses.

   THE FIVE AVATAR COLOURS GO. The hue is a hash of the username, so it carries nothing by
   construction, and two of the five are the app's hazard ground (#FEF3C7) and a red (#FFE4E6),
   sitting in the same row as a real amber chip. The tier ramp was deleted for reading as a
   meaning it did not carry; this is the same fault with a weaker excuse.
   ⚠ Keep all five .av-* selectors DEFINED — patients.js writes them, so deleting the rules
   leaves the avatars with no background at all.
   ============================================ */
.cell-chip {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
}
/* A reported error is the one real warning in the row, and a solid block is how it outranks an
   outlined pill without a new colour. Same shape and same fill as .res-concern-flag. */
.cell-error {
  color: #FFFFFF;
  background: #B45309;
  border: 1px solid #B45309;
  border-radius: 4px;
  padding: 3px 9px;
}
/* .psum-gap-chip verbatim — still to fill in, in the amber the baseline questionnaire uses. */
.cell-incomplete {
  color: #8A5200;
  background: #FFF4DC;
  border: 1px solid #F2D9A6;
  letter-spacing: 0.02em;
}
/* A finished baseline is the resting state, so it is the quietest thing in the row. */
.cell-complete {
  color: var(--petra-ink-2);
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
}
/* A count, not a status. */
.cell-flag {
  color: var(--petra-ink-2);
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
}
.cell-none { color: var(--petra-ink-5); font-weight: 600; }

.dash-avatar {
  background: var(--petra-band);
  color: var(--petra-ink-2);
  border: 1px solid var(--petra-line-soft);
}
.av-blue,
.av-violet,
.av-teal,
.av-amber,
.av-rose { background: var(--petra-band); color: var(--petra-ink-2); }

/* The newest run is the state the record is in, so it takes the filled brand chip. Everything
   older is a label, so it takes the quiet outlined one. */
.run-badge {
  border-radius: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
}
.run-badge.latest { background: var(--petra-brand); color: #FFFFFF; }
.run-badge.older {
  background: var(--petra-band);
  color: var(--petra-ink-2);
  border: 1px solid var(--petra-line-soft);
  border-radius: 999px;
  letter-spacing: 0;
  text-transform: none;
}
.run-pill {
  font-size: 10.5px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
}
/* Two classes deep, to match styles.css:3510 and :3522. See the note above. */
.run-summary-med .sum-rank {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
}
.sum-rank.r1,
.sum-rank.r2,
.sum-rank.r3 { background: var(--petra-band); color: var(--petra-ink-2); }
.run-summary-med .sum-score {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
  border-radius: 999px;
  padding: 1px 8px;
}
.sum-score.high,
.sum-score.mid,
.sum-score.low { background: var(--petra-band); color: var(--petra-ink-2); }
/* Two classes deep, to match styles.css:1559. */
.history-card .entry-number,
.entry-number {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
  border-radius: 999px;
}
/* Currently taking this medication is a fact, not a warning, so it stops spending amber. */
.tried-indicator {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
  border-radius: 999px;
  padding: 1px 8px;
}
/* No strike. The words beside it say raised as a concern, and a concern never removes a
   medication from the analysis — everything still scores. */
.excl-pill {
  text-decoration: none;
  border-radius: 999px;
  padding: 1px 8px;
  background: #FEF3C7;
  border: 1px solid #F59E0B;
  color: #92400E;
}

/* ============================================
   SAVED RUNS — the record says what the live screen says (2026-08-30)
   ============================================
   THE APP CONTRADICTED ITSELF. The 2026-08-28 section deleted the good-to-bad tier ramp from
   the live results, in its own words because green through red "read as good-to-bad, which is
   the claim the caveat panel explicitly disclaims". Every SAVED copy of those same results
   still showed it. history-rendered.js:222 and :227-232 feed tierClass() into ci-tN, pt-tN,
   fill-tN and score-tN, so a clinician saw a neutral lapis ranking when the tool ran and a
   traffic-light ranking of the identical numbers when they opened the record. That ramp is
   LIVE, not dead — only the .tier-label-bar badge ramp at styles.css:3592-3596 is inert,
   because line 257 emits the bar with no tN class, which is a loaded gun rather than a comfort.

   THE NAMES STAY. The 2026-08-28 banner kept .ae-bar-* rather than renaming precisely so
   history-rendered.js would keep working. Recolouring is not renaming, and this file's own
   instruction for .patients-table settles the method — recolour in place.

   ✔ THE REVERSED COLOUR PAIR IS ALREADY FIXED, and this note records it as DONE rather than
   outstanding. Until 2026-08-30 barRow() at history-rendered.js:293 took a `dim` flag that all
   three call sites passed false and hard-coded 'ae-high', so the bar labelled "How well it
   works" was drawn in the SIDE-EFFECT RED on every saved run. barRow now takes a `kind`
   argument and emits ae-efficacy for the symptom-control row (history-rendered.js:296, called
   with 'eff' at :309 and 'ae' at :321 and :337). .ae-bar-fill.ae-efficacy had been in
   styles.css since the page was built and had never once rendered — so the rule below is the
   first time its colour is on screen, and it is checked here for that reason.

   ⚠ .ae-bar-track AT styles.css:3122-3129 IS LIVE AND MUST NOT BE DELETED. An earlier draft of
   the dead-rules list swept 3109-3146 in one range. history-rendered.js:296 emits
   <div class="ae-bar-track"> on every symptom-control, side-effect and blood-pressure row of
   every saved run, and that rule is the ONLY thing giving the bar its 10px height and its
   overflow clip. Delete it and .ae-bar-fill { height: 100% } resolves against a zero-height
   parent, so every bar on every saved run disappears with no error and nothing in the console.
   It is recoloured below and the dead range is narrowed accordingly — see the dead-rules block
   at the foot of this file.

   ⚠ .ae-risk-tag HAD NO RULE IN ANY SERVED STYLESHEET. history-rendered.js:298 writes it on
   every bar row; the only definition is assets/css/optimizer.css:937, a file LifeGuard does not
   serve and no page links. So the value beside every bar rendered unstyled and the column ran
   ragged. This adds it, with the flex-shrink and min-width the flex row needs and a twin inside
   the 480px block — styles.css:4157 narrows the OLD .ae-bar-tag to 80px and cannot reach a
   differently named class.

   THE UNCERTAINTY BAND ALREADY HAS AN ANSWER. The theme section ruled on exactly that figure —
   brand-100 on brand-200 with a brand point marker, applied identically to every row, because
   it ranks and carries no valence. The saved copy takes the same.

   ⚠ THE RAMPS ARE OVERRIDDEN AT MATCHING SPECIFICITY, NOT DELETED, and that is a deliberate
   choice. .med-score-badge.score-t1, .med-ci-range.ci-t1, .med-ci-point.pt-t1 and
   .score-bar-fill.fill-t1 are all (0,2,0); a bare .med-score-badge written here is (0,1,0) and
   loses, which is the whole trap this section's banner names. Cutting the rules out instead
   would work, but it would renumber every line after 3592 and this section cites about forty
   line numbers above and below — so the replacements are written in the incumbent shape and the
   originals are left where their history is.
   ============================================ */

/* ---- The run card is the panel ------------------------------------------------------- */
.run-card {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  margin-bottom: 14px;
}
/* No lift on hover. A saved run rests on the ground like every other panel; only a floating
   surface gets --petra-shadow-lift, and this is not one. */
.run-card:hover { box-shadow: var(--petra-shadow); border-color: var(--petra-brand-200); }
/* The newest run is the state the record is in, so it takes the .psum-section.is-editing
   treatment — a brand hairline and a 3px wash — rather than a second shadow colour. It pairs
   with the filled brand .run-badge.latest the chips block above already gives it. */
.run-card.latest {
  border-color: var(--petra-brand-300);
  box-shadow: 0 0 0 3px var(--petra-brand-050), var(--petra-shadow);
}

/* The header is white while the card is shut, and becomes the panel's header band the moment
   it opens. A card that is closed is all header, and a fully tinted closed card reads as a
   solid chip rather than a drawer. */
.run-header:hover { background: var(--petra-brand-050); }
.run-card.open .run-header {
  background: var(--petra-band);
  border-bottom: 1px solid var(--petra-line-soft);
}
/* (0,3,0) beats the plain :hover at (0,2,0), so an open card would otherwise have no hover
   feedback at all. */
.run-card.open .run-header:hover { background: var(--petra-brand-050); }
/* ⚠ .run-header is a plain <div> with an onclick and no tabindex and no role
   (history-rendered.js:404), so it cannot take focus and no focus rule here could ever fire.
   That is a MARKUP gap, recorded in the controls block above, not something a colour fixes. */
/* ink-4 is 2.63:1 and a chevron is a meaningful graphic with a 3:1 floor, so this is ink-3. */
.run-chevron { color: var(--petra-ink-3); }
.run-card.open .run-chevron { color: var(--petra-brand); }

.run-date { color: var(--petra-ink); }
.run-date-abs { color: var(--petra-ink-3); }
.run-summary-med { color: var(--petra-ink-2); }
.run-summary-more { color: var(--petra-ink-3); }
/* .run-badge, .run-pill, .sum-rank and .sum-score are settled in the chips block above,
   including the medal and score ramps, and are deliberately not repeated here. */

/* ---- Group heading: a heading and a rule, not a box ----------------------------------
   .tier-group was a bordered rounded box holding .med-item rows, inside the bordered rounded
   .run-card — the box in a box the law forbids, and the same one .res-group lost when the live
   results were redrawn. It becomes a labelled band exactly as .res-group did. */
.tier-group {
  background: none;
  border: none;
  border-radius: 0;
  overflow: visible;
  margin-bottom: 18px;
}
.tier-label-bar {
  align-items: baseline;
  gap: 12px;
  padding: 0 2px 7px;
  margin-bottom: 12px;
  background: none;
  border-bottom: 1px solid var(--petra-line);
  color: var(--petra-ink-3);
}
/* A neutral outlined pill = a label or a count. .res-pill verbatim. */
.tier-label-bar .tier-badge {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--petra-ink-2);
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 999px;
  padding: 3px 11px;
}
.tier-label-bar .tier-desc {
  font-size: 12.5px;
  color: var(--petra-ink-3);
  margin-left: auto;
  line-height: 1.35;
}
.tier-meds { background: none; }

/* ---- The medication row --------------------------------------------------------------- */
.med-item { border-bottom-color: var(--petra-hair); }
.med-item:hover { background: var(--petra-brand-050); }
/* A 3px amber left edge is the thin coloured border this file rejected on .res-card and on
   .patient-demo-notice, and it spent the hazard amber on a plain fact. The .tried-indicator
   chip beside the name already says "Taking now", and the chips block above made it neutral. */
.med-item.tried { border-left: none; }

.med-rank {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
}
/* Two classes deep, to match styles.css:3653-3655. A bare .med-rank would leave the amber,
   grey and orange medal standing on the top three of every saved run. */
.med-rank.top-1,
.med-rank.top-2,
.med-rank.top-3 {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
}
.med-name-col .med-name { font-size: 14px; font-weight: 600; color: var(--petra-ink); }
.med-name-col .med-formulation { color: var(--petra-ink-3); }

/* The score is a rank figure and carries no valence, so it is one neutral chip for every row.
   Two classes deep, to match styles.css:3688-3697 — that is the good-to-bad ramp this whole
   block exists to remove, and a bare .med-score-badge at (0,1,0) would not touch it. */
.med-score-badge {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink);
}
.med-score-badge.score-t1,
.med-score-badge.score-t2,
.med-score-badge.score-t3,
.med-score-badge.score-t4,
.med-score-badge.score-t5,
.med-score-badge.score-high,
.med-score-badge.score-mid,
.med-score-badge.score-low {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  color: var(--petra-ink);
}

/* ---- The uncertainty figure ----------------------------------------------------------
   The live screen's answer, applied here unchanged: a brand-100 band inside a brand-200
   hairline on a pale track, with a brand point marker. It ranks and carries no valence, and it
   is drawn identically for every row, so the position on the scale still does all the ordering.
   opacity: 0.35 goes with the ramp — it existed to soften five saturated fills, and at 0.35 a
   brand-100 band would be invisible. */
.med-ci-bar { background: #F7FAFD; border-color: var(--petra-line-soft); }
.med-ci-range {
  opacity: 1;
  background: var(--petra-brand-100);
  border: 1px solid var(--petra-brand-200);
}
.med-ci-range.ci-t1,
.med-ci-range.ci-t2,
.med-ci-range.ci-t3,
.med-ci-range.ci-t4,
.med-ci-range.ci-t5,
.med-ci-range.ci-high,
.med-ci-range.ci-mid,
.med-ci-range.ci-low { background: var(--petra-brand-100); }
/* The 5px width is NOT touched — renderCIBar() hardcodes a -2px half-offset against it. The
   black glow becomes a white ring, the way .res-pmk reads on a pale track and on a fill alike. */
.med-ci-point { box-shadow: 0 0 0 1.5px var(--petra-panel); }
.med-ci-point.pt-t1,
.med-ci-point.pt-t2,
.med-ci-point.pt-t3,
.med-ci-point.pt-t4,
.med-ci-point.pt-t5,
.med-ci-point.pt-high,
.med-ci-point.pt-mid,
.med-ci-point.pt-low { background: var(--petra-brand); }
.med-ci-text { color: var(--petra-ink-3); }

/* The no-CI fallback bar. Same reasoning, same colour — a length that ranks. */
.score-bar-bg { background: var(--petra-hair); }
.score-bar-fill.fill-t1,
.score-bar-fill.fill-t2,
.score-bar-fill.fill-t3,
.score-bar-fill.fill-t4,
.score-bar-fill.fill-t5,
.score-bar-fill.fill-high,
.score-bar-fill.fill-mid,
.score-bar-fill.fill-low { background: var(--petra-brand); }

/* ---- The expanded detail -------------------------------------------------------------- */
.med-expand-icon { color: var(--petra-ink-3); }
.med-item.expanded .med-expand-icon { color: var(--petra-brand); }
/* A fill inside a panel is a box. The rule and the indent already set the detail apart. */
.med-details { background: none; border-top: 1px solid var(--petra-hair); }
/* .res-sec-label exactly: 11px/700 uppercase 0.05em, ink-3 and not ink-4, because ink-4 at
   11px uppercase is 2.63:1. */
.med-detail-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--petra-ink-3);
}
.med-detail-value { color: var(--petra-ink-2); }

/* ---- The outcome bars ----------------------------------------------------------------
   ⚠ .ae-bar-track KEEPS ITS HEIGHT AND ITS overflow: hidden. Only the two colours move. */
.ae-bar-label { color: var(--petra-ink-3); }
.ae-bar-track { background: #F7FAFD; border-color: var(--petra-line-soft); }
/* The reserved pair, flat rather than gradient, so the stored copy is drawn in the same two
   values as the live screen — .res-fill #DC2626 and .res-fill-eff #059669 — instead of fading
   each of them into a lighter legacy bright (#EF4444, #10B981) the results screen dropped.
   The hexes themselves are untouchable: green names how well a medication works, red names
   side effects and blood pressure, every card carries both, and that is what stops any one
   medication being the green one. The -dim twins are not emitted since barRow lost its `dim`
   flag on 2026-08-30; they are set to the live screen's own quiet values (0.55, not 0.3) so the
   pair cannot drift apart again if a quiet row ever returns. */
.ae-bar-fill.ae-high { background: #DC2626; }
.ae-bar-fill.ae-efficacy { background: #059669; }
.ae-bar-fill.ae-high-dim { background: rgba(220, 38, 38, 0.55); }
.ae-bar-fill.ae-efficacy-dim { background: rgba(5, 150, 105, 0.55); }

/* NEW. The value beside every bar, which has never had a served rule. flex-shrink: 0 and a
   min-width are what stop the column running ragged — the row is flex, not grid, so nothing
   else lines these up. max-width caps the one long tag ("72% · severity 3.2 / 7") so it wraps
   inside its own column instead of pushing the track. */
.ae-risk-tag {
  flex-shrink: 0;
  min-width: 84px;
  max-width: 130px;
  text-align: right;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  color: var(--petra-ink-2);
  line-height: 1.3;
}
/* The 480px block at styles.css:4141 narrows .ae-bar-label and the OLD .ae-bar-tag. It cannot
   reach a class that did not exist when it was written, so the twin is added here. */
@media (max-width: 480px) {
  .ae-risk-tag { min-width: 62px; max-width: 92px; font-size: 10px; }
}

/* ---- The run footer -------------------------------------------------------------------- */
.run-footer { border-top-color: var(--petra-hair); }
.run-footer-item { color: var(--petra-ink-3); }
/* history-rendered.js:399 writes stroke="#EF4444" on the concern glyph as a markup attribute,
   and a CSS stroke declaration beats a presentation attribute. A concern is a warning, not a
   hard stop — the comment three lines above the render says a concern never removes a
   medication from the analysis — so it takes the hazard amber the .excl-pill beside it now
   wears, not the fail-closed red. The direct-child selector is what keeps it off the delete
   button's own icon in the ms-auto item. */
.run-footer-item > svg { stroke: #B45309; }
/* The importance the family gave to how well a medication works is a POINTS figure, so it is
   the same lapis the probability bars took: it ranks, it carries no valence, and it is drawn
   identically on every run. history-rendered.js:390 writes stroke="#3B82F6" on the glyph. */
.efficacy-mini svg { stroke: var(--petra-brand); }
.efficacy-mini-bar { background: var(--petra-hair); }
.efficacy-mini-fill { background: var(--petra-brand); }

/* ---- Run controls ---------------------------------------------------------------------
   .tried-btn is a three-state control and both of its coloured states were spent colours: amber
   for "taking now", which is a plain fact and not a warning, and #ECFDF5 green for "stopped",
   on the one set of pages that shows medication scores in the same scroll. It becomes the
   theme's own three shapes — outlined secondary at rest, filled brand for the state the record
   is in, quiet band fill for the state it has left. */
.tried-btn {
  background: var(--petra-panel);
  border-color: var(--petra-brand-200);
  color: var(--petra-brand);
  border-radius: 7px;
}
.tried-btn:hover {
  background: var(--petra-brand-050);
  border-color: var(--petra-brand-300);
  color: var(--petra-brand);
}
.tried-btn.active {
  background: var(--petra-brand);
  border-color: var(--petra-brand);
  color: #FFFFFF;
}
.tried-btn.active:hover { background: var(--petra-brand-700); border-color: var(--petra-brand-700); }
.tried-btn.done {
  background: var(--petra-band);
  border-color: var(--petra-line-soft);
  color: var(--petra-ink-2);
}
.tried-dates { color: var(--petra-ink-3); }
.med-tried-section { border-top-color: var(--petra-hair); }

.manage-runs-btn {
  background: var(--petra-panel);
  border-color: var(--petra-brand-200);
  color: var(--petra-brand);
  border-radius: 7px;
}
.manage-runs-btn:hover { background: var(--petra-brand-050); border-color: var(--petra-brand-300); color: var(--petra-brand); }
/* Managing runs is a MODE the app is in, not a destructive act — the destructive control is
   .select-delete-btn, and that keeps its red. Filled brand is this file's shape for a live
   state, so the toggle stops borrowing the hard-stop colour to mean "on". */
.manage-runs-btn.active {
  background: var(--petra-brand);
  border-color: var(--petra-brand);
  color: #FFFFFF;
}

.run-select-check { accent-color: var(--petra-brand); }
.run-card.selected { border-color: var(--petra-brand-300); background: var(--petra-brand-050); }
/* Written after .run-card.open .run-header above, at the same (0,3,0), so a selected card reads
   as selected whether it is open or shut. */
.run-card.selected .run-header { background: var(--petra-brand-050); }

.select-action-count { color: rgba(255, 255, 255, 0.82); }
/* #EF4444 under white text is 3.76:1 and fails AA at 13px/600. #DC2626 is 4.53:1, and it is the
   red the fail-closed panel already uses for a hard stop, which is what removing a run is. */
.select-delete-btn { background: #DC2626; }
.select-delete-btn:hover { background: #991B1B; }
.run-header-delete { color: var(--petra-ink-3); }
.run-header-delete:hover { color: #DC2626; background: #FEF2F2; }
.run-delete-btn { border-color: var(--petra-line); color: var(--petra-ink-3); }
.run-delete-btn:hover { color: #DC2626; border-color: #F0A5A5; background: #FEF2F2; }

/* ---- The patient dashboard history card -----------------------------------------------
   ⚠ .history-card WAS DEFINED TWICE at equal specificity — styles.css:1534 (radius 12, margin
   12, a legacy blue hover) and styles.css:4110 (radius 14, margin 16), with 4110 winning
   because it is later. Anyone rethemeing the first copy would have seen nothing change. It is
   settled HERE, once: this section is last, so this rule supersedes both, and neither of them
   needs to be cut out and renumber the file. patient_dashboard.html:475 writes the markup at
   runtime, so both of those blocks are live code and not dead rules. */
.history-card {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  padding: 14px 18px 16px;
  margin-bottom: 14px;
}
.history-card:hover { border-color: var(--petra-brand-200); box-shadow: var(--petra-shadow); }
.history-card .entry-header { border-bottom-color: var(--petra-hair); }
.history-card .entry-date { color: var(--petra-ink-3); }
.history-card .demographics { color: var(--petra-ink-2); }
/* Three classes deep, to match styles.css:1579-1601. The score there is #059669 — the exact
   .res-fill-eff efficacy hex — on a RANKED figure, on the one page that also carries the
   patient's own results further down the same scroll. Green names how well a medication works;
   a rank number is not that, and this is the last place in the app still saying otherwise. */
.history-card .top-meds .med-row { border-bottom: 1px solid var(--petra-hair); }
.history-card .top-meds .med-row:last-child { border-bottom: none; }
.history-card .top-meds .med-rank { color: var(--petra-ink-3); font-weight: 700; }
.history-card .top-meds .med-name { color: var(--petra-ink); }
.history-card .top-meds .med-score { color: var(--petra-ink); font-variant-numeric: tabular-nums; }
.history-card .weights-summary { color: var(--petra-ink-3); border-top-color: var(--petra-hair); }

/* ---- Long-form reading -----------------------------------------------------------------------
   The four reading pages have no ground, no panel and no measure. The participant information
   sheet is the longest document in the app and the one most likely to be read by a parent, and
   it runs at roughly 121 characters a line in .col-lg-9 inside .container.

   THE PANEL IS .petra-surface. This block is ONLY the typography and the sub-heading, which is
   the part the theme genuinely does not have. A second panel class was proposed and is thrown
   out here — that is how the app got five box weights.

   A SUB-HEADING IS A HEADING AND A RULE, never a border and a background. .petra-prose-h is the
   .pri-bp-block shape at styles.css:6450, this file's own worked example of the law. For a
   divider between whole parts of a document the existing .res-seclab already does the job.

   14.5px is the one size not lifted from an existing rule. The theme's in-panel heading is
   .res-run-lead at 13px, which would put a heading BELOW the 13.5px body on a ten-section legal
   document. 14.5px already exists in the file at .method-card-lead, so the scale gains no step.

   ⚠ THESE RULES ARE INERT UNTIL THE MARKUP OPTS IN. grep -rlo "petra-prose" over every html and
   js file under build/site returns 0, and so does petra-tbc. They are written now so the pass
   that adds the class to methodology, contact_us and pis-open has something correct to reach
   for, exactly as .no-history.petra-surface is written above. .method-card below is NOT inert —
   methodology.html:78 carries it today.

   ⚠ .link-primary IS STILL A TRAP HERE. The legacy :root wires --primary-link-color, the
   keyword `blue`, to .link-primary with !important, so a bootstrap link utility inside a prose
   column beats every rule below. The answer is not to use it, and that belongs in the markup.

   .method-notice is NOT touched here. It is assigned once, in the notices block above, where
   it becomes one neutral panel rather than a hazard — two blocks pointing at the same lines was
   how it nearly ended up recoloured twice or left grey.

   HONEST NOTE. 720px at 13.5px is about 107 characters, a caption measure rather than a reading
   measure. 620px would read better. 720 is used because it is the theme's own number and a
   second measure is a second system — worth a human deciding once.
   ============================================ */
.petra-prose p,
.petra-prose li {
  max-width: 720px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--petra-ink-2);
}
.petra-prose p { margin: 0 0 11px; }
.petra-prose p:last-child { margin-bottom: 0; }
/* Lists are not in the component's stated selector list, but a participant information sheet is
   mostly lists, and prose typography that stops at <p> is half a component. Same measure, same
   size, nothing new invented. */
.petra-prose ul,
.petra-prose ol { max-width: 720px; margin: 0 0 11px; padding-left: 20px; }
.petra-prose li { margin-bottom: 4px; }
.petra-prose strong { font-weight: 700; color: var(--petra-ink); }
.petra-prose a { color: var(--petra-brand); text-decoration: none; }
.petra-prose a:hover { color: var(--petra-brand-800); text-decoration: underline; }

.petra-prose-h {
  margin: 22px 0 8px;
  padding-top: 14px;
  border-top: 1px solid var(--petra-line-soft);
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--petra-ink);
}
.petra-prose-h:first-child { margin-top: 0; padding-top: 0; border-top: none; }

/* The still-to-fill-in marker, inline in running prose. It borrows the gap vocabulary the recap
   and the baseline questionnaire already share, but NOT the decorative inks .psum-cell-gap uses
   inside a band-flagged cell: #C08A3E is 3.02:1 on white and this is body text at 13.5px, where
   the floor is 4.5:1. #8A5200 is 6.6:1 on white and 5.77:1 on the gap amber, and it is the exact
   .psum-gap-chip ink, so the marker and the chip counting it are the same colour. The dashed
   rule is the only thing saying the blank is deliberate rather than broken, so it takes #C08A3E
   — 3.02:1, which clears the 3:1 floor for a non-text indicator, where the old #E3C68C was
   1.65:1 and effectively invisible. */
.petra-tbc {
  color: #8A5200;
  border-bottom: 1px dashed #C08A3E;
  padding-bottom: 1px;
}

/* The five methodology step cards were five bordered rounded boxes with a hover lift, on a page
   where nothing is clickable. They become ruled rows — a heading and a rule, not a border and a
   background — so the panel around them is the only box. The wrapper's own 760px measure is
   already reset in the notices block above; only the gap belongs here, because a 16px gap
   between rows would leave the rule floating between them. */
.method-grid { gap: 0; }
.method-card {
  background: none;
  border: none;
  border-radius: 0;
  border-top: 1px solid var(--petra-hair);
  padding: 16px 0 18px;
  gap: 18px;
  transition: none;
}
.method-card:first-child { border-top: none; padding-top: 2px; }
/* Nothing on that page is clickable, so the lift, the shadow and the blue edge said something
   untrue about it. (0,2,0), matching styles.css:761. */
.method-card:hover { border-top-color: var(--petra-hair); box-shadow: none; transform: none; }
.method-card-badge {
  background: var(--petra-brand-100);
  border: none;
  border-radius: 50%;
}
/* methodology.html writes stroke="#3B82F6" on each badge glyph as a markup attribute, which a
   CSS stroke declaration outranks. */
.method-card-badge svg { stroke: var(--petra-brand); }
/* 38px of #93C5FD is the legacy bright, and at any size it is 1.9:1. ink-3 at 30px/800 is
   4.57:1 on a panel and still 4.10:1 on the tinted ground, well over the 3:1 large-text floor. */
.method-card-num { font-size: 30px; color: var(--petra-ink-3); }
.method-card-title { font-size: 14.5px; letter-spacing: -0.005em; color: var(--petra-ink); }
.method-card-lead { font-size: 13.5px; font-weight: 600; color: var(--petra-ink-2); }
/* ink-2 and not ink-3, for the reason the page-header block records: ink-3 is certified 4.57:1
   against #FFFFFF, and this page goes onto the tinted ground, where it drops to 4.10:1. */
.method-card-detail { font-size: 13px; color: var(--petra-ink-2); }

/* ============================================
   THE BASELINE QUESTIONNAIRE joins the grammar (2026-08-30)
   ============================================
   THREE LEVELS OF BOX: .qb-sec (a bordered rounded panel) holds about forty .qb-f (bordered,
   rounded, FILLED cells) which each hold two to seven bordered rounded pills. That is the same
   defect the theme removed from the blood-pressure columns (.pri-bp-col, itself removed on
   2026-08-31), one level deeper again. The panel also wore a
   three-layer 0 14px 28px FLOATING shadow — the only lifted shadow in the app — on a panel that
   is resting on the ground. The pills were flattened in the segmented-control block above; this
   block is the other two levels.

   WHAT MUST NOT CHANGE, and this needs saying plainly because it looks like a violation. The
   three STATE colours survive. Red means nothing there and somebody has to answer it, and it
   cannot collide with the results red, because there is no medication anywhere on this page for
   a colour to say anything about. GREEN means answered or validated, and it cannot carry a
   valence for the same reason — there is no comparison here. The app already carries
   green-as-done at styles.css:5079, where .pri-bank.done .pri-bank-num turns #059669 when the
   points bank empties, and the theme deliberately left that rule standing. The Validate button
   stays green because green is the state it moves the field into. --qb-red and --qb-grn and
   their grounds and borders are not touched, at all.

   ONE HEX CHANGES, AND FOR CONTRAST ONLY. --qb-amb #A6600A on #FDF2E0 is 4.41:1, under AA on a
   10.5px bold label. It becomes #8A5200, which is 5.77:1 on that ground and 6.6:1 on white.

   ⚠ AND THE TWO AMBERS ARE STILL NOT THE SAME THING. #8A5200 happens to be the .psum-gap-chip
   ink as well, and it would be easy to read that as the two screens finally sharing one state.
   They do not. .psum-gap-chip on the recap means STILL TO FILL IN — the cell is empty.
   --qb-amb here means A VALUE ARRIVED FROM THE SAVED RECORD AND NOBODY HAS LOOKED AT IT — the
   field HAS a value and needs checking. This page's own still-to-fill-in state is RED. So a
   clinician reading the recap sees amber on empty fields, opens the questionnaire on the same
   record, and sees those same fields in RED while a pixel-identical amber marks a different set
   of fields entirely. The two share an ink and not a meaning. Making the recap use red for
   empty, the way this page does, is the real fix and it is its own piece of work.

   THE NEUTRAL RAMP IS REMAPPED, not duplicated. --qb-ink-3 #77828F is 3.91:1 and is used for
   live text. Pointing five
   neutral tokens at the theme ramp fixes about thirty declarations in one edit and lifts every
   one of them over the AA floor. The remap is a SECOND :root, appended rather than edited in
   place at styles.css:5381: a later :root wins at equal specificity, the three state triples and
   --qb-mono keep their original block and their comment, and no line number in this file moves.

   ⚠ DISABLED IS NEVER DIMMED. button.qb-count:disabled and .qb-count.is-zero used opacity 0.34.
   A count of zero is information, not a dimmed control, and --petra-ink-5 exists precisely so
   state never has to be expressed with opacity.

   ⚠ RECOLOUR IN PLACE, RENAME NOTHING. The eight state classes are written by the inline
   script, and profile-input and "qb-f qb-derived" are matched as
   literal strings by render-contract.test.js and mutate.js.

   ⚠ THE DASHED RED EDGE ON AN EMPTY CELL GOES, AND THE DISTINCTION MOVES ONTO THE CONTROL.
   .qb-f.is-empty and .qb-f.is-error both take the red ground, and the dashed border was the only
   thing separating them. It still is separated: an out-of-range value has a SOLID --qb-red
   border and red text on the input itself (styles.css:5660), an empty one keeps a neutral border
   and shows its red placeholder (styles.css:5655). Nothing is lost that the field does not say.

   ⚠ questionnaire.css IS SERVED AND LOADS FIRST, on all thirty pages, and it was never audited.
   It is 48 lines and holds five rules. Four cannot reach this page: .question_container and
   .question_container label and .question_container input never fire, because that class appears
   in no HTML file — questionnaires.js only ever adds .incomplete to the closest
   .question_container, so .incomplete { border: 2px solid var(--warning-color) !important } has
   never once been applied either; and `legend { font-size: 16px }` finds no <legend> anywhere.
   The fifth DOES reach it: `@media (max-width: 768px) { label { margin-left: 0.5em; max-width:
   70vw } }`. The margin half is already neutralised, because .qb-f .qb-seg label and
   .qb-f .qb-scale .cgis-option both declare margin: 0 at three classes deep. The max-width half
   is the one declaration nothing here competes for, and it would bind on a single-option group
   in a full-width cell at tablet width. Pinned back below rather than left to be discovered.
   ============================================ */

/* The remap. Only the five neutrals and the amber ink — the three state triples, their grounds,
   their borders and --qb-mono are all left where they are. */
:root {
  --qb-ink:     #0F2739;   /* was #121821 — the theme's primary ink */
  --qb-ink-2:   #33465A;   /* was #454F5E */
  --qb-ink-3:   #63788C;   /* was #77828F, 3.91:1 and used for live text; this is 4.57:1 */
  --qb-rule:    #D4DFEA;   /* was #CFD7E0 — the panel border of record */
  --qb-rule-sf: #EBF0F6;   /* was #E1E7ED — the Level 2 hairline of record */
  --qb-amb:     #8A5200;   /* was #A6600A, 4.41:1 on #FDF2E0; this is 5.77:1. See the ⚠ above */
}

/* ---- The section is a panel ------------------------------------------------------------
   The 0 14px 28px three-layer shadow was the only lifted shadow in the app, on a surface that
   rests on the ground. --petra-shadow is what a resting panel wears. */
.qb-sec {
  background: var(--petra-panel);
  border: 1px solid var(--petra-line);
  border-radius: 14px;
  box-shadow: var(--petra-shadow);
  margin-bottom: 14px;
}
/* The header band, at the theme's own asymmetric padding — 18px on the title side so the title
   sits on the same vertical as the first cell gutter below it. */
.qb-sec-head {
  gap: 9px;
  padding: 11px 14px 11px 18px;
  background: var(--petra-band);
  border-bottom: 1px solid var(--petra-line-soft);
}
/* --qb-mono comes off the section name. It stays on typed and derived NUMBERS, where tabular
   figures line decimal points up a column and the face separates 0 from O — on a heading it is
   only a voice no other page in the app speaks. */
.qb-sec-name {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-transform: none;
  color: var(--petra-ink);
}
/* The .petra-head-meta slot values, so the chips sit where every other panel's meta sits. */
.qb-sec-chips { gap: 10px; }
/* A 2px rectangle in a state colour was a fourth chip shape. The three shapes this file has
   already mean different things, and a count in a state colour is a pill. The state colours
   themselves do not move. */
.qb-chip {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: 0.02em;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
}
.qb-chip-fill { border-color: var(--qb-red-bd); }
.qb-chip-val  { border-color: var(--qb-amb-bd); }
.qb-chip-done { border-color: var(--qb-grn-bd); }

/* ---- The grid is rows in a panel, not forty cells on a tray ---------------------------
   gap: 0 with a hairline on the top and left of every cell, and the whole grid pulled out to the
   panel edge. NOT nth-child: .qb-sp2 / .qb-sp3 / .qb-sp4 span columns and three of the six grids
   are generated by the inline script, so no positional selector can be trusted to find a row
   start. The extra 1px on the pull is what hides the first row's top hairline and the first
   column's left hairline — the sides are clipped by the panel's own overflow, and the top lands
   exactly on the header band's bottom rule rather than doubling it. */
.qb-grid { gap: 0; margin: -15px -16px 0; }
.qb-sec-body > .qb-grid:last-child { margin-bottom: -16px; }
.qb-sec-body > .qb-grid:not(:last-child) {
  margin-bottom: 14px;
  border-bottom: 1px solid var(--petra-hair);
}

/* One field. The border becomes two hairlines and the fill stays, because the fill IS the state
   and the state is the point of the screen. .psum-cell's rhythm, so a value typed here and the
   same value read back on the recap sit at the same gutter. */
.qb-f {
  border: none;
  border-top: 1px solid var(--petra-hair);
  border-left: 1px solid var(--petra-hair);
  border-radius: 0;
  background: var(--petra-panel);
  padding: 13px 18px;
}
/* ⚠ ALL FOUR STYLES, IN ONE SHORTHAND — top solid, right none, bottom none, left solid.
   styles.css:5548 and :5552 set `border-style: dashed` on these two states, and that shorthand
   writes all four longhands at (0,2,0), which beats the (0,1,0) `border: none` on .qb-f whatever
   the file order is. Declaring only border-top-style and border-left-style here leaves the RIGHT
   and BOTTOM at dashed, and their width falls back to `border: none`'s `medium` — 3px. The first
   screenshot of this block had a 3px dashed edge down the right of every derived cell for exactly
   that reason. */
.qb-f.is-empty {
  border-color: var(--petra-hair);
  border-style: solid none none solid;
  background: var(--qb-red-bg);
}
.qb-f.is-check { border-color: var(--petra-hair); background: var(--qb-amb-bg); }
.qb-f.is-done  { border-color: var(--petra-hair); background: var(--petra-panel); }
.qb-f.is-error { border-color: var(--petra-hair); background: var(--qb-red-bg); }
/* transparent would show whatever is behind the panel, and the panel now sits on a tinted
   ground rather than a white page. */
.qb-f.qb-derived {
  border-color: var(--petra-hair);
  border-style: solid none none solid;
  background: var(--petra-panel);
}
/* Outset to inset. With gap: 0 an outset ring is drawn over the two neighbours, so the cell that
   was jumped to appears to highlight the wrong one. */
.qb-f.is-hunted { box-shadow: inset 0 0 0 2px var(--petra-brand); }
.qb-f.field-missing { box-shadow: inset 0 0 0 2px var(--qb-red); }

/* The field label is .psum-label — same size, same tracking, same ink — because the label above
   a typed value and the label above the same value on the recap are the same label. The state
   rules at styles.css:5571-5573 are (0,2,0) and still colour the name and the unit, so a field
   that needs the clinician is still loud. */
.qb-f-top {
  font-family: inherit;
  letter-spacing: 0.05em;
  color: var(--petra-ink-3);
}
/* radius 7px is the only control radius the theme sets. The green is the state the button moves
   the field INTO and is not touched. */
.qb-ok { border-radius: 7px; }

/* ---- The sticky count bar --------------------------------------------------------------- */
.qb-dock { border-bottom-color: var(--petra-line); }
.qb-dock-h1 {
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  text-transform: none;
  color: var(--petra-ink);
}
.qb-dock-sub { color: var(--petra-ink-3); }
/* opacity 0.34 was doing the work of a colour, on a control whose whole content is a NUMBER —
   and a count of zero is information, not a dimmed button. (0,2,1) and (0,2,0), matching
   styles.css:5470 exactly, or the state triples at (0,1,0) would keep painting it. */
button.qb-count:disabled,
.qb-count.is-zero {
  opacity: 1;
  background: var(--petra-band);
  border-color: var(--petra-line-soft);
  color: var(--petra-ink-3);
  cursor: default;
}
.qb-count.is-zero .qb-count-n { color: var(--petra-ink-3); }

/* ---- Blood pressure and the severity scale ---------------------------------------------- */
.qb-bp-cap { font-family: inherit; letter-spacing: 0.05em; color: var(--petra-ink-3); }
.qb-bp-sep { font-family: inherit; color: var(--petra-ink-3); }
/* ⚠ A severity point was being chosen from a truncated word. .cgis-desc clipped its description
   to one line with an ellipsis inside a seventh of a grid cell, so the reader picked a number
   off "Borderline…" and "Markedly…". Three classes deep, to match styles.css:5747. */
.qb-f .qb-scale .cgis-desc {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}
/* The digit stays monospace — it is a number on a numeric scale, which is the one thing
   --qb-mono is kept for. */

/* ---- questionnaire.css, pinned back ------------------------------------------------------
   See the ⚠ above. questionnaire.css:42-47 sets a bare `label { max-width: 70vw }` under 768px
   and nothing in this section declares max-width, so it is the one thing that lands. */
@media (max-width: 768px) {
  .qb-f .qb-seg label,
  .qb-f .qb-scale .cgis-option { margin-left: 0; max-width: none; }
}

/* ---- A surface that floats -----------------------------------------------------------------
   --petra-shadow is two very tight layers with no spread, correct for a panel RESTING on the
   ground and too tight for anything above it. That was the one honest gap in the theme, and this
   is the token rather than an inline value per surface, so the next floating thing inherits it.
   It is declared in a SECOND :root for the same reason the questionnaire remap above is —
   appending wins at equal specificity and moves no line number in a file whose comments cite
   about a hundred of them.

   SweetAlert2 is the app's only floating surface and it was completely unthemed —
   grep -n "swal" styles.css returned 0. It fires on registration, on both password flows, on the
   two CTU remove confirmations, on hide and restore, on a failed questionnaire save, and on the
   two record pages: eleven Swal.fire call sites across four files.

   IT IS THEMED THROUGH ITS OWN CLASS NAMES AND ITS OWN CUSTOM PROPERTIES, and the vendored file
   is never edited. Two facts make that safe. SweetAlert2 11.26.25 writes its rules as
   `div:where(.swal2-popup)` — :where contributes NO specificity, so that is (0,0,1) and a plain
   class rule here beats it however the stylesheets are ordered. And its defaults live on a
   :root in a <style> the script appends to <head> at runtime, which is LATER than this file, so
   a :root of ours would lose — but a custom property declared on .swal2-popup itself beats an
   inherited one regardless of order, because it is set on the element that uses it. Everything
   below is therefore declared on the popup or on the container, never on :root.
   .petra-dialog and friends are grouped in for a dialog the app builds itself, and are inert
   until some Swal.fire passes customClass — grep for customClass over every html and js file
   returns 0 today.

   ⚠ THE CONFIRM COLOUR IS PASSED FROM JAVASCRIPT AND NO STYLESHEET CAN REACH IT. SweetAlert2
   calls e.style.setProperty('--swal2-confirm-button-background-color', …) on the button, and for
   iconColor it sets e.style.color and e.style.borderColor directly — runtime inline styles,
   which beat any rule that is not !important. There are TWELVE literals at eleven call sites:
   #EF4444 on the four remove-and-hide confirms (history-rendered.js:522 and :546, patients.js:531
   and :559), #3B82F6 on the patient dashboard error report (patient_dashboard.html:324), and
   #1a847e — a teal that exists in no token — six times in questionnaires.js (:371, :373, :407,
   :409, :439, :443, three of them iconColor) plus an off-palette #858585 denyButtonColor at
   :441. questionnaires.js is loaded on 28 of the 29 pages, so those are the app's most-fired
   dialogs. The defaults below apply only where a call site passes no colour; the twelve literals
   have to be removed IN THE JAVASCRIPT, in the phase that owns each file. Nothing here fights
   them, and nothing here should be made !important to try.

   ⚠ AND TWO DIALOGS LIE. deleteRunsServerSide sets entry.hidden and posts the blob back, on
   purpose, because the risk assessment requires that the record cannot be erased and that
   Restore is real. The dialog says "permanently remove". Telling a family the run is gone
   forever is the one thing that stops them pressing Restore. That is wording, not CSS.
   ============================================ */
:root {
  --petra-shadow-lift: 0 10px 30px rgba(15, 39, 57, 0.16), 0 2px 6px rgba(15, 39, 57, 0.08);
}

.petra-dialog,
.swal2-popup {
  --swal2-background: var(--petra-panel);
  --swal2-color: var(--petra-ink-2);
  --swal2-border: 1px solid var(--petra-line);
  --swal2-border-radius: 14px;
  --swal2-padding: 0 0 13px;
  --swal2-html-container-padding: 13px 18px 0;
  --swal2-actions-margin: 13px 0 0;
  --swal2-actions-padding: 13px 18px 0;
  --swal2-actions-justify-content: flex-end;
  --swal2-confirm-button-background-color: var(--petra-brand);
  --swal2-confirm-button-border-radius: 8px;
  --swal2-cancel-button-background-color: var(--petra-panel);
  --swal2-cancel-button-color: var(--petra-brand);
  --swal2-cancel-button-border-radius: 7px;
  --swal2-deny-button-background-color: #DC2626;
  --swal2-deny-button-border-radius: 8px;
  --swal2-input-background: #FFFFFF;
  --swal2-input-border: 1px solid var(--petra-line);
  --swal2-input-border-radius: 7px;
  --swal2-input-box-shadow: none;
  --swal2-input-hover-box-shadow: none;
  --swal2-input-focus-border: 1px solid var(--petra-brand-300);
  --swal2-input-focus-box-shadow: none;
  --swal2-outline: 0 0 0 2px var(--petra-brand);
  box-shadow: var(--petra-shadow-lift);
  color: var(--petra-ink-2);
}
/* The backdrop is drawn from the theme ink, the way --petra-shadow already is, and never black. */
.swal2-container { --swal2-backdrop: rgba(15, 39, 57, 0.45); }

/* Title type only on the vendored dialog, and the BAND only on .petra-dialog-title. The reason
   is the law rather than laziness: SweetAlert2 puts the status icon inside .swal2-header above
   the title, so tinting the header would wrap a 5em circle in a tall second band, and one band
   per panel is what decides the data table and this footer alike. A dialog the app builds itself
   has an icon at 16px in the band, like every other panel in the grammar. */
.swal2-popup .swal2-title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--petra-ink);
}
.swal2-popup .swal2-html-container {
  font-size: 13px;
  line-height: 1.5;
  color: var(--petra-ink-2);
}
/* THE FIELD. One dialog in the app carries one — the Report an error box on
   patient_dashboard — and the themed popup covered the shell, the title, the body and the
   actions and stopped at the edge of the textarea, which kept the vendor #d9d9d9
   border and 0.1875em radius inside a panel whose fields are white on 1px var(--petra-line)
   at radius 7px. The anatomy is .petra-input, and the seven variables above are how it is
   applied: the vendor draws every input from them, so nothing needs a rule to fight.

   ⚠ THE CLASS ITSELF IS NOT APPLIED, and that is the caution. .petra-input carries
   font-weight 600 and a 32px min-height, both right for a one-line value and both wrong for
   a five-row message box, which wants normal weight and takes its height from `rows`. So the
   type is restated here instead and no height is set at all.

   ⚠ AND THE RING HAS TO BE WRITTEN OUT. The vendor sets outline: none on :focus and replaces
   it with a box-shadow halo, and no custom property turns that off — so this is the one ring,
   written at (0,2,0) against the vendor rule at (0,0,2), offset 2px because the field is
   free-standing. The 18px side margins are what put the field on the same left edge as the
   message above it — the vendor default is 2em, which is a third gutter inside one dialog,
   and the width is stated so the popup-widening observer in the vendored file can never see
   the field as wider than the popup and grow the dialog to fit it.

   THE INPUT LABEL IS NOT A .petra-field-label. That component is a 10.5px uppercase word
   above a value; this slot holds a two-line instruction including the please-do-not-type-
   personal-details sentence the risk register requires, and uppercase tracking on a sentence
   is unreadable. It takes .petra-field-help, which is the shape for exactly that, plus the
   left alignment a centred vendor default does not give it. */
.swal2-popup .swal2-input,
.swal2-popup .swal2-textarea {
  display: block;
  width: calc(100% - 36px);
  margin: 0 18px 4px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--petra-ink);
}
.swal2-popup .swal2-input:focus,
.swal2-popup .swal2-textarea:focus {
  outline: 2px solid var(--petra-brand);
  outline-offset: 2px;
}
.swal2-popup .swal2-input-label {
  display: block;
  margin: 13px 18px 6px;
  font-size: 12px;
  font-weight: 400;
  color: var(--petra-ink-3);
  line-height: 1.55;
  text-align: left;
}
/* THE DROPDOWN, on the one dialog that has one (Change clinician, team dashboard, 26 September).
   The vendor draws its select from neither the border variable nor the field type, so it kept the
   browser border and 1.125em text. It takes the anatomy of the field above. */
.swal2-popup .swal2-select {
  display: block;
  width: calc(100% - 36px);
  min-width: 0;
  margin: 14px 18px 4px;
  padding: 8px 10px;
  border: 1px solid var(--petra-line);
  border-radius: 7px;
  font-family: inherit;
  font-size: 13px;
  color: var(--petra-ink);
}
.swal2-popup .swal2-select:focus {
  outline: 2px solid var(--petra-brand);
  outline-offset: 2px;
}
.petra-dialog-title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 11px 14px 11px 18px;
  background: var(--petra-band);
  border-bottom: 1px solid var(--petra-line-soft);
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.005em;
  color: var(--petra-ink);
}
.petra-dialog-title > svg { width: 16px; height: 16px; color: var(--petra-brand); stroke: var(--petra-brand); }
.petra-dialog-body { padding: 13px 18px; font-size: 13px; line-height: 1.5; color: var(--petra-ink-2); }
/* .petra-surface-foot, not a tinted bar — a tinted footer under a tinted band is two bands. */
.petra-dialog-actions,
.swal2-popup .swal2-actions {
  border-top: 1px solid var(--petra-line-soft);
  border-radius: 0;
  background: none;
  gap: 8px;
}
/* The secondary of record is white with a brand hairline, and the vendored cancel button has no
   border variable of its own. */
.swal2-popup .swal2-cancel {
  border: 1px solid var(--petra-brand-200);
  font-weight: 600;
}
.swal2-popup .swal2-confirm,
.swal2-popup .swal2-cancel,
.swal2-popup .swal2-deny { font-family: inherit; font-size: 13px; }

/* THE ROW MENU of the team dashboard (preview of 25 September). One dialog, three plain buttons in
   its body, each an icon, what it does and one line on what follows, where there was a radio list
   and Continue. The first customClass in the app (petra-menu-popup), so the title and body can sit
   on the left edge the list starts from; every other dialog keeps the centred vendor layout.
   Archive comes last, set apart, in the red of the confirmation it opens. The width is the
   vendor variable, so its max-width 100% still fits the box to a phone. */
.petra-menu-popup { --swal2-width: 440px; }
.petra-menu-popup .swal2-title {
  padding: 18px 18px 0;
  text-align: left;
}
.petra-menu-popup .swal2-html-container {
  margin: 0;
  padding: 2px 18px 0;
  text-align: left;
}
.petra-menu-sub {
  margin: 0 0 12px;
  font-size: 12.5px;
  color: var(--petra-ink-3);
}
.petra-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.petra-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 0;
  padding: 11px 12px;
  border: 1px solid var(--petra-line);
  border-radius: 10px;
  background: var(--petra-panel);
  font: inherit;
  text-align: left;
  color: var(--petra-ink-2);
  cursor: pointer;
  transition: border-color 0.12s ease, background-color 0.12s ease;
}
.petra-menu-item:hover {
  border-color: var(--petra-brand-300);
  background: var(--petra-brand-050);
}
.petra-menu-item:focus-visible {
  outline: 2px solid var(--petra-brand);
  outline-offset: 2px;
}
.petra-menu-icon {
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--petra-brand-100);
  color: var(--petra-brand);
}
.petra-menu-icon svg,
.petra-menu-chevron svg { width: 17px; height: 17px; }
.petra-menu-text {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.petra-menu-label {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.35;
  color: var(--petra-ink);
}
.petra-menu-desc {
  font-size: 12px;
  line-height: 1.45;
  color: var(--petra-ink-3);
}
.petra-menu-chevron {
  flex: 0 0 auto;
  display: inline-flex;
  color: var(--petra-ink-4);
}
.petra-menu-item:hover .petra-menu-chevron { color: var(--petra-brand); }
.petra-menu-item--withdraw { margin-top: 6px; }
.petra-menu-item--withdraw .petra-menu-icon { background: #FEF2F2; color: #DC2626; }
.petra-menu-item--withdraw:hover { border-color: #FCA5A5; background: #FFF7F7; }
.petra-menu-item--withdraw:hover .petra-menu-chevron { color: #DC2626; }

/* The CTU selection bar is fixed to the BOTTOM of the viewport, so it is the one floating
   surface whose shadow points up. It takes the lift token's geometry and its theme-ink tint with
   the y offset mirrored, and says so rather than pretending one token can face both ways — the
   value it replaces was an untokenised black 0 -4px 16px rgba(0,0,0,0.15). The ground moves from
   the slate #1F2937 to --petra-brand-800, the same darkest brand the page footer already uses. */
.select-action-bar {
  background: var(--petra-brand-800);
  box-shadow: 0 -10px 30px rgba(15, 39, 57, 0.16), 0 -2px 6px rgba(15, 39, 57, 0.08);
}

/* ---- Dead rules, marked and not deleted ------------------------------------------------------
   The file already has a convention for this — .progress-dots at styles.css:1659 carries a ⚠
   comment saying it is dead as of 2026-08-30 and why, kept and marked rather than deleted.
   Following it here is cheaper than re-deriving the greps, and the cost of NOT doing it is
   specific: the next agent spends effort rethemeing #3B82F6 and #30384d in rules that render on
   zero pages, and may build a page-header component on .page-header believing it is live.

   THE MARKS ARE COLLECTED HERE RATHER THAN WRITTEN INLINE, on purpose. This section and the one
   above it cite about a hundred line numbers, in comments that are the reason this work was
   possible at all. Inserting a comment line at 3108 moves every one of the citations below it by
   one, and a stale line number is worse than no line number. Nothing above line 6656 is touched.

   HOW THIS WAS CHECKED, so nobody has to guess at the method:
     grep -rlE --include=*.html --include=*.js "(^|[^-a-zA-Z])NAME([^-a-zA-Z]|$)" .
   run from build/site. The word boundaries matter — a bare `grep navbar-logo` matches
   app-navbar-logo, which IS live on twenty-one pages, and would have marked a live rule dead.

   ⚠ SIX ENTRIES FROM THE FIRST DRAFT OF THIS LIST ARE LIVE, and each of them is named below with
   what actually renders it. Deleting any of the six ships a silent visual break with nothing in
   the console.

   ==== VERIFIED DEAD — no HTML file and no JS file writes these class names ====

   256-259    .index-card
   318-331    .navbar-main, .navbar-main > .container, .navbar-logo — the pre-theme navbar. The
              live one is .app-navbar at 373.
   334-353    footer .footer-row / .footer-content / .footer-content ul / .footer-copyright — the
              pre-theme footer. The live one is .landing-footer-blue at 589.
   400-418    .app-navbar-mark, .app-navbar-mark svg, .app-navbar-wordmark — written as the fix
              for the white-box navbar logo and never wired into a single page.
              ⚠ NOT 394-399 and NOT 420-424: .app-navbar-brand and .app-navbar-logo are on
              twenty-one pages. The dead range starts at 400 and stops at 418.
   578-580    .landing-bg — index.html was its only consumer and it now paints the shared
              ground through .petra-canvas on its <main> instead. background: #FFFFFF, which
              is the one thing a Level 0 ground must not be.
   667-702    .landing-cards, .landing-info-card and its hover, .landing-info-icon,
              .landing-notice — all hold the legacy bright blue.
   705-712    .method-eyebrow-top — the word "Methodology" above the page title, in the legacy
              bright #3B82F6. Deleted from the markup in the same pass that gave that page the
              shared header, and it repeated the navbar link that reaches the page.
   715-740    .method-flow, .method-flow-item, .method-flow-arrow, and the 560px query at
              851-853 that hides the arrow. DEAD AT LAST — this was in the LIVE corrections
              below on the strength of methodology.html:64-73, and that ribbon is now gone. It
              was a row of #F1F5F9 pills above a panel, the shape this file rejects.
   875-901    .landing-navbar, -inner, -logo, -partner, and 950-951 inside the 480px block at 949.
   903-908    .landing-footer — the GREY footer shell only.
              ⚠ NOT 910-947. .landing-footer-logo, -text, -links, -links a, -links a:hover and
              -copy are LIVE: .landing-footer-blue at 589-633 only re-declares some of what they
              set, and .landing-footer-logo's width: auto at 912 is declared nowhere else.
   1026-1045  .page-header, .page-header h1, .page-header h1 svg, .page-header p — never used in
              any markup, and now grouped into the page-header component in this section, so it
              becomes live for the first time only where a page opts in.
   1730-1755  .form-section, .form-section-title, .form-section.field-missing and its title — the
              baseline questionnaire's pre-.qb-f validation highlight.
   1793-1850  .age-input-wrapper, .age-slider-label, .age-value, .age-slider and both vendor
              thumb rules — the age control is a number input now.
   2447-2450  .tier-strip > .result-item .ae-bar-label.
   2984-3017  .ae-column-headers, .ae-col-weight, .ae-col-criterion, .ae-col-bars,
              .ae-section-label-row.
   3067-3073  .efficacy-level.
   3076-3078  .ae-profile-section; 3088-3097 .ae-weight-circle and .ae-weight-circle-svg.
   3109-3121  .ae-dual-bars, .ae-bar-line — the two-bar-per-row layout, gone since the saved run
              draws one bar and a value.
              ⚠ THE DEAD RANGE STOPS AT 3121 AND RESUMES AT 3131. See the LIVE list below.
   3131-3147  .ae-bar-tag, .ae-bar-tag strong, .ae-bar-tag-plb — replaced by .ae-risk-tag, which
              this section defines for the first time.
   3158       .ae-bar-fill.ae-placebo.
   3161-3182  .collapsible-details, .details-toggle, its hover and its icon.
   3592-3596  .tier-label-bar.t1 through .t5 .tier-badge — the badge ramp. INERT rather than
              overridden: history-rendered.js:257 emits the bar with no tN class at all, so these
              five never match. That is a loaded gun, not a comfort — the four ramps that DO
              match are overridden at (0,2,0) in the saved-runs block above.
   4141-4169  the 480px block, EXCEPT 4142-4144 .step-title (activity1) and 4156 .ae-bar-label
              (every saved run). Dead inside it: .weight-slider-container, .result-top-row,
              .result-score, .score-bar-wrapper, .ae-bar-tag, .ae-weight-circle,
              .ae-weight-circle-svg, .efficacy-level, .summary-bar-row, .summary-med-name,
              .summary-score-text, .summary-bar-track.
   4269-4293  .checkbox-grid, .checkbox-item, its hover and its input — the comorbidity,
              medication and family-history grids are .qb-f cells now.
   4461-4506  .petra-hero, -icon, -title, -desc, -cta, -note — the patient dashboard launch
              shell: a blue-to-violet gradient box with a #3B82F6 disc and a 999px pill
              button. The card is .petra-surface + .petra-surface-head + .petra-launch-cta now.
              ⚠ NOT 4507-4566. .petra-hero-timeline and its four parts and its 480px block are
              LIVE on BOTH dashboards, and they are recoloured in the gaps section below.
   4567-4660  the whole PETRA PANEL section, banner and 640px media query included:
              .petra-panel, -content, -title, -desc, -cta-col, -cta-icon, -cta, -cta-sub and
              .petra-panel .petra-hero-timeline*. This entry supersedes the 4627-4630 line the
              first draft carried for -cta-sub alone. grep -rnE "(^|[^-a-zA-Z])petra-panel" over
              every html and js file returns three hits, all inside one comment in
              dashboard.html warning the name off. ⚠ THE NAME STAYS VACATED: this section is
              last in the file, so a generic .petra-panel rule written down here would win over
              that card at equal specificity — which is exactly what it used to do.
   5662       .qb-f input.age-slider.
   5679-5699  .qb-propose, .qb-propose-v, .qb-propose-btn and its hover — the z-score proposal,
              removed when zBMI became derived rather than typed on 2026-08-30.

   ==== SHADOWED, NOT UNRENDERED — the markup exists, every declaration is beaten ====

   1256-1291  .btn-optimize, :hover, .btn-view, :hover
   4310-4340  .btn-edit, :hover, .btn-remove, :hover
              patients.js:229-233 and :291 write all four, but ALWAYS inside
              <div class="row-actions">, and .row-actions button at (0,1,1) plus
              .row-actions .btn-* at (0,2,0) re-declare every property these four set — the
              geometry, the fill, the border and the text colour. So the bright blue at 4312,
              the slate #30384d at 1276 and the reserved green at 1257 are on screen NOWHERE.
              Retheme .row-actions .btn-* at styles.css:4979-5012 instead; a change here has no
              effect and no error to look at.

   ==== LIVE — corrections to the first draft of this list ====

   849        .method-card-badge inside the 480px block — the 46px disc is LIVE and wanted, but
              its border-radius: 13px is a leftover from the rounded tile and is beaten by the
              border-radius: 50% the long-form block sets at (0,1,0) later in the file. One
              stale declaration inside a live rule, so it is marked rather than cut.
   3122-3129  .ae-bar-track — LIVE, and the most dangerous entry in the whole list.
              history-rendered.js:296 emits it on EVERY bar of every saved run and it is the only
              rule giving the bar its 10px height and its overflow clip. Delete it and
              .ae-bar-fill { height: 100% } resolves against a zero-height parent, so every bar
              on every saved run vanishes silently. It is recoloured in the saved-runs block.
   4110-4118  .history-card — LIVE. patient_dashboard.html:475 writes it at runtime. It was also
              the LATER of two definitions at equal specificity (the other is styles.css:1534),
              so it was the winning one, and anyone editing 1534 saw nothing change. Both are
              superseded once, at the foot of the saved-runs block above.
   4121-4127  .weights-summary — LIVE, patient_dashboard.html:481. Every property it sets is
              re-declared by .history-card .weights-summary at 1603 (0,2,0), so it is shadowed on
              that page — but it is not a dead rule and it is not safe to cut.
   4219-4228  .bmi-display — LIVE. q_baseline_1.html:249 carries class="bmi-display qb-der".
   4129-4138  .no-history — LIVE on four pages and settled in the empty-state block above.

   ==== NOT MARKED, DELIBERATELY ====

   The legacy :root at styles.css:14-35 stays exactly as it is, with no recolour and no
   tombstone beyond the warning already written above it. --secondary-bg-color is the keyword
   green and --custom-bg-color is the keyword red; giving either of them a real value would put
   the two colours that name a KIND of outcome back into general circulation. The right action
   is that no converted page references them, which is a markup rule and not a stylesheet one.
   ============================================ */

/* ============================================
   THE CONVERSION GAPS — the rules the markup pass could not write (2026-08-30)
   ============================================
   Eight passes converted the markup of every page onto the shared component set. None of them
   could edit this file, so each shipped markup written as though the rule it needed already
   existed, and reported the rule instead. This section is that list, settled once, in one
   place. Nothing here is a new idea: every value is a token, or is lifted from a component
   above and named as such.

   THREE OF THESE ARE NOT COSMETIC. Each is a thing that currently draws NOTHING, with no error
   anywhere to look at:
     .petra-launch-cta   the one primary action on both dashboards. It has had a :focus-visible
                         entry in the ONE RING list from the start and no base rule at all, so
                         the button renders as a bare browser control.
     .med-ci-point       the uncertainty point marker on every saved run. The legacy rule at
                         styles.css:3731 declares position, size, radius and shadow and NO
                         background — every colour lived on the .pt-t1 … .pt-t5 ramp suffixes,
                         and history-rendered.js stopped emitting them when the good-to-bad
                         ramp was deleted. The marker has no fill and cannot be seen.
     .score-bar-fill     the same fault on the no-confidence-interval fallback bar
                         (styles.css:3768). Correct width, no colour.

   AND THE RECURRING LESSON, once more: BEING LAST IN THE FILE ONLY WINS AT EQUAL SPECIFICITY.
   Every override below is written in the incumbent's own selector shape —
   .psum-section .concern-item and not .concern-item, .vpd-breadcrumb a:hover and not a:hover,
   .patients-table--ras th:nth-child(n) and not .patients-table th.
   ============================================ */

/* ---- The launch card ------------------------------------------------------------------
   ONE ACTION, ONE COMPONENT, TWO ARRANGEMENTS. dashboard.html and patient_dashboard.html start
   the same run, so they share one .petra-surface, one header band and one button.
   dashboard.html puts the text and the button side by side because that card sits above a
   patient table and the eye should reach the control without reading first; patient_dashboard
   puts the button in the panel footer under a single full-width column. .petra-launch is ONLY
   that side-by-side arrangement — the padding comes from .petra-surface-body, which is on the
   same element.

   min-width: 0 on the text column is load-bearing. It is a flex item holding a paragraph and
   the three-step ribbon, and a flex item will not shrink below its content unless you say so,
   so without it the ribbon pushes the button off the panel.

   RADIUS 8px AND NOT THE 999px IT HAD. A pill is a LABEL in this vocabulary — .res-pill, the
   quiet .run-badge.older — and never a control. This is .continue-btn's fill and type without
   .continue-btn's flex: 1, which would make the button share the panel width with the text,
   and without its legacy rgba(59,130,246,0.3) hover shadow. Two passes proposed two paddings
   (12px 18px and 10px 20px); 12px is .continue-btn's own vertical padding and 18px is the
   panel gutter every band and every row in this file already uses, so the button lines up with
   the text above it.

   NO text-align: center IN THE BREAKPOINT, which the old .petra-panel carried at
   styles.css:4632. The stacked column is a paragraph of reading text and nothing in this
   system centres running prose — .step-subtitle is one line, this is five. align-items:
   stretch makes the button full width on a phone, which is also why it declares
   justify-content: center up here: on a shrink-to-fit inline-flex box that changes nothing,
   and on a stretched one it is the difference between a centred label and a left-hugging one.
   ============================================ */
.petra-launch {
  display: flex;
  align-items: center;
  gap: 28px;
}
.petra-launch-text {
  flex: 1 1 auto;
  min-width: 0;
}
.petra-launch-cta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  background: var(--petra-brand);
  border: 1px solid var(--petra-brand);
  border-radius: 8px;
  color: #FFFFFF;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.petra-launch-cta:hover {
  background: var(--petra-brand-700);
  border-color: var(--petra-brand-700);
}
.petra-launch-cta:active { transform: translateY(1px); }
.petra-launch-cta svg { width: 14px; height: 14px; flex-shrink: 0; }
/* The quiet line that travels with the button, because it is a fact about what pressing it
   does. It replaces .petra-hero-note and .petra-panel-cta-sub, both #9CA3AF at 2.54:1. This
   one sits on the white panel, which is the ground ink-3 is certified against — 4.57:1. */
.petra-launch-note {
  font-size: 12px;
  color: var(--petra-ink-3);
  line-height: 1.45;
}
/* The footer is a flex row and a 14px button plus a whole sentence does not fit on a phone.
   Wrapping is the only thing that changes; the 12px gap then does duty as the row gap too. */
@media (max-width: 560px) {
  .petra-surface-foot { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .petra-launch { flex-direction: column; align-items: stretch; }
}

/* ---- The three-step ribbon --------------------------------------------------------------
   RECOLOURED IN PLACE, RENAMED NOTHING. Both dashboards draw this figure, so the names are
   shared vocabulary. It held the last untouched patch of legacy bright blue in the app: a
   #3B82F6 ring with #1D4ED8 numerals over a rgba(59,130,246,0.18) drop shadow, joined by a
   #BFDBFE-to-#3B82F6 gradient rule, all now sitting inside a lapis panel.

   THE ANSWER ALREADY EXISTS and it is .petra-wiz-mark.is-done — a white disc, a brand-300
   hairline and brand ink — because that is the same figure doing the same job, a numbered step
   marker on a panel. NO SHADOW: a shadow says a surface is floating above another one, and
   this is a figure drawn on a panel. The connector takes brand-200, the brand hairline at
   rest, and not brand-100, which at 2px on white is not there at all.

   ⚠ THE LAYOUT SCOPE MOVED FROM .petra-panel TO .petra-launch. styles.css:4582 and its 640px
   twins at 4644-4658 were all scoped to the now-vacated .petra-panel, so the moment
   dashboard.html dropped that name the ribbon fell back to its base — max-width 520px, margin
   2px auto 14px — and centred itself inside a left-aligned column. Re-scoped here.
   patient_dashboard KEEPS the centred base, because there the ribbon runs the full width of a
   single-column panel body, which is what the base was written for.
   ============================================ */
.petra-hero-timeline-num {
  background: var(--petra-panel);
  border: 2px solid var(--petra-brand-300);
  color: var(--petra-brand);
  box-shadow: none;
}
.petra-hero-timeline-label { color: var(--petra-ink-2); }
.petra-hero-timeline-connector { background: var(--petra-brand-200); }
.petra-launch .petra-hero-timeline {
  margin: 4px 0 0;
  justify-content: flex-start;
  max-width: 100%;
}
/* Later than the rule above at the same (0,2,0), so the stacked card re-centres the ribbon and
   lets the three steps share the width instead of overflowing it. (0,2,0) also beats the 480px
   block at styles.css:4554, which is what keeps min-width: 0 winning on a narrow phone. */
@media (max-width: 640px) {
  .petra-launch .petra-hero-timeline { justify-content: center; max-width: 100%; }
  .petra-launch .petra-hero-timeline-step { width: auto; min-width: 0; flex: 1 1 0; }
  .petra-launch .petra-hero-timeline-connector { min-width: 12px; max-width: 24px; }
  .petra-launch .petra-hero-timeline-label { font-size: 11px; }
}

/* ---- The CTU toolbar --------------------------------------------------------------------
   .dash-toolbar is grouped into .petra-surface-head above, so it is a header band now and sets
   color: var(--petra-ink). The magnifier is stroke="currentColor" and is NOT a direct child of
   the band, so .petra-surface-head > svg never reaches it and currentColor resolves to #0F2739
   — a decorative field icon at full body ink. ink-3 is what it was reaching for.

   .dash-invite is the one primary action in that toolbar and it was the last button in the app
   still filled with --primary-bg-color #30384d, the slate the navbar was deliberately moved
   off. It is not a .btn, so the .btn-primary conversion never reached it. Radius 9px comes down
   to the 8px this file gives a primary. Its border stays `none` from styles.css:4835 — a brand
   fill and a 1px brand border are the same pixel, and adding one would make the button 2px
   taller than the search box beside it.
   ============================================ */
.dash-search svg { color: var(--petra-ink-3); stroke: var(--petra-ink-3); }
.dash-invite { background: var(--petra-brand); border-radius: 8px; }
.dash-invite:hover { background: var(--petra-brand-700); }

/* ---- The empty state, when it carries an action -----------------------------------------
   .empty-state p is margin: 0, so an action placed after it sat flush against the sentence.
   The action is a SIBLING of the paragraph and not an anchor inside it, because an inline-flex
   button in the middle of a line box sits on the text baseline and cannot be given room above
   it — so a plain top margin on the button is the whole fix. Written for both names because
   .empty-state and .no-history are one component; only the .empty-state half fires today,
   because the one action .no-history carries is the Restore button at history-rendered.js:469
   and that is a SIBLING of the block rather than inside it. */
.empty-state .petra-edit-btn,
.no-history .petra-edit-btn { margin-top: 12px; }

/* The research assistants pane. Three columns, and table-layout is fixed with no widths
   declared, which splits them evenly — acceptable, but the variant class is in the markup and
   the next reader will look for the rule. Name and Email keep the proportions the clinician
   table uses for the same two columns and Registered takes the rest. */
.patients-table--ras th:nth-child(1), .patients-table--ras td:nth-child(1) { width: 34%; }
.patients-table--ras th:nth-child(2), .patients-table--ras td:nth-child(2) { width: 46%; }
.patients-table--ras th:nth-child(3), .patients-table--ras td:nth-child(3) { width: 20%; }

/* ---- The team dashboard (2026-09-25, PLAN_ra_team_powers_2026-09-25.md 3.2) ----------------
   The children table on ctu_dashboard is its own variant. A research assistant sees eight
   columns (name, email, trial ID, clinician, registered, baseline, rating scale, actions) and the
   coordinator ten, with Errors and Concerns. Ten do not fit the 912px console without cutting the
   chips, which is the defect the 2026-08-30 note below records, so the coordinator table takes a
   minimum width and the pane, which already scrolls down, scrolls sideways as well. The clinician
   table gained Status and an action (five columns), the assistant table also whether each
   registers participants (six), and the children taken off the lists have a small table of their
   own. No new colour enters the file. */
.patients-table--team th:nth-child(1), .patients-table--team td:nth-child(1) { width: 14%; }
.patients-table--team th:nth-child(2), .patients-table--team td:nth-child(2) { width: 14%; }
.patients-table--team th:nth-child(3), .patients-table--team td:nth-child(3) { width: 8%; }
.patients-table--team th:nth-child(4), .patients-table--team td:nth-child(4) { width: 13%; }
.patients-table--team th:nth-child(5), .patients-table--team td:nth-child(5) { width: 10%; }
.patients-table--team th:nth-child(6), .patients-table--team td:nth-child(6) { width: 12%; }
.patients-table--team th:nth-child(7), .patients-table--team td:nth-child(7) { width: 12%; }
.patients-table--team th:nth-child(8), .patients-table--team td:nth-child(8) { width: 17%; }

.patients-table--team.is-coordinator { min-width: 1180px; }
.patients-table--team.is-coordinator th:nth-child(1), .patients-table--team.is-coordinator td:nth-child(1) { width: 11%; }
.patients-table--team.is-coordinator th:nth-child(2), .patients-table--team.is-coordinator td:nth-child(2) { width: 11.5%; }
.patients-table--team.is-coordinator th:nth-child(3), .patients-table--team.is-coordinator td:nth-child(3) { width: 7%; }
.patients-table--team.is-coordinator th:nth-child(4), .patients-table--team.is-coordinator td:nth-child(4) { width: 11%; }
.patients-table--team.is-coordinator th:nth-child(5), .patients-table--team.is-coordinator td:nth-child(5) { width: 8%; }
.patients-table--team.is-coordinator th:nth-child(6), .patients-table--team.is-coordinator td:nth-child(6) { width: 9.5%; }
.patients-table--team.is-coordinator th:nth-child(7), .patients-table--team.is-coordinator td:nth-child(7) { width: 9.5%; }
.patients-table--team.is-coordinator th:nth-child(8), .patients-table--team.is-coordinator td:nth-child(8) { width: 6.5%; }
.patients-table--team.is-coordinator th:nth-child(9), .patients-table--team.is-coordinator td:nth-child(9) { width: 8%; }
.patients-table--team.is-coordinator th:nth-child(10), .patients-table--team.is-coordinator td:nth-child(10) { width: 18%; }

/* The clinicians, five columns now, and later than the four-column map above, so these win at
   equal weight. */
.patients-table--clinicians th:nth-child(1), .patients-table--clinicians td:nth-child(1) { width: 25%; }
.patients-table--clinicians th:nth-child(2), .patients-table--clinicians td:nth-child(2) { width: 32%; }
.patients-table--clinicians th:nth-child(3), .patients-table--clinicians td:nth-child(3) { width: 12%; }
.patients-table--clinicians th:nth-child(4), .patients-table--clinicians td:nth-child(4) { width: 13%; }
.patients-table--clinicians th:nth-child(5), .patients-table--clinicians td:nth-child(5) { width: 18%; }
/* The assistants, six, with whether each registers participants and two actions. */
.patients-table--ras th:nth-child(1), .patients-table--ras td:nth-child(1) { width: 20%; }
.patients-table--ras th:nth-child(2), .patients-table--ras td:nth-child(2) { width: 24%; }
.patients-table--ras th:nth-child(3), .patients-table--ras td:nth-child(3) { width: 10%; }
.patients-table--ras th:nth-child(4), .patients-table--ras td:nth-child(4) { width: 11%; }
.patients-table--ras th:nth-child(5), .patients-table--ras td:nth-child(5) { width: 10%; }
.patients-table--ras th:nth-child(6), .patients-table--ras td:nth-child(6) { width: 25%; }

.patients-table--withdrawn th:nth-child(1), .patients-table--withdrawn td:nth-child(1) { width: 34%; }
.patients-table--withdrawn th:nth-child(2), .patients-table--withdrawn td:nth-child(2) { width: 16%; }
.patients-table--withdrawn th:nth-child(3), .patients-table--withdrawn td:nth-child(3) { width: 30%; }
.patients-table--withdrawn th:nth-child(4), .patients-table--withdrawn td:nth-child(4) { width: 20%; }
.patients-table--withdrawn .patient-name { color: var(--petra-ink-3); }

/* A labelled quiet secondary in a row, for Cut access, Restore access and Put back. The square
   icon buttons above carry no words, and these must. Cut access shows its danger only on intent,
   like Remove did. */
.row-actions .btn-row-text {
  background: #FFFFFF;
  border-color: #E5E7EB;
  color: #4B5563;
}
.row-actions .btn-row-text:hover {
  background: #F9FAFB;
  border-color: #CBD5E1;
  color: #111827;
}
.row-actions .btn-row-text.is-cut:hover {
  background: #FEF2F2;
  border-color: #FCA5A5;
  color: #DC2626;
}
.btn-row-text:focus-visible {
  outline: 2px solid var(--petra-brand);
  outline-offset: 2px;
}

/* The clinician a child is with, and under it the flag when that clinician access is cut. */
.patients-table td .patient-email + .cell-chip { margin-top: 4px; }

/* The toggle for the children taken off the lists, at the foot of the children pane. */
.withdrawn-toggle {
  padding: 12px 18px;
  border-top: 1px solid var(--petra-line-soft);
}

/* The coordinator recent changes. */
.recent-changes { list-style: none; margin: 0; padding: 0; }
.recent-changes li {
  padding: 8px 0;
  border-bottom: 1px solid var(--petra-hair);
  font-size: 13px;
  color: var(--petra-ink-2);
}
.recent-changes li:last-child { border-bottom: none; }
.recent-changes .rc-who { color: var(--petra-ink-3); }
.recent-changes-note { margin: 10px 0 0; font-size: 12px; color: var(--petra-ink-3); }

/* ---- Flagged medications: the EDITABLE twin ---------------------------------------------
   The theme flattened the read-only list at styles.css:6342-6350 for activity1 and stopped
   there. The interactive twin on patient_dashboard kept .concern-group's 1px #F3F4F6 border at
   radius 8px — a box inside the panel — and .concern-item's 12px 8px padding with a #F3F4F6
   rule, so five rows sat 10px inside the panel's own 18px gutter and were ruled in a colour
   that is not --petra-hair.

   .concern-item MATCHES THE READ-ONLY ROW TOO, deliberately: every row carries .concern-item,
   the values here are the values the rule at styles.css:6343 already sets, and one rule for one
   row shape is the point. The only thing that rule still contributes is `background: none`.

   ⚠ AND background IS THE ONE PROPERTY THIS RULE MUST NOT DECLARE. .concern-item.flagged sets
   #FFFBEB at (0,2,0) at styles.css:2472; this selector is also (0,2,0) and later, so a
   `background` here would silently delete the flag colour from the editable rows. The flagged
   amber, its #F59E0B dot and its #92400E name are the state the family is setting, and they
   are not ours to move.

   ⚠ THE :last-child RULE HAS TO BE RESTATED. The bare .concern-item:last-child at
   styles.css:2470 is (0,1,1) and loses to the (0,2,0) rule above it, so without this the last
   row keeps a rule running along the panel's own bottom edge.
   ============================================ */
.psum-section .concern-group { border: none; border-radius: 0; }
.psum-section .concern-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 18px;
  border: none;
  border-bottom: 1px solid var(--petra-hair);
  border-radius: 0;
}
.psum-section .concern-item:last-child { border-bottom: none; }

/* ---- Text that sits on the ground, not on a panel ----------------------------------------
   The page-header block above records the rule and then applied it to the subtitle alone:
   ink-3 is the floor for live text ON A PANEL and never for live text on Level 0. #63788C is
   4.57:1 on #FFFFFF, 4.10:1 on --petra-page and 3.68:1 under the radial wash at the top of the
   ground, against a 4.5:1 floor. These are the two families that correction named and did not
   reach. .res-seclab is a section label sitting outside every box by design, and
   .vpd-breadcrumb sits above the first panel — both are Level 0 by construction, on every page
   that draws them. ink-2 is 7.72:1 on the worst of those grounds.

   The breadcrumb's own colours were still pre-theme: a #9CA3AF trail, #6B7280 links and a
   #1F2937 hover. Its two glyphs are stroke="currentColor", so colouring the text colours them.
   ============================================ */
.res-seclab-t,
.res-seclab-n { color: var(--petra-ink-2); }
.vpd-breadcrumb { color: var(--petra-ink-2); }
.vpd-breadcrumb a { color: var(--petra-ink-2); }
/* (0,2,1), matching the incumbent at styles.css:1338. --petra-brand-800 is the hover this file
   gives every other link and link-shaped control. */
.vpd-breadcrumb a:hover { color: var(--petra-brand-800); }

/* .results-action-link was written for a <button> and declares no text-decoration, and three
   pages now hang it on an <a>, where bootstrap's reboot underlines it. Same declaration
   .petra-edit-btn already carries for the same reason. The bootstrap text-decoration-none
   utility on those three anchors is a stopgap that can come off whenever that markup is next
   touched; it is harmless until then. */
.results-action-link { text-decoration: none; }

/* .patient-alert is display: flex and .patient-alert-body is flex: 1 with min-width: 0, so
   with a long reported message the button is the item that gets squeezed. This is the one
   declaration the deleted runtime cssText was carrying that the stylesheet did not. */
.patient-alert .petra-edit-btn { flex-shrink: 0; }

/* ---- Two saved-run figures with no colour at all -----------------------------------------
   See the ⚠ at the head of this section. Both legacy base rules declare geometry only, and both
   ramps have stopped being emitted, so both figures currently render with no fill at all.
   Lapis for the reason the uncertainty band above already took it: they are a position and a
   length that RANK, they carry no valence, and they are drawn identically for every row, so the
   position on the scale still does all the ordering. The .pt-* and .fill-* compound overrides
   in the saved-runs block stay where they are — they are harmless, and they still cover a
   browser holding an older cached copy of history-rendered.js. */
.med-ci-point { background: var(--petra-brand); }
.score-bar-fill { background: var(--petra-brand); }

/* ---- The landing hero -------------------------------------------------------------------
   The first screen anybody sees was the last place in the app still painted in the pre-theme
   colours — a #30384d title and initials, a #3B82F6 subtitle and a #6B7280 body line — and no
   rule in the appended sections reached it. All four are single classes, so file order settles
   them.

   ⚠ .landing-desc IS ink-2 AND NOT ink-3. This is the page-header call again: the text now
   sits on .petra-canvas, where ink-3 is 4.10:1 and 3.68:1 under the wash, both under the 4.5:1
   floor for 14px body text. The initials take the brand because they are the only thing on the
   page carrying the name; the subtitle around them is reading text and takes ink.
   ============================================ */
.landing-title { color: var(--petra-ink); }
.petra-initial { color: var(--petra-brand); }
.landing-subtitle { color: var(--petra-ink-2); }
.landing-desc { color: var(--petra-ink-2); }

/* ---- Two icon discs with a ground and no ink ---------------------------------------------
   .step-icon-red sets a background at styles.css:1697 and nothing else, so a glyph inside it
   had nothing to inherit and the three refusal pages carried stroke="#DC2626" as a markup
   attribute to compensate. A CSS `stroke` declaration outranks a `stroke` PRESENTATION
   attribute — the same fact .petra-surface-head > svg and .petra-page-head-ic svg already rely
   on — so declaring it here is what lets those hexes come out of the markup, which they now
   have. Red is permitted on those three pages for the reason the confirmation ruling gives:
   red already means a hard stop in the fail-closed panel, and being refused a sign-in is one.

   .ls-icon-wrap is the same fault on the welcome animation, three times over: #EFF6FF for the
   clinician disc, #F3E8FF for the patient disc — a violet that appears nowhere else in the app
   and is the fourth badge colour the role chips just lost — and a circlePulse drawn in the
   legacy bright rgba(59,130,246,0.3). One brand-100 ground for both roles, because the disc is
   not what says which role signed in, the drawing inside it is. A later @keyframes of the same
   name replaces the earlier one outright, so the pulse is re-declared rather than patched.
   ============================================ */
.step-icon-red { color: #DC2626; }
.step-icon-red > svg { stroke: #DC2626; }
.ls-icon-wrap { color: var(--petra-brand); }
.ls-icon-wrap svg { stroke: var(--petra-brand); }
.ls-icon-wrap.clinician-bg,
.ls-icon-wrap.patient-bg { background: var(--petra-brand-100); }
@keyframes circlePulse {
  0%   { box-shadow: 0 0 0 0 rgba(38, 97, 155, 0.3); }
  70%  { box-shadow: 0 0 0 15px rgba(38, 97, 155, 0); }
  100% { box-shadow: 0 0 0 0 rgba(38, 97, 155, 0); }
}

/* ---- The dropdown caret, put back --------------------------------------------------------
   ⚠ A `background` SHORTHAND RESETS background-image TO none, and bootstrap draws the
   .form-select caret entirely with background-image while also setting appearance: none. The
   shared field group above declares the shorthand — correct for every text input in it — and
   .petra-field .form-select is (0,2,0) against bootstrap's (0,1,0) in an earlier file, so the
   caret loses and the select renders as a plain white box with nothing on it saying it opens.
   The padding change compounds it: bootstrap reserves 2.25rem on the right for the caret and
   the shared rule replaces that with 11px, so even a restored caret would sit under the text.

   Restated here rather than by splitting the group, because the group's other five members
   genuinely want the shorthand. background-position tracks the field's own 11px gutter.

   ⚠ .profile-select IS NOT AFFECTED AND MUST NOT BE ADDED HERE. It sets appearance: auto at
   styles.css:4183, so the browser draws its own caret and there is no background-image to lose.
   ============================================ */
.petra-field .form-select {
  background-color: #FFFFFF;
  background-image: var(--bs-form-select-bg-img), var(--bs-form-select-bg-icon, none);
  background-repeat: no-repeat;
  background-position: right 11px center;
  background-size: 16px 12px;
  padding-right: 32px;
}

/* A form-level error message standing BETWEEN two fields. .petra-field-err is margin: 5px 0 0,
   which is right for a message under the last field — the preceding field's 14px bottom margin
   collapses with the message's 5px top and stays 14px. But the message's 0 bottom against the
   next field's 0 top leaves the error glued to the following label. A twin rather than a bottom
   margin on the message itself, because a bottom margin would also add 14px under the last
   message on a panel, where the body padding is already doing that job.
   ⚠ INERT TODAY: all nine forms currently place each message inside the .petra-field it is
   about, or last. It is written so the arrangement cannot be discovered the hard way. */
.petra-field-err + .petra-field { margin-top: 14px; }

/* ---- Two leftovers on the baseline questionnaire -----------------------------------------
   .qb-sec-head > svg is .petra-surface-head > svg byte for byte, and it is a DIRECT child
   selector because the glyph is a sibling of the title span and not nested inside it. The
   `stroke` half is the load-bearing one: the markup writes stroke="currentColor", and without a
   rule the six glyphs inherit the body ink, which would make the questionnaire the only place
   in the app whose panel headers are not lapis. The band itself is deliberately restyled under
   its own name rather than given .petra-surface-head — two components painting one strip is how
   a later padding change moves half a page and not the other half.

   The footer note said both counts in --qb-amb. On this page amber means a value arrived from
   the saved record and nobody has looked at it; still to fill in is RED, in the cell
   (.qb-f.is-empty), in the section chip (.qb-chip-fill) and in the count button
   (.qb-count-fill), and the note was the one place saying it in the other colour. Both states
   are written even though the amber one changes no pixel today, so the pair reads as a pair and
   nobody can move one of them by accident while fixing the other.
   ============================================ */
.qb-sec-head > svg {
  width: 16px;
  height: 16px;
  color: var(--petra-brand);
  stroke: var(--petra-brand);
  flex-shrink: 0;
}
.qb-actions-note.qb-note-fill { color: var(--qb-red); }
.qb-actions-note.qb-note-val { color: var(--qb-amb); }

/* ---- A prose body that is not the first thing in its panel -------------------------------
   .petra-prose-h:first-child drops its top rule so a panel body cannot open with a rule drawn
   directly under the header band. On contact_us, pis and pis-open the prose is a SECOND
   .petra-surface-body inside the same panel, after the details grid (and a hint on the sheets) — so the first
   sub-heading is :first-child of its own wrapper but is not the first thing in the panel, and
   it was left as the one sub-heading with no division above it while every later one had one.
   Undone for that arrangement only, at (0,3,0) against the reset's (0,1,1).
   ⚠ The case this does NOT cover, because no page has it: a .petra-prose body placed directly
   under a .petra-surface-head whose first child is a sub-heading. That would draw this rule one
   pixel under the band's own rule. Reset it there if such a page is ever written. */
.petra-surface-body.petra-prose > .petra-prose-h:first-child {
  margin-top: 0;
  padding-top: 14px;
  border-top: 1px solid var(--petra-line-soft);
}

/* ---- The step header glyph ------------------------------------------------------------
   THE LAST LITERAL ACCENT IN THE APP. The theme recoloured the step-header DISC to
   --petra-brand-100 at styles.css:6210 and could not touch the glyph inside it, because the
   colour was a stroke ATTRIBUTE on the svg and not a CSS declaration — the same trap the
   page-header block records for the dashboard glyphs. So the three step headers on activity1
   kept a #3B82F6 and a #D97706 line drawing sitting on a lapis disc, which is the one place
   the pre-theme palette survived on a converted page.

   The three *_fail pages were converted with the markup and already carry currentColor, which
   is why .step-icon-red above needed only a colour. activity1 carried none, so its three
   glyphs are switched to currentColor here and coloured by their disc.

   .step-icon-amber IS DELIBERATELY THE SAME LAPIS. The theme collapsed the amber disc onto
   --petra-brand-100 at styles.css:6211 on purpose: amber means a warning, a request or still
   to fill in, and step 2 of a three-step run is none of those. Colouring its glyph amber here
   would put the meaning straight back.
   ============================================ */
.step-icon-blue,
.step-icon-amber { color: var(--petra-brand); }
.step-icon-blue > svg,
.step-icon-amber > svg { stroke: var(--petra-brand); }

/* ---- The row action takes the primary colour (2026-08-30) ------------------------------
   THE LAST MEANING COLLISION. .row-actions .btn-optimize — the Run PETRA button on every
   patient row, written by patients.js:256 — was #059669 with a #047857 hover and a green
   shadow. That is .res-fill-eff exactly, the hex that means HOW WELL A MEDICATION WORKS, spent
   on a button. A clinician reads it in the patient table and then reads it again as a bar on
   the results screen an action later, meaning something different both times.

   It is the primary action of its row, and the app now has one primary colour, so it takes it.
   Written at (0,2,0) to match the incumbent — a bare .btn-optimize would lose, and the base
   rule at styles.css:1256 is already recorded as dead in the ledger below for that same reason.

   The shadow goes rather than turning lapis. .btn-primary above carries none, and a coloured
   drop shadow on a 28px control inside a table row is the kind of thing the panel grammar
   removed everywhere else.
   ============================================ */
.row-actions .btn-optimize {
  background: var(--petra-brand);
  border-color: var(--petra-brand);
  color: #FFFFFF;
  box-shadow: none;
}
.row-actions .btn-optimize:hover {
  background: var(--petra-brand-700);
  border-color: var(--petra-brand-700);
  color: #FFFFFF;
}

/* ---- The patient table, columns that fit their contents (2026-08-30) -------------------
   THE CELLS WERE CLIPPING, and had been for a long time. .patients-table is table-layout:
   fixed with the eight percentages at styles.css:5041-5048, and styles.css:5027 puts
   overflow:hidden on every cell so a long name truncates instead of widening the table. Put
   together, a column narrower than its own contents does not push or wrap — it CUTS, with no
   ellipsis and no scrollbar. Baseline at 10% and Concerns at 7% were both narrower than the
   chip and the heading they carry, so the table read "Incomplet" and "CONCERN".

   The room comes from Actions, which dropped from four controls to at most three when the eye
   was removed and the pencil became conditional. Redistributed to the four status columns,
   which are the ones carrying a chip with a word in it. Still sums to 100.

   AND THE HEADINGS MAY WRAP NOW. "Rating scale" is two words in a narrow column and there is
   no reason for it to be one line — a clipped heading is worse than a tall one. The 0.4px
   letter-spacing goes with it, which buys back about a character per word.
   ============================================ */
.patients-table--patients th:nth-child(1), .patients-table--patients td:nth-child(1) { width: 15%; }
.patients-table--patients th:nth-child(2), .patients-table--patients td:nth-child(2) { width: 15%; }
.patients-table--patients th:nth-child(3), .patients-table--patients td:nth-child(3) { width: 10%; }
.patients-table--patients th:nth-child(4), .patients-table--patients td:nth-child(4) { width: 12%; }
.patients-table--patients th:nth-child(5), .patients-table--patients td:nth-child(5) { width: 12%; }
.patients-table--patients th:nth-child(6), .patients-table--patients td:nth-child(6) { width: 8%; }
.patients-table--patients th:nth-child(7), .patients-table--patients td:nth-child(7) { width: 9%; }
.patients-table--patients th:nth-child(8), .patients-table--patients td:nth-child(8) { width: 19%; }

/* Written at (0,2,0) to match .patients-table thead th at styles.css:1196. */
.patients-table thead th {
  white-space: normal;
  letter-spacing: 0;
  line-height: 1.25;
  vertical-align: bottom;
}
/* The chip is the widest thing in four of these columns, so it is what has to fit. Nothing
   here is new colour — only the geometry that stops the word being cut. */
.patients-table .cell-chip { max-width: 100%; }
.patients-table .cell-chip span { overflow: hidden; text-overflow: ellipsis; }

/* ---- The questionnaire grid needs a line you can actually see (2026-08-30) -------------
   THE HAIRLINE WAS INVISIBLE ON TWO OF THE THREE GROUNDS. The conversion did the right thing
   structurally — .qb-f stopped being a bordered rounded box and became a ruled cell, top and
   left, with gap:0 — but it drew the rule in --petra-hair #EBF0F6. That token was chosen for
   hairlines on WHITE panels, and two of this page`s three field states are not white: is-empty
   is #FCEBE9 and is-check is #FDF2E0. A pale cool line on a pale warm ground is no line at
   all, so a section with everything still to fill in read as one undivided pink block and the
   reader could not tell where one field ended and the next began.

   --petra-line #D4DFEA is the panel border, one step darker, and it reads on all three: cool
   against both warm grounds and plainly visible on white. No new value enters the file.

   ONE COLOUR FOR THE WHOLE GRID, not one per state, and that is deliberate. Only border-top
   and border-left are drawn, so the line between two side-by-side cells belongs to the RIGHT
   one — a per-state colour would make the same divider change colour depending on which
   neighbour happened to be answered, which is a worse signal than no colour at all. The state
   is carried by the FILL, which is where this page has always carried it.
   ============================================ */
.qb-f {
  border-top-color: var(--petra-line);
  border-left-color: var(--petra-line);
}
/* The state rules at styles.css:8463-8470 set border-color as a shorthand, which rewrites all
   four longhands and would otherwise put --petra-hair back on the two grounds that need this
   most. Same specificity, later in the file. */
.qb-f.is-empty,
.qb-f.is-check,
.qb-f.is-done,
.qb-f.is-error,
.qb-f.qb-derived {
  border-top-color: var(--petra-line);
  border-left-color: var(--petra-line);
}

/* ---- The still-to-do panel on the record sheet (2026-08-30) ----------------------------
   Reuses .res-run-panel / .res-run-row / .res-run-lead / .res-run-body verbatim — the shape
   the results screen already uses for "About this particular run". Only two things are new:
   the text column has to flex so the action can sit at the end of the row, and the action
   needs to stop itself being squeezed. Everything else is inherited, which is the point.
   ============================================ */
.vpd-todo-text { flex: 1; min-width: 0; }
.res-run-row > .petra-edit-btn { flex-shrink: 0; align-self: center; }
.res-run-row > svg { color: var(--petra-ink-3); }

/* ==========================================================================================
   THE LANDING HERO, SECOND PASS — 2026-08-31
   The first screen anybody sees, and the two things wrong with it were both structural rather
   than decorative.
   ========================================================================================== */

/* ---- The illustration ---------------------------------------------------------------------
   THE WHITE BOX WAS THE PICTURE, NOT A CONTAINER. The page used logopetra.jpeg, and a JPEG
   cannot hold transparency, so the wide margin around the artwork was painted onto the tinted
   ground as a hard rectangle. Nothing was wrong with the drawing — the file simply could not be
   transparent.

   Measured before deciding: that margin is (253,253,253) and only 0.1% of the file is truly
   white, which is why `mix-blend-mode: multiply` was tried and rejected. Multiplying by 253
   rather than 255 darkens the backdrop about 1%, so the rectangle came back as a faint but
   perfectly visible box — worse than a clean edge, because it looks like a rendering fault.

   Since 2026-10-06 the page uses petra-logo-hero.png, the logo of 4 October with only the white
   OUTSIDE the drawing keyed out and trimmed (342px wide, so max-width is 342 and never upscales).
   Not a global key: the coat and the monitor screen are white, and the monitor has no left edge,
   so audits/samuele-edits-2026-10-06/key_logo.py closes it on the mask. petra-logo.png stays
   opaque as the navbar mark on the other pages, where it sits in a white chip on purpose.

   Sizing moved from height to width at the same time. At height:140 a 3:2 illustration came out
   about 210px wide on a 540px column, which read as a stamp rather than a picture. */
.landing-logo {
  display: block;
  width: 100%;
  max-width: 342px;
  height: auto;
  margin: 0 auto 24px;
}

/* ---- The housekeeping under the button ----------------------------------------------------
   Two equal-weight grey paragraphs sat directly under Sign in, so the coordinator link — a rare
   one-off action for a handful of staff — carried the same weight as the note every visitor
   needs, and the whole block competed with the only control on the page. The first line also
   broke across "if you need / access" on the 540px column.

   A hairline separates the action from the housekeeping, which is the same move .res-seclab
   makes elsewhere — a rule and a change of weight, never a bordered box on the bare ground.
   The narrower measure is what fixes the wrap.

   COLOUR IS NOT A PREFERENCE HERE. Both lines carried bootstrap .text-muted, #6c757d, which
   measures 4.04:1, 4.20:1 and 4.43:1 against the three stops of this ground and so misses the
   4.5:1 floor on all of them. .text-muted is declared !important in bootstrap, so no rule in
   this file can reach it and the class had to be removed from the markup — the same trap the
   note at the .lg-* block records. ink-2 measures 8.36:1 at worst here. ink-3 is NOT an option
   even though it is the quieter colour and the obvious choice for small print, for the reason
   the landing hero block above already gives — it fails this ground at 14px, and these lines
   are smaller than that. */
.landing-note {
  max-width: 400px;
  margin: 30px auto 0;
  padding-top: 18px;
  border-top: 1px solid var(--petra-line-soft);
}

.landing-note-main {
  margin: 0 0 9px;
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--petra-ink-2);
}

.landing-note-alt {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: var(--petra-ink-2);
}

/* Brand rather than ink, because it is the only link in the block and nothing else marks it as
   one. 5.54:1 at worst on this ground, so it clears the floor as a link colour as well. */
.landing-note-alt a {
  color: var(--petra-brand);
  font-weight: 600;
  text-decoration: none;
}

.landing-note-alt a:hover,
.landing-note-alt a:focus-visible {
  text-decoration: underline;
}

@media (max-width: 575.98px) {
  .landing-logo { max-width: 300px; margin-bottom: 20px; }
  .landing-note { margin-top: 24px; padding-top: 16px; }
}

/* ---- The landing page in two columns - 10 October 2026 ------------------------------------
   Samuele found the first screen empty: one 540px column in the middle of a wide window. From
   992px the text sits on the left, under the name in full set as the title, and the drawing on
   the right in a card (Corentin, the same day: the drawing on the right, in a box, so that the
   text no longer outweighs it). Narrower, the card stacks above the text and both centre. After
   the rules above, so these win.

   THE CARD, NOT THE DRAWING, CARRIES THE SIZE. The drawing's file is 342px wide, and the only
   larger copy, the artwork of 6 October, is 426px, so past about 400px it turns soft. The card
   around it fills the column instead: white into the palest brand blue, a hairline, a long soft
   shadow. Behind it a second plate, offset down and right, takes the sage of the capsule the
   drawing shows (#A0C8B8 in the artwork), the one warm colour on the page.

   The title is ink and not ink-2: it is the largest text on the page, and the initials keep the
   brand. Beside the card the description keeps a measure of about 48 characters, so the text
   stays a column and does not outweigh the picture. */
.landing-hero--split { max-width: 1100px; padding: 24px 0 32px; }
.landing-hero--split .landing-subtitle {
  font-size: 26px;
  font-weight: 600;
  line-height: 1.22;
  letter-spacing: -0.01em;
  color: var(--petra-ink);
  margin-bottom: 18px;
}
.landing-hero--split .landing-desc { font-size: 16px; line-height: 1.65; margin-bottom: 30px; }

.landing-visual {
  position: relative;
  isolation: isolate;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 22px 22px 0;
}
.landing-visual::before {
  content: "";
  position: absolute;
  inset: 22px 0 0 22px;
  z-index: -1;
  border-radius: 32px;
  background: linear-gradient(140deg, #DCEDE6 0%, #BCDACD 100%);
}
.landing-visual-card {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 6 / 5;
  padding: 40px 32px;
  border: 1px solid var(--petra-line-soft);
  border-radius: 32px;
  background: radial-gradient(130% 100% at 25% 15%, #FFFFFF 0%, var(--petra-brand-050) 55%, var(--petra-brand-100) 100%);
  box-shadow: 0 32px 64px -32px rgba(23, 63, 102, 0.38), 0 2px 6px rgba(15, 39, 57, 0.06);
}
.landing-visual-card .landing-logo { max-width: 400px; margin: 0 auto; }

/* Stacked, the text keeps the narrow centred column it had before. */
@media (max-width: 991.98px) {
  .landing-copy { max-width: 560px; margin-left: auto; margin-right: auto; }
}

@media (min-width: 992px) {
  .landing-hero--split { padding: 32px 0; }
  .landing-hero--split .landing-subtitle { font-size: 36px; margin-bottom: 20px; }
  .landing-hero--split .landing-desc { max-width: 48ch; }
  .landing-hero--split .landing-note { margin-left: 0; margin-right: 0; }
  .landing-visual { max-width: 560px; }
}

@media (max-width: 575.98px) {
  .landing-visual { max-width: 340px; padding: 0 14px 14px 0; }
  .landing-visual::before { inset: 14px 0 0 14px; border-radius: 24px; }
  .landing-visual-card { padding: 28px 22px; border-radius: 24px; }
  .landing-hero--split .landing-subtitle { font-size: 22px; }
  .landing-hero--split .landing-desc { font-size: 15px; }
}

/* ==========================================================================================
   THE ADHD RATING SCALE ON THE BASELINE FORM — 2026-08-31
   Eighteen items a clinician answers when no research assistant has been. The wording is the
   approved instrument and is drawn from assets/js/adhd-rs.js, so nothing here may restate it.
   ========================================================================================== */

/* The stem, and which of the two approved versions is on screen. Named rather than inferred —
   the child and adolescent forms differ on eight of the eighteen items, so "which one am I
   reading" is a real question and the answer belongs on the page. */
#rs-intro { color: var(--petra-ink-2); font-size: 13px; line-height: 1.55; }
.rs-version { color: var(--petra-ink-3); font-size: 12px; font-style: italic; }

/* One item. Hairlines and padding, never a border and a fill — the panel is the box and the law
   is that nothing inside it becomes a second one. .psum-cell is already stripped to no
   background by the theme pass, so only the rhythm is set here. */
.rs-item { padding: 12px 0; border-bottom: 1px solid var(--petra-hair); border-radius: 0; }
.rs-item:last-of-type { border-bottom: none; }
.rs-item .psum-label { color: var(--petra-ink-3); letter-spacing: 0.02em; }
.rs-item .psum-value {
  color: var(--petra-ink-2);
  font-size: 13.5px;
  line-height: 1.5;
  font-weight: 500;
  white-space: normal;      /* the approved wording is long and must never be clipped */
}

/* Four options, equal width, aligned down the whole scale.
   The default .qb-seg is `flex: 1 1 auto`, which sizes each option to its own label — so
   "0 – Never or rarely" would be twice the width of "2 – Often" and no two of the eighteen rows
   would line up. Reading down a column to compare answers is the whole point of a rating scale,
   so the options go on a fixed grid instead. */
.qb-f .sex-button-group.rs-opts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.qb-f .rs-opts label {
  flex: none;               /* the grid owns the width now */
  padding: 7px 6px;
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
  white-space: normal;
}

/* The stem the approved adolescent form repeats before the hyperactivity block. It is instrument
   text, so it is set apart as a heading rather than left to read as another item. */
.rs-midstem {
  margin: 18px 0 2px;
  padding-top: 14px;
  border-top: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-2);
  font-size: 13px;
  font-weight: 600;
}

/* ⚠ THE PERMISSION, NOT A FOOTNOTE. This is the condition under which the wording above may be
   used, so it is quiet but never hidden — no display:none, no truncation, no collapsing it
   behind a control. A test fails if a page draws the items without it. */
.rs-attribution {
  margin: 16px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--petra-line-soft);
  color: var(--petra-ink-3);
  font-size: 11.5px;
  line-height: 1.5;
}

#rs-progress { font-variant-numeric: tabular-nums; }
#rs-summary { color: var(--petra-ink-2); font-size: 13px; line-height: 1.55; }

@media (max-width: 575.98px) {
  .qb-f .sex-button-group.rs-opts { grid-template-columns: repeat(2, 1fr); }
}

/* ==========================================================================================
   THE PATIENT RECORD SHEET — HEADER ROW AND THE CONCERNS NOTICE, 2026-08-31
   ========================================================================================== */

/* ---- The two actions on the header row ----------------------------------------------------
   Edit the information and Run PETRA were on a .results-action-row of their own below the
   heading, which read as a third block between the title and the record and left 22px of
   nothing between a heading and the buttons that act on it. .petra-page-head.is-row is already
   display:flex with align-items:center, so the actions only need pushing to the end of it.

   min-width:0 on the text column is what stops the long subtitle from shoving the buttons off
   the row — .petra-page-head p carries max-width:720px, and without a min-width a flex item
   refuses to shrink below its content. */
.vpd-head-text { min-width: 0; }
.vpd-head-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.vpd-head-actions form { margin: 0; }

/* Below the breakpoint the row stacks, so the actions go full width under the title rather
   than squeezing beside it. The icon disc keeps its place beside the heading. */
@media (max-width: 767.98px) {
  .petra-page-head.is-row { flex-wrap: wrap; }
  .vpd-head-actions { margin-left: 0; width: 100%; }
  .vpd-head-actions form { flex: 1; }
  .vpd-head-actions .results-action-btn { width: 100%; justify-content: center; }
}

/* The STILL TO DO rows stack too, for the same reason and at the same width. .res-run-row is
   a flex row with the action at the end, so on a narrow column the text is squeezed into a
   ribbon four words wide beside a button that keeps its full length. The action goes under
   the text instead, aligned left with it. This improves the row that was already here as well
   as the rating-scale one added beside it. */
@media (max-width: 575.98px) {
  #vpd-todo .res-run-row { flex-wrap: wrap; }
  #vpd-todo .vpd-todo-text { flex: 1 1 100%; min-width: 0; }
  #vpd-todo .vpd-todo-act { margin-left: 28px; }
}

/* ---- The concerns notice ------------------------------------------------------------------
   The same shape and the same place as the reported-error alarm, because both are things a
   family said rather than facts measured, and this one used to sit under the whole record where
   it was read last or not at all.

   ⚠ BLUE, NOT AMBER, AND NOT BY HALF-MEASURE. Both dashboards already draw this exact concept
   as .cell-flag — #1E40AF on #EFF6FF — while amber on this page is the reported-error alarm,
   which the notice-stack law keeps as the ONE coloured block above the content. A concern is
   not a fault to be cleared: every medication is still scored and the tool says so in the
   notice itself. Making it a second amber block would cost the alarm its meaning and tell a
   clinician something is wrong when nothing is.

   It carries no left hazard stripe and a 1px border rather than the alarm's 2px, so the two
   read in the right order when both are on screen. */
.patient-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  background: var(--petra-brand-050);
  border: 1px solid var(--petra-brand-200);
  border-left: 4px solid var(--petra-brand-300);
  border-radius: 10px;
}
.patient-notice-icon { flex-shrink: 0; color: var(--petra-brand); line-height: 0; padding-top: 1px; }
.patient-notice-body { flex: 1; min-width: 0; }
.patient-notice-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--petra-brand-800);
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
/* The count in the title, in the meta slot the panel grammar gives anything qualifying a
   title — same job the .petra-head-meta span did in the section this replaces. */
.patient-notice-count {
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--petra-brand);
  text-transform: none;
}
.patient-notice-msg {
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--petra-ink-2);
  margin-top: 8px;
}

/* The medication rows inside the notice. .concern-item-readonly is ruled into a panel row by
   the theme through `.psum-section .concern-item-readonly`, and this notice is not a
   .psum-section — so without this the group falls back to its own bordered box, which is the
   box inside a box the grammar forbids. Same rows, no second surface. */
.patient-notice .concern-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  border: none;
  background: none;
  padding: 0;
}
.patient-notice .concern-item-readonly {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 4px 10px;
  border: 1px solid var(--petra-brand-200);
  border-radius: 999px;
  background: #FFFFFF;
  font-size: 12.5px;
  color: var(--petra-ink-2);
}
/* .concern-item.flagged .concern-dot at :2483 sets the amber and outranks a two-class
   selector, so the notice class is repeated to win on specificity rather than with
   !important. An amber dot inside a blue notice is the collision this notice exists to
   avoid, in miniature. */
.patient-notice .concern-item.flagged .concern-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background-color: var(--petra-brand); flex-shrink: 0;
}
.patient-notice .concern-name { font-weight: 600; color: var(--petra-ink); }
.patient-notice .med-code {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em;
  color: var(--petra-brand); background: var(--petra-brand-050);
  border-radius: 4px; padding: 1px 5px;
}
/* The word "Concern" on every row said the same thing as the heading above it, eighteen
   characters at a time. The heading says it once. */
.patient-notice .concern-action { display: none; }

/* ==========================================================================================
   THE POINTS BANK STAYS ON SCREEN — 2026-08-31
   ========================================================================================== */

/* Thirteen outcomes do not fit on one screen, so the counter that says how many points are
   left scrolled away the moment anyone started spending them. From there on the family was
   allocating blind and had to scroll back up to find out whether they had finished — and the
   Continue button refuses until all 20 are placed, so "have I finished" is the question the
   screen exists to answer.

   ⚠ THE OFFSET IS THE NAVBAR HEIGHT AND NOT A GUESS. .app-navbar-inner is height:56px, and the
   576px media query changes only its padding and gap, so 56 holds at every width. The extra 8
   leaves the panel visibly floating under the bar rather than welded to it. The one other
   sticky element in this file, .qb-dock, pins to the same 56 and says so in the same words.

   ⚠ z-index 20 is deliberately BELOW the navbar. bootstrap .sticky-top is 1020, so the bank
   slides under the bar rather than over it, and above the rows, which carry no z-index at all.

   ⚠ position:sticky is broken by a transform, a filter or overflow:hidden on ANY ancestor.
   .optimizer-step carries `animation: fadeIn` whose keyframes translateY — that is a 300ms
   transient with no fill-mode, so the transform is gone by the time anyone scrolls, and it is
   the reason the bank is not wrapped in anything new here. Do not add a transform to
   .optimizer-step, .optimizer-container or .optimizer-canvas.

   The sticky element is a child of #step2, so it releases at the end of the priorities step
   rather than following the reader into the results — which is where it stops meaning
   anything. */
.pri-bank {
  position: sticky;
  top: 64px;
  z-index: 20;
  /* A touch more lift than the resting panel shadow, because this one now passes OVER the
     rows instead of sitting between them. Same shadow at rest, so nothing changes until it
     is actually covering something. */
  box-shadow: 0 4px 14px rgba(15, 39, 57, 0.10), 0 1px 3px rgba(15, 39, 57, 0.06);
}

/* Below the breakpoint every point is a token on a wrapping strip, and sixteen of them turn
   the bank into four lines that eat half a phone screen once it is pinned. The tokens are the
   decorative reading of a number the panel already prints twice, so they go; the count and the
   remaining figure, which are the reason it is pinned at all, stay. */
@media (max-width: 575.98px) {
  .pri-bank { top: 60px; gap: 10px; padding: 10px 14px; }
  .pri-bank-tokens { display: none; }
  .pri-bank-num { font-size: 22px; }
  .pri-bank-text { font-size: 12px; }
}

/* ==========================================================================================
   THE GROUP COLOURS — 2026-10-06
   ========================================================================================== */

/* Each group has its own colour, at Samuele's request (PLAN/DECISIONS.md, 6 October): at the
   end of a run the groups were one slate hue at five depths, only on the "Group N" pill, and
   were hard to tell apart. Corentin chose blue, orange and grey. This replaces the section of
   2026-08-31, which drew that single hue and said not to add a second one.

   NOT A RAMP. The green, amber, orange and red ramp removed on 2026-08-28 read as good,
   caution, bad. These are Okabe-Ito hues, which stay apart for the common colour-vision
   deficiencies, and none of them is the green of how well a medication works or the red of
   side effects. Orange is close to the warning amber, so the group explanation and the PDF
   legend say the colours only tell the groups apart and do not mean better or worse.

   THE FIVE. strong = pill fill (and, on paper only since 2026-10-11, the left edge), tint = the
   block ground.
     1 blue    #0072B2 / #E8F2F9   pill text white 5.19:1
     2 orange  #E69F00 / #FDF4E1   pill text ink   6.81:1
     3 slate   #374151 / #EEF0F3   pill text white 10.3:1
     4 sky     #56B4E9 / #EAF5FC   pill text ink   6.64:1
     5 purple  #CC79A7 / #F8EDF3   pill text ink   5.01:1
   Text on a tint is ink-2, never the strong colour (orange, sky and purple are under 4.5:1 as
   text). optimizer.js GROUP_COLOURS carries the same five for the PDF.

   THE RANGE ON THE OVERVIEW, since 2026-10-11 (Corentin, on a screenshot: the range was one pale
   blue in every group, on the orange ground too, and barely darker than what it sat on). Each
   group draws its range in its own hue: band = the fill, edge = its outline. The fill is darker
   than the tint and than the track (#F7FAFD) it sits on, the edge is 3:1 or more against the
   track, and the marker of the score is ink, which reads on every fill.
                band / edge          fill on track   fill on tint   edge on track   ink on fill
     1 blue    #59A3CD / #0072B2     2.66:1          2.45:1         4.95:1          5.51:1
     2 orange  #E69F00 / #B87F00     2.15:1          2.06:1         3.30:1          6.81:1
     3 slate   #A5AAB1 / #7D848E     2.23:1          2.05:1         3.60:1          6.56:1
     4 sky     #56B4E9 / #4590BA     2.20:1          2.08:1         3.37:1          6.64:1
     5 purple  #D99ABD / #B86D96     2.15:1          1.98:1         3.54:1          6.80:1
   A colour here still names a group and nothing else: within a group every range is the same
   colour, so none says one medication is better than another.

   BLACK AND WHITE. Groups 1 to 3 print at three different greys (L* 46, 71, 27), which is why
   group 3 is dark slate and not a mid grey. Groups 4 and 5 print close to 2 and 3; there the
   "Group N" label and the print edge style below tell them apart.

   ONLY A NUMBERED GROUP. optimizer.js and history-rendered.js write data-group only when the
   run has groups, and every selector is class-qualified, so an ungrouped run and the placebo
   reference stay uncoloured. */
.res-group[data-group="1"], .res-ov-group[data-group="1"], .tier-group[data-group="1"] { --petra-g: #0072B2; --petra-g-tint: #E8F2F9; --petra-g-band: #59A3CD; --petra-g-band-edge: #0072B2; }
.res-group[data-group="2"], .res-ov-group[data-group="2"], .tier-group[data-group="2"] { --petra-g: #E69F00; --petra-g-tint: #FDF4E1; --petra-g-band: #E69F00; --petra-g-band-edge: #B87F00; }
.res-group[data-group="3"], .res-ov-group[data-group="3"], .tier-group[data-group="3"] { --petra-g: #374151; --petra-g-tint: #EEF0F3; --petra-g-band: #A5AAB1; --petra-g-band-edge: #7D848E; }
.res-group[data-group="4"], .res-ov-group[data-group="4"], .tier-group[data-group="4"] { --petra-g: #56B4E9; --petra-g-tint: #EAF5FC; --petra-g-band: #56B4E9; --petra-g-band-edge: #4590BA; }
.res-group[data-group="5"], .res-ov-group[data-group="5"], .tier-group[data-group="5"] { --petra-g: #CC79A7; --petra-g-tint: #F8EDF3; --petra-g-band: #D99ABD; --petra-g-band-edge: #B86D96; }

/* The detail blocks and the record sheet: the whole group on its tint. NO COLOURED EDGE ON THE
   SCREEN since 2026-10-11, here as on the overview below (Corentin, on a saved result: "tu peux
   éviter les rounded borders ?"). The tint and the pill say which group a block is. Paper keeps
   the edge (PRINT, below). */
.res-group[data-group],
.tier-group[data-group] {
  background: var(--petra-g-tint);
  border-radius: 12px;
  padding: 12px 14px 14px;
  margin-bottom: 14px;
}
.res-group[data-group] .res-group-head,
.tier-group[data-group] .tier-label-bar { border-bottom-color: rgba(15, 39, 57, 0.12); }
.res-group[data-group] .res-group-count,
.res-group[data-group] .res-group-desc,
.tier-group[data-group] .tier-label-bar,
.tier-group[data-group] .tier-desc { color: var(--petra-ink-2); }

/* The overview, one size down. NO COLOURED EDGE ON THE SCREEN since 2026-10-11 (Corentin): the
   tint and the pill already say which group a block is, and the edge drew a heavy rounded bar
   down the side of the chart. Paper keeps it (PRINT, below). */
.res-ov-group[data-group] {
  background: var(--petra-g-tint);
  border-radius: 10px;
  padding: 9px 12px 10px;
  margin-bottom: 10px;
}
.res-ov-group[data-group] .res-ov-group-head { border-bottom-color: rgba(15, 39, 57, 0.10); }
.res-ov-group[data-group] .res-ov-group-note { color: var(--petra-ink-2); }
/* The range in the hue of its group, darker than its ground, and the score in ink (THE RANGE ON
   THE OVERVIEW, above). */
.res-ov-group[data-group] .res-ov-band { background: var(--petra-g-band); border-color: var(--petra-g-band-edge); }
.res-ov-group[data-group] .res-ov-pt { background: var(--petra-ink); }
/* A saved result draws its range the same way, on the record sheet and on the results of a child.
   It was the same pale blue in every group, on the orange and on the slate ground too. */
.tier-group[data-group] .med-ci-range { background: var(--petra-g-band); border-color: var(--petra-g-band-edge); }
.tier-group[data-group] .med-ci-point { background: var(--petra-ink); }

/* The pills: the header pill, the repeat on each card, and the record-sheet badge. */
.res-pill-group {
  font-weight: 700;
  letter-spacing: 0.01em;
}
.res-pill-group[data-group="1"], .tier-label-bar .tier-badge[data-group="1"] { background: #0072B2; border-color: #0072B2; color: #FFFFFF; }
.res-pill-group[data-group="2"], .tier-label-bar .tier-badge[data-group="2"] { background: #E69F00; border-color: #E69F00; color: var(--petra-ink); }
.res-pill-group[data-group="3"], .tier-label-bar .tier-badge[data-group="3"] { background: #374151; border-color: #374151; color: #FFFFFF; }
.res-pill-group[data-group="4"], .tier-label-bar .tier-badge[data-group="4"] { background: #56B4E9; border-color: #56B4E9; color: var(--petra-ink); }
.res-pill-group[data-group="5"], .tier-label-bar .tier-badge[data-group="5"] { background: #CC79A7; border-color: #CC79A7; color: var(--petra-ink); }

/* The card repeat is the same colour one size down, so a card read on its own still says
   which group it is in. */
.res-pill-card.res-pill-group { font-size: 10.5px; padding: 2px 9px; }

/* PRINT. A browser drops backgrounds when printing unless told otherwise, which turned the
   white-on-colour pills into white text on white paper. The group blocks and pills keep their
   colours, and each group's left edge takes its own line style, so the blocks stay apart on a
   black-and-white printer even where two colours print as the same grey. */
@media print {
  .res-group[data-group], .res-ov-group[data-group], .tier-group[data-group],
  .res-pill-group[data-group], .tier-label-bar .tier-badge[data-group] {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* No block of a group has a left edge on the screen since 2026-10-11. Paper keeps it, for the
     line styles below. */
  .res-group[data-group], .tier-group[data-group] { border-left: 5px solid var(--petra-g); }
  .res-ov-group[data-group] { border-left: 4px solid var(--petra-g); }
  .res-group[data-group="2"], .res-ov-group[data-group="2"], .tier-group[data-group="2"] { border-left-style: dashed; }
  .res-group[data-group="3"], .res-ov-group[data-group="3"], .tier-group[data-group="3"] { border-left-style: dotted; }
  .res-group[data-group="4"], .res-ov-group[data-group="4"], .tier-group[data-group="4"] { border-left-style: double; border-left-width: 6px; }
  .res-group[data-group="5"], .res-ov-group[data-group="5"], .tier-group[data-group="5"] { border-left-width: 2px; }
}

/* ==========================================================================================
   THE TWO EXPLANATIONS OF THE OVERVIEW, BEHIND A QUESTION MARK — 2026-10-11
   ========================================================================================== */

/* Corentin, on a screenshot of the results: the explanation of the groups ("Read this first")
   and the note on the range ("About this particular run") stood above the ranking and pushed
   the chart down the screen. Each now opens from a "?" in the heading of the Overview, beside
   the words it explains, and is closed on arrival (optimizer.js, helpButton and helpPanel). The
   sentences are unchanged.

   THE BUTTON is 24px each way, the smallest target a finger is given (WCAG 2.5.8). It is quiet:
   a mark in ink-3, which takes the theme colour on a light disc when it is open or pointed at,
   and a ring of the theme colour when the keyboard reaches it. THE EXPLANATION takes the lead
   and body type of the run panel, on the band ground. */
.res-ov-head { align-items: center; }
.res-ov-title, .res-ov-scale { display: inline-flex; align-items: center; gap: 4px; }
.res-help-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  padding: 0;
  background: none;
  border: none;
  border-radius: 50%;
  color: var(--petra-ink-3);
  cursor: pointer;
}
.res-help-btn[aria-expanded="true"] { background: var(--petra-brand-100); color: var(--petra-brand); }
/* Pointed at, on a screen that has a pointer. A tap leaves :hover on a button, so on a phone a "?"
   that had just been closed stayed drawn as open (review of the change, finding 3). */
@media (hover: hover) {
  .res-help-btn:hover { background: var(--petra-brand-100); color: var(--petra-brand); }
}
.res-help-btn:focus-visible { outline: 2px solid var(--petra-brand); outline-offset: 1px; }
.res-help {
  background: var(--petra-band);
  border: 1px solid var(--petra-line-soft);
  border-radius: 10px;
  padding: 11px 14px 12px;
  margin: 0 0 12px;
}
.res-help .res-run-body { max-width: 920px; }

/* PRINT. Paper cannot be asked, so a printed page shows both explanations and no button.
   !important because Bootstrap hides [hidden] with it. */
@media print {
  .res-help[hidden] { display: block !important; }
  .res-help-btn { display: none; }
}

/* The way out of the refusal panel. It names the values to correct and now carries the link
   to the form that holds them. Secondary weight, because the panel is a stop and not a
   prompt — .petra-edit-btn is the app secondary of record and this only adds the spacing
   the panel needs around it. */
.results-blocked-act {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  padding: 7px 13px;
  border: 1px solid var(--petra-line);
  border-radius: 8px;
  background: #FFFFFF;
  color: var(--petra-brand);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
}
button.results-blocked-act {
  font-family: inherit;
  line-height: 1.2;
  cursor: pointer;
}
.results-blocked-act:hover,
.results-blocked-act:focus-visible {
  background: var(--petra-brand-050);
  border-color: var(--petra-brand-300);
  color: var(--petra-brand-800);
}

/* ==========================================================================================
   A CRITERION THAT CANNOT DISCRIMINATE — explicit state (2026-09-26)
   ==========================================================================================

   D40 and Corentin, 12 September 2026. When the best and the worst medication are closer than
   the smallest difference that counts for this child, the row stops taking points. It STAYS on
   the screen: a row that disappeared would change what a family sees depending on which arm they
   are in, and the two arms have to differ in personalisation and in nothing else.

   The status is written out, with a border and background as additional cues. Text stays dark.
   The point controls and empty meter give way to the explanation; their native disabled state
   and the allocation guard remain in place. No warning colour or clinical safety judgement. */
.pri-rows .pri-ae-row.inactive {
  margin-top: 8px;
  margin-bottom: 8px;
  padding: 12px 14px;
  background: #F1F5F9;
  border: 1px solid #CCD7E2;
  border-left: 3px solid #7B8FA3;
  border-radius: 8px;
}
.pri-grid > .pri-ae-row.inactive:nth-child(2n + 1) { margin-right: 12px; }
.pri-grid > .pri-ae-row.inactive:nth-child(2n) { margin-left: 12px; }
.pri-ae-row.inactive .pri-ae-row-top { flex-wrap: wrap; gap: 8px 12px; }
.pri-ae-row.inactive .pri-ae-name { color: var(--petra-ink); font-weight: 600; }
.pri-ae-row.inactive .pri-right,
.pri-ae-row.inactive .pri-pip-row,
.pri-ae-row.inactive .pri-chip-note { display: none; }
.pri-inactive-label { display: none; }
.pri-ae-row.inactive .pri-inactive-label {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid #C4D0DC;
  border-radius: 5px;
  background: #FFFFFF;
  color: #33465A;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
  white-space: nowrap;
}
.pri-inactive-label::before { content: '\2013'; font-weight: 700; }
.pri-ae-note {
  margin: 8px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #40566D;
}
.pri-ae-note[hidden] { display: none; }
@media (max-width: 600px) {
  .pri-grid > .pri-ae-row.inactive:nth-child(2n),
  .pri-grid > .pri-ae-row.inactive:nth-child(2n + 1) { margin-left: 0; margin-right: 0; }
  .pri-row-efficacy .pri-ae-row-top { flex-wrap: wrap; gap: 8px; }
  .pri-row-efficacy .pri-ae-row-top .pri-ae-name { flex: 1 0 100%; }
  .pri-row-efficacy .pri-chip-note { margin-right: 0; padding: 2px 6px; font-size: 11px; }
  .pri-row-efficacy .pri-right { margin-left: auto; }
}

/* ---- The two dashboards take the width of the screen, and no chip is ever cut (2026-09-28) ----
   Corentin, looking at the team dashboard on the preview: the table cut words ("regarde ERREUR")
   and there was no reason for it to be so narrow. Both were true, and the second caused the first.

   THE PAGE WAS 960 PIXELS WIDE ON ANY SCREEN. .container-medium caps it, and the navbar with it
   (styles.css:360 and :385). Ten columns do not fit the 934 pixels left for the table, so the
   coordinator table took a minimum width of 1180 and scrolled sideways inside its pane, on a
   laptop and on a 1920-pixel screen alike, with names and addresses cut to "GOSLI..." either way.

   THE ERROR CHIP WAS CUT BY ITS OWN SHAPE. table-layout is fixed and the widths were percentages,
   so Errors was 77 pixels, 53 inside its padding. .cell-chip is max-width:100% (the 2026-08-30 note
   above), so the chip shrank to 53 while its icon and its word needed 63: the last letters ran past
   the dark amber fill, white on a white row, and the chip read "Erro". The same on the clinician
   dashboard, at 75 pixels. Measured in Chrome inside the platform frame.

   WHAT CHANGES.
   - The two dashboards carry page-wide on their root, and the page and its navbar may grow to
     1440 pixels. Every other page keeps 960.
   - The family address moves under the name, in the first column, the way the clinician column
     already stacks the clinician over the access chip (patients.js, petraNameCell). One column
     fewer: nine for the coordinator, seven for an assistant and for a clinician.
   - Every column but the first has a width in pixels that holds its content: each chip whole with
     a few pixels to spare, the date on one line, the buttons of a row side by side. The first
     column takes what is left, so a wider screen goes to names and addresses, and a long one still
     ends in "..." with the whole of it on hover.
   - A chip never shrinks here (max-width:none). Were a column ever too narrow, the chip would stay
     whole and the table would scroll, rather than lose its word.
   - Each table has a minimum width. The coordinator table fits without scrolling from a window
     about 1200 pixels wide, the others from about 950. Below that the table scrolls sideways
     inside its panel.
   The widths come from audits/pre-upload-2026-09-28/probe_dashboard_table.py, which renders both
   dashboards in Chrome inside the platform frame and lists every word that is cut.
   ============================================ */
.page-wide .app-navbar-inner,
.page-wide .container-medium { max-width: 1440px; }

.patients-table .name-stack {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.patients-table .name-stack .patient-name,
.patients-table .name-stack .patient-email {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.3;
}

.patients-table .cell-chip { max-width: none; }

/* The children on the team dashboard: name, trial ID, clinician, registered, baseline, before
   visit, then for the coordinator the number of saved results, then the buttons of the row.
   Errors and Concerns left the coordinator table on 2026-10-11: nothing could fill them since
   the family page went. */
.patients-table--team { min-width: 920px; }
.patients-table--team th:nth-child(1), .patients-table--team td:nth-child(1) { width: auto; }
.patients-table--team th:nth-child(2), .patients-table--team td:nth-child(2) { width: 92px; }
.patients-table--team th:nth-child(3), .patients-table--team td:nth-child(3) { width: 136px; }
.patients-table--team th:nth-child(4), .patients-table--team td:nth-child(4) { width: 108px; }
.patients-table--team th:nth-child(5), .patients-table--team td:nth-child(5) { width: 128px; }
.patients-table--team th:nth-child(6), .patients-table--team td:nth-child(6) { width: 116px; }
.patients-table--team th:nth-child(7), .patients-table--team td:nth-child(7) { width: 164px; }
.patients-table--team.is-coordinator { min-width: 1090px; }
.patients-table--team.is-coordinator th:nth-child(1), .patients-table--team.is-coordinator td:nth-child(1) { width: auto; }
.patients-table--team.is-coordinator th:nth-child(2), .patients-table--team.is-coordinator td:nth-child(2) { width: 92px; }
.patients-table--team.is-coordinator th:nth-child(3), .patients-table--team.is-coordinator td:nth-child(3) { width: 136px; }
.patients-table--team.is-coordinator th:nth-child(4), .patients-table--team.is-coordinator td:nth-child(4) { width: 108px; }
.patients-table--team.is-coordinator th:nth-child(5), .patients-table--team.is-coordinator td:nth-child(5) { width: 128px; }
.patients-table--team.is-coordinator th:nth-child(6), .patients-table--team.is-coordinator td:nth-child(6) { width: 116px; }
.patients-table--team.is-coordinator th:nth-child(7), .patients-table--team.is-coordinator td:nth-child(7) { width: 128px; }
.patients-table--team.is-coordinator th:nth-child(8), .patients-table--team.is-coordinator td:nth-child(8) { width: 212px; }
/* The assistants tab keeps its percentages, and scrolls below the width where "Registers participants"
   still fits its heading. */
.patients-table--ras { min-width: 1100px; }

/* A clinician's own children: name, registered, baseline, before visit, the number of saved
   results, buttons (errors and concerns left on 2026-10-11). The panel clips what overflows it
   (.petra-surface), so the list scrolls inside it instead. */
.patients-section > #patients { overflow-x: auto; }
.patients-table--patients { min-width: 830px; }
.patients-table--patients th:nth-child(1), .patients-table--patients td:nth-child(1) { width: auto; }
.patients-table--patients th:nth-child(2), .patients-table--patients td:nth-child(2) { width: 108px; }
.patients-table--patients th:nth-child(3), .patients-table--patients td:nth-child(3) { width: 128px; }
.patients-table--patients th:nth-child(4), .patients-table--patients td:nth-child(4) { width: 116px; }
.patients-table--patients th:nth-child(5), .patients-table--patients td:nth-child(5) { width: 128px; }
.patients-table--patients th:nth-child(6), .patients-table--patients td:nth-child(6) { width: 180px; }
/* The number of saved results: a figure, in ink, that lines up down the column. Under it, for a
   child who arrived by a move, the small line "with you" (.patient-email, as under a date). */
.patients-table .cell-count { font-weight: 700; color: var(--petra-ink); font-variant-numeric: tabular-nums; }

/* The access line on the landing page names the trial manager with an email link since
   2026-10-06 (Samuele, 4 October). Brand, like the coordinator link under it. */
.landing-note-main a { color: var(--petra-brand); font-weight: 600; text-decoration: none; }
.landing-note-main a:hover,
.landing-note-main a:focus-visible { text-decoration: underline; }

/* ==========================================================================================
   THE FAMILY EXAMPLE, HOME (patient_demo_home.html) - 10 October 2026
   audits/family-example-home-design-2026-10-10/

   Corentin: the page was all text, in boxes. It now SHOWS what it used to describe. Everything
   here is under .demo-home, so no other page is touched, and it comes last in the file, so it
   wins over the shared rules by order.

   THE FIRST SCREEN. From 992px the title, the one link and its note sit on the left, and on the
   right a card holds the three screens of the example drawn small: the record of the child, the
   20 points, the medications in their groups. It is the launch panel's "1 2 3" turned into what
   the three numbers stand for. Narrower, the card goes under the text. The card has the bar of
   the navbar and the offset sage plate of the landing page (#A0C8B8 in the artwork), so the two
   public pages are one family.

   THE DRAWINGS ARE CSS, NOT IMAGES, so there is no file to upload and nothing to go soft on a
   large screen. A row of dots is one repeated gradient, sized by --n and filled up to --on. A
   range is a track with its band (::before, --l and --w) and its mark (::after, --m). The group
   colours are those of the results screen (.res-ov-group, #0072B2 and #E69F00). Since 2026-10-11
   the drawing follows that screen in two more things: a group has no coloured edge, and a range
   is in the colour of its group (#59A3CD and #E69F00) with its mark in ink.

   WHAT HAPPENS, AND WHEN is a line in one panel: three moments on one row from 992px, down a
   rail below that, the three drawn alike (its own note, further down).

   Text on the page ground is ink-2, never ink-3, which is 4.10:1 there. No web font and no
   animation, like the landing page.
   ========================================================================================== */
.demo-home {
  --demo-sage-1: #DCEDE6;
  --demo-sage-2: #BCDACD;
  --demo-g1: #0072B2;
  --demo-g1-tint: #E8F2F9;
  --demo-g2: #E69F00;
  --demo-g2-tint: #FDF4E1;
  --demo-dot: 8px;
}
.demo-home > .alert { margin-bottom: 0; }

/* ---- The first screen ---- */
.demo-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  margin: 24px 0 52px;
}
.demo-hero-title {
  margin: 0 0 14px;
  font-size: 40px;
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.025em;
  color: var(--petra-ink);
}
.demo-hero-title span { color: var(--petra-brand); }
.demo-hero-lead {
  max-width: 34em;
  margin: 0 0 26px;
  font-size: 17px;
  line-height: 1.6;
  color: var(--petra-ink-2);
}
.demo-hero-lead strong { font-weight: 700; color: var(--petra-ink); }
.demo-hero .petra-launch-cta {
  padding: 15px 26px;
  border-radius: 10px;
  font-size: 16px;
  box-shadow: 0 12px 24px -12px rgba(23, 63, 102, 0.6);
}
.demo-hero .petra-launch-cta svg { width: 16px; height: 16px; }
.demo-hero-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  max-width: 30em;
  margin: 16px 0 0;
  font-size: 14px;
  line-height: 1.5;
  color: var(--petra-ink-2);
}
.demo-hero-note svg { flex: 0 0 auto; margin-top: 2px; color: var(--petra-brand); }

/* ---- The card of the three screens ---- */
.demo-figure { margin: 0; }
.demo-board {
  position: relative;
  isolation: isolate;
  padding: 0 16px 16px 0;
}
.demo-board::before {
  content: "";
  position: absolute;
  inset: 16px 0 0 16px;
  z-index: -1;
  border-radius: 22px;
  background: linear-gradient(140deg, var(--demo-sage-1) 0%, var(--demo-sage-2) 100%);
}
.demo-board-card {
  overflow: hidden;
  border: 1px solid var(--petra-line);
  border-radius: 20px;
  background: var(--petra-brand-050);
  box-shadow: 0 28px 56px -30px rgba(23, 63, 102, 0.42), 0 2px 6px rgba(15, 39, 57, 0.06);
}
.demo-board-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: var(--petra-brand-800);
  color: #FFFFFF;
}
.demo-board-name { font-size: 13px; font-weight: 600; letter-spacing: 0.01em; }
.demo-board-tag {
  flex: 0 0 auto;
  padding: 2px 9px;
  border-radius: 999px;
  background: #FFF3CD;
  color: #664D03;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.demo-screens {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 12px;
  list-style: none;
}
.demo-screen {
  padding: 10px 12px 11px;
  border: 1px solid var(--petra-line-soft);
  border-radius: 12px;
  background: #FFFFFF;
  box-shadow: var(--petra-shadow);
}
.demo-screen--wide { grid-column: 1 / -1; }
.demo-screen-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  font-size: 14px;
  font-weight: 700;
  color: var(--petra-ink);
}
.demo-screen-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--petra-brand);
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 700;
}

/* 1, the record: four of its cells. */
.demo-cells {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 9px 10px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--petra-ink);
}
.demo-cells span {
  display: block;
  margin-bottom: 2px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--petra-ink-3);
}

/* 2, the points: the 20 dots, and three outcomes with theirs. */
.demo-dots {
  position: relative;
  display: block;
  flex: 0 0 auto;
  width: calc(var(--n) * var(--demo-dot));
  height: 7px;
  background: radial-gradient(circle at 3.5px 3.5px, #D5DDE7 0, #D5DDE7 3px, transparent 3.4px) 0 0 / var(--demo-dot) 7px repeat-x;
}
.demo-dots::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: calc(var(--on) * var(--demo-dot));
  background: radial-gradient(circle at 3.5px 3.5px, var(--petra-brand) 0, var(--petra-brand) 3px, transparent 3.4px) 0 0 / var(--demo-dot) 7px repeat-x;
}
.demo-dots--all { --n: 20; --on: 12; }
.demo-dots--7 { --n: 7; --on: 7; }
.demo-dots--3 { --n: 3; --on: 3; }
.demo-dots--2 { --n: 2; --on: 2; }
.demo-points-all {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--petra-hair);
}
.demo-points-used { font-size: 10.5px; font-weight: 600; color: var(--petra-ink-3); }
.demo-points-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  line-height: 1.2;
  color: var(--petra-ink-2);
}
.demo-points-row + .demo-points-row { margin-top: 7px; }

/* 3, the results: the two groups, each medication with its range and its mark. The two groups stand
   side by side, in boxes of one height, so the card is no taller than the text beside it (the
   sentence that stood under the lead left the page on 10 October). On a phone they stack. */
.demo-results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.demo-grp {
  padding: 8px 10px 9px;
  border-radius: 8px;
  background: var(--demo-g-tint);
}
.demo-grp--1 { --demo-g: var(--demo-g1); --demo-g-tint: var(--demo-g1-tint); --demo-g-band: #59A3CD; }
.demo-grp--2 { --demo-g: var(--demo-g2); --demo-g-tint: var(--demo-g2-tint); --demo-g-band: #E69F00; }
.demo-grp-chip {
  display: inline-block;
  margin-bottom: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--demo-g);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
}
.demo-grp--2 .demo-grp-chip { color: #3B2A00; }
.demo-med {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--petra-ink-2);
}
.demo-med + .demo-med { margin-top: 6px; }
.demo-range {
  position: relative;
  display: block;
  height: 8px;
  border-radius: 4px;
  background: #FFFFFF;
  box-shadow: inset 0 0 0 1px rgba(15, 39, 57, 0.07);
}
.demo-range::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--l);
  width: var(--w);
  border-radius: 4px;
  background: var(--demo-g-band);
}
.demo-range::after {
  content: "";
  position: absolute;
  top: -2px;
  bottom: -2px;
  left: var(--m);
  width: 3px;
  margin-left: -1.5px;
  border-radius: 2px;
  background: var(--petra-ink);
}
.demo-range--b { --l: 55%; --w: 24%; --m: 69%; }
.demo-range--a { --l: 56%; --w: 25%; --m: 68%; }
.demo-range--e { --l: 43%; --w: 26%; --m: 58.5%; }
.demo-range--c { --l: 45%; --w: 26%; --m: 58%; }
.demo-range--d { --l: 33%; --w: 32%; --m: 50%; }

/* ---- What happens, and when ----
   ONE PANEL, and the three moments drawn alike (Corentin, 10 October, on the first version: the
   columns were of three widths, the cards of three heights, and the middle one was dark, so it
   read as the one selected). Three equal columns from 992px under one line, with the same mark
   on each. The sentences are the rows of ONE grid shared by the three columns (subgrid), so the
   first sentences start level and so do the second ones. A browser without subgrid stacks them
   in each column, which is the same page a little less level. Below 992px the line runs down
   the left. */
.demo-h2 {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.015em;
  color: var(--petra-ink);
}
.demo-when {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0 0 12px;
  padding: 26px 22px 8px;
  list-style: none;
  border: 1px solid var(--petra-line);
  border-radius: 18px;
  background: #FFFFFF;
  box-shadow: var(--petra-shadow);
}
.demo-stage { position: relative; padding: 0 0 12px 34px; }
/* The line, from this mark to the next. After the last mark it fades: the visits go on. */
.demo-stage::before {
  content: "";
  position: absolute;
  top: 12px;
  bottom: -12px;
  left: 7px;
  width: 2px;
  background: var(--petra-brand-200);
}
.demo-stage:last-child::before {
  bottom: 12px;
  background: linear-gradient(180deg, var(--petra-brand-200), rgba(194, 217, 236, 0));
}
/* The mark, the same on the three. */
.demo-stage::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 0;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--petra-brand);
  box-shadow: 0 0 0 4px #FFFFFF, 0 0 0 5px var(--petra-brand-200);
}
.demo-stage-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
  line-height: 24px;
  color: var(--petra-ink);
}
.demo-stage-item {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  padding-bottom: 16px;
}
.demo-stage-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--petra-brand-100);
  border-radius: 10px;
  background: var(--petra-brand-050);
  color: var(--petra-brand);
}
.demo-stage-item p { margin: 0; padding-top: 5px; font-size: 15px; line-height: 1.55; color: var(--petra-ink-2); }

@media (min-width: 992px) {
  .demo-hero { grid-template-columns: minmax(0, 10fr) minmax(0, 11fr); gap: 48px; margin: 32px 0 60px; }
  .demo-hero-title { font-size: 54px; }
  .demo-hero-lead { font-size: 18px; }
  .demo-h2 { font-size: 28px; }
  /* The line turns: across the top of the panel, one mark at the head of each column. */
  .demo-when {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: auto auto auto;
    column-gap: 32px;
    padding: 30px 30px 14px;
  }
  .demo-stage { padding: 40px 0 0; }
  .demo-stage::before { top: 7px; right: -32px; bottom: auto; left: 0; width: auto; height: 2px; }
  .demo-stage:last-child::before {
    right: 0;
    bottom: auto;
    background: linear-gradient(90deg, var(--petra-brand-200), rgba(194, 217, 236, 0));
  }
  .demo-stage::after { top: 0; }
  @supports (grid-template-rows: subgrid) {
    .demo-stage { display: grid; grid-row: span 3; grid-template-rows: subgrid; }
  }
}

@media (max-width: 575.98px) {
  .demo-hero-title { font-size: 36px; }
  .demo-hero .petra-launch-cta { display: flex; width: 100%; }
  .demo-screens { grid-template-columns: minmax(0, 1fr); }
  .demo-results { grid-template-columns: minmax(0, 1fr); }
  .demo-board { padding: 0 12px 12px 0; }
  .demo-board::before { inset: 12px 0 0 12px; }
  .demo-when { padding: 22px 16px 6px; }
}
