:root {
  --teal: #0F6E56;
  --sage: #5DCAA5;
  --bg: #F9F8F5;
  --text: #1C1C1A;
  --muted: #6B6B66;
  --border: #E2E0D8;
  --red: #D85A30;
  --red-bg: #FAECE7;
  --red-text: #712B13;
  --amber: #EF9F27;
  --amber-bg: #FAEEDA;
  --amber-text: #633806;
  --green-bg: #EAF3DE;
  --green-text: #27500A;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}

#app { max-width: 480px; margin: 0 auto; min-height: 100vh; }

.header {
  background: var(--teal);
  padding: 1.25rem 1rem 1rem;
  color: #fff;
}
.header h1 { font-size: 19px; margin: 0 0 2px; font-weight: 600; }
.header p { font-size: 12px; color: var(--sage); margin: 0; }

.section-label {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: var(--muted);
  text-transform: uppercase;
  padding: 0.9rem 1rem 0.5rem;
  margin: 0;
}

.card-list { padding: 0 1rem; display: flex; flex-direction: column; gap: 10px; }

.card {
  background: #fff;
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
}
.card.overdue { border-left: 3px solid var(--red); border-radius: 0 12px 12px 0; }
.card-title { font-size: 15px; font-weight: 500; margin: 0 0 3px; }
.card-sub { font-size: 12px; color: var(--muted); margin: 0; }

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge.on-track { background: var(--green-bg); color: var(--green-text); }
.badge.due-soon { background: var(--amber-bg); color: var(--amber-text); }
.badge.overdue { background: var(--red-bg); color: var(--red-text); }
.badge.green { background: var(--green-bg); color: var(--green-text); }
.badge.amber { background: var(--amber-bg); color: var(--amber-text); }
.badge.red { background: var(--red-bg); color: var(--red-text); }

.btn {
  display: block;
  width: 100%;
  background: var(--teal);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 13px;
  font-size: 15px;
  font-weight: 500;
  text-align: center;
  cursor: pointer;
}
.btn:disabled { opacity: 0.5; }
.btn.secondary {
  background: #fff;
  color: var(--teal);
  border: 0.5px solid var(--teal);
}
.btn-wrap { padding: 1rem; }

.field { padding: 0 1rem; margin-bottom: 1rem; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field input, .field select {
  width: 100%;
  padding: 12px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 1rem;
  background: #fff;
  border-bottom: 0.5px solid var(--border);
}
.topbar .back { font-size: 22px; color: var(--teal); cursor: pointer; }
.topbar h2 { font-size: 16px; margin: 0; }

.error-text { color: var(--red-text); font-size: 13px; padding: 0 1rem; margin: -0.5rem 0 1rem; }

.login-wrap {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 2rem 1.5rem;
}
.login-wrap h1 {
  font-family: 'Georgia', serif;
  color: var(--teal);
  text-align: center;
  margin-bottom: 2rem;
}

.loading { text-align: center; padding: 3rem 1rem; color: var(--muted); }

.progress-wrap { padding: 1rem; }
.progress-bar {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 20px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--teal);
  transition: width 0.2s ease;
}
.progress-label { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

.checklist-stage {
  padding: 0.9rem 1rem;
  border-top: 0.5px solid var(--border);
}
.checklist-stage-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px;
  display: flex;
  justify-content: space-between;
}
.checklist-stage-count { color: var(--muted); font-weight: 400; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
  cursor: pointer;
}
.checklist-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  accent-color: var(--teal);
}

.indicator-field {
  padding: 10px 0;
  border-bottom: 0.5px solid var(--border);
}
.indicator-label-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 6px;
}
.indicator-label-row label {
  font-size: 14px;
  font-weight: 500;
}
.indicator-prev {
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.indicator-field input {
  width: 100%;
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  font-size: 15px;
  background: #fff;
}

.indicator-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.indicator-input-row input { flex: 1; }
.clear-btn {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
}
.input-error { border-color: var(--red) !important; }
.field-error-text {
  color: var(--red-text);
  font-size: 12px;
  margin: 4px 0 0;
}

.notes-textarea {
  width: 100%;
  min-height: 100px;
  padding: 10px 12px;
  border: 0.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  resize: vertical;
}

.checklist-stage-title .badge { margin-left: 8px; vertical-align: middle; }

.legal-text {
  font-size: 11px;
  color: var(--muted);
  padding: 1rem;
  line-height: 1.5;
  border-top: 0.5px solid var(--border);
  margin-top: 1rem;
}

.reference-item {
  background: #fff;
  border: 0.5px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
}
.reference-name { font-size: 14px; font-weight: 600; margin: 0 0 2px; }
.reference-meta { font-size: 12px; color: var(--muted); margin: 0; }
.reference-threshold { font-size: 12px; color: var(--muted); margin: 4px 0 0; font-style: italic; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  #app { max-width: none; }
}

/* ================================================================
   WELLBEING REPORT — PRINT-DOCUMENT LAYOUT
   ================================================================
   This is a self-contained document design (not a stretched phone
   screen) matching the Everwell Wellbeing Report reference PDF.
   Every class here is prefixed "rp-" so it never collides with the
   mobile app styles above. It applies whenever the report view is
   open (state.view === 'visitReport' toggles body.report-mode),
   both on screen and in the printed/exported PDF — so what the
   assessor reviews before printing already looks like the finished
   document, not a mobile checklist stretched wide.
   ================================================================ */

body.report-mode {
  background: #EAE8E0;
}
body.report-mode #app {
  max-width: 968px;
}

.rp-sheet {
  --rp-teal: #0F6E56;
  --rp-teal-dark: #0A4F3E;
  --rp-teal-mid: #1D9E75;
  --rp-sage: #5DCAA5;
  --rp-cream: #F9F8F5;
  --rp-panel: #FFFFFF;
  --rp-ink: #1C1C1A;
  --rp-ink-muted: #5B5B56;
  --rp-border: #E2E0D8;

  --rp-stable: #0F6E56;
  --rp-stable-bg: #E7F3EE;
  --rp-stable-text: #0A4F3E;

  --rp-improved: #1D7A57;
  --rp-improved-bg: #E4F2E8;
  --rp-improved-text: #155C40;

  --rp-monitor: #A66A12;
  --rp-monitor-bg: #FBF0DC;
  --rp-monitor-text: #7A4E0C;

  --rp-action: #B14332;
  --rp-action-bg: #FBEAE6;
  --rp-action-text: #8A3324;

  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--rp-ink);
  background: var(--rp-cream);
  margin: 24px auto;
  max-width: 920px;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.10);
}
.rp-sheet h1, .rp-sheet h2, .rp-sheet h3 {
  font-family: 'DM Serif Display', Georgia, serif;
  font-weight: 400;
  margin: 0;
}

/* ---------- masthead ---------- */
.rp-masthead {
  background: var(--rp-teal-dark);
  color: #fff;
  padding: 22px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.rp-brand { display: flex; align-items: center; }
.rp-brand-mark {
  width: 32px; height: 32px; border-radius: 8px; background: var(--rp-sage);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: 'DM Serif Display', serif; color: var(--rp-teal-dark); font-size: 17px;
  margin-right: 12px; flex-shrink: 0;
}
.rp-brand-name { font-size: 14px; letter-spacing: 0.03em; font-weight: 600; }
.rp-brand-tagline { font-size: 12px; color: #CFEBE0; font-style: italic; font-family: 'DM Serif Display', serif; }
.rp-masthead-right { font-size: 11.5px; color: #CFEBE0; text-align: right; line-height: 1.5; }

/* ---------- cover ---------- */
.rp-cover { padding: 28px 28px 6px; }
.rp-cover-top { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.rp-cover-top-left { flex: 1; min-width: 240px; }
.rp-cover-top-right { width: 230px; flex-shrink: 0; }

.rp-kicker {
  font-size: 12px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--rp-teal); margin: 0 0 6px;
}
.rp-client-name { font-size: 30px; color: var(--rp-ink); }
.rp-client-meta { margin-top: 10px; font-size: 13.5px; color: var(--rp-ink-muted); }
.rp-client-meta span { display: block; margin-bottom: 2px; }

.rp-overall-card {
  background: var(--rp-panel);
  border: 1px solid var(--rp-border);
  border-radius: 12px;
  padding: 14px 18px;
}
.rp-overall-card-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--rp-ink-muted); font-weight: 600; margin: 0; }
.rp-overall-card-headline { font-size: 17px; font-weight: 600; margin: 4px 0 0; color: var(--rp-ink); }
.rp-overall-card-sub { font-size: 12.5px; color: var(--rp-ink-muted); margin: 2px 0 0; }

/* ---------- rapid-scan domain strip ---------- */
.rp-scan-strip {
  margin: 22px 28px 0;
  background: var(--rp-panel);
  border: 1px solid var(--rp-border);
  border-radius: 12px;
  padding: 16px 20px;
}
.rp-scan-strip-title { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--rp-ink-muted); margin: 0 0 10px; }
.rp-scan-row { display: flex; align-items: center; padding: 7px 0; border-top: 1px solid var(--rp-border); gap: 16px; flex-wrap: wrap; }
.rp-scan-row:first-of-type { border-top: none; }
.rp-scan-domain-name { width: 160px; flex-shrink: 0; font-size: 13px; font-weight: 600; color: var(--rp-ink); }
.rp-scan-dots { flex: 1; min-width: 160px; }
.rp-domain-bar { display: flex; width: 100%; height: 8px; border-radius: 4px; overflow: hidden; background: var(--rp-border); }
.rp-domain-bar > div { border-right: 1.5px solid var(--rp-panel); }
.rp-domain-bar > div:last-child { border-right: none; }
.rp-seg-stable { background: var(--rp-stable); }
.rp-seg-improved { background: var(--rp-improved); }
.rp-seg-monitor { background: var(--rp-monitor); }
.rp-seg-action { background: var(--rp-action); }
.rp-scan-caption { font-size: 11.5px; color: var(--rp-ink-muted); margin: 4px 0 0; }

/* ---------- stat dashboard ---------- */
.rp-dashboard {
  margin: 16px 28px 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.rp-stat-tile-wrap { flex: 1 1 0; min-width: 130px; }
.rp-stat-tile { border-radius: 12px; padding: 14px 12px; border: 1px solid var(--rp-border); }
.rp-stat-tile.t-stable { background: var(--rp-stable-bg); border-color: #CFE7DC; }
.rp-stat-tile.t-improved { background: var(--rp-improved-bg); border-color: #CBE6D4; }
.rp-stat-tile.t-monitor { background: var(--rp-monitor-bg); border-color: #F0DDAF; }
.rp-stat-tile.t-action { background: var(--rp-action-bg); border-color: #F0C9BE; }
.rp-stat-count { font-size: 26px; font-weight: 700; line-height: 1; }
.t-stable .rp-stat-count { color: var(--rp-stable-text); }
.t-improved .rp-stat-count { color: var(--rp-improved-text); }
.t-monitor .rp-stat-count { color: var(--rp-monitor-text); }
.t-action .rp-stat-count { color: var(--rp-action-text); }
.rp-stat-label { font-size: 12px; font-weight: 600; margin-top: 4px; }
.t-stable .rp-stat-label { color: var(--rp-stable-text); }
.t-improved .rp-stat-label { color: var(--rp-improved-text); }
.t-monitor .rp-stat-label { color: var(--rp-monitor-text); }
.t-action .rp-stat-label { color: var(--rp-action-text); }
.rp-stat-desc { font-size: 11px; color: var(--rp-ink-muted); margin-top: 3px; }

.rp-legend-note { margin: 10px 28px 0; font-size: 11.5px; color: var(--rp-ink-muted); line-height: 1.9; }
.rp-legend-note .li { display: inline-block; margin-right: 16px; }
.rp-legend-note .li b { font-weight: 700; }

/* ---------- narrative ---------- */
.rp-narrative {
  margin: 24px 28px 0;
  background: var(--rp-panel);
  border: 1px solid var(--rp-border);
  border-left: 4px solid var(--rp-teal);
  border-radius: 0 10px 10px 0;
  padding: 16px 20px;
}
.rp-narrative h2 { font-size: 16px; margin-bottom: 6px; color: var(--rp-ink); }
.rp-narrative .notes-textarea { font-size: 14px; }
.rp-narrative-print { display: none; font-size: 14px; color: var(--rp-ink); line-height: 1.6; margin: 0; }

/* ---------- section headings ---------- */
.rp-section-heading {
  margin: 30px 28px 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.rp-section-heading h2 { font-size: 19px; color: var(--rp-ink); }
.rp-count-pill {
  font-size: 11.5px; color: var(--rp-ink-muted); font-weight: 600;
  background: #EFEDE5; padding: 3px 10px; border-radius: 20px;
}

/* ---------- flags ---------- */
.rp-flag-card {
  margin: 0 28px 12px;
  background: var(--rp-panel);
  border: 1px solid var(--rp-border);
  border-left: 5px solid var(--rp-monitor);
  border-radius: 0 10px 10px 0;
  padding: 14px 18px;
}
.rp-flag-card.is-action { border-left-color: var(--rp-action); }
.rp-flag-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.rp-flag-title { font-size: 14.5px; font-weight: 700; color: var(--rp-ink); }
.rp-flag-body { font-size: 13.5px; color: var(--rp-ink-muted); margin: 0; line-height: 1.6; }
.rp-flag-next {
  margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--rp-teal-dark);
  background: var(--rp-stable-bg); padding: 8px 12px; border-radius: 8px;
}
.rp-flag-next strong { font-weight: 700; }

/* ---------- domain cards ---------- */
.rp-domain-card {
  margin: 0 28px 16px;
  background: var(--rp-panel);
  border: 1px solid var(--rp-border);
  border-radius: 12px;
  overflow: hidden;
}
.rp-domain-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 13px 18px; background: var(--rp-stable-bg); border-bottom: 1px solid var(--rp-border);
  flex-wrap: wrap;
}
.rp-domain-head h3 { font-size: 16px; color: var(--rp-teal-dark); }
.rp-domain-why { font-size: 12px; color: var(--rp-ink-muted); max-width: 520px; margin: 2px 0 0; }
.rp-domain-pill { font-size: 11.5px; font-weight: 600; color: var(--rp-teal-dark); white-space: nowrap; }

.rp-indicator-row {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  border-top: 1px solid var(--rp-border);
  gap: 14px;
  flex-wrap: wrap;
}
.rp-indicator-row:first-of-type { border-top: none; }
.rp-ind-name-col { flex: 1 1 220px; min-width: 180px; }
.rp-ind-values-col { flex: 0 0 130px; }
.rp-ind-spark-col { flex: 0 0 auto; }
.rp-ind-badge-col { flex: 0 0 auto; margin-left: auto; }
.rp-ind-name { font-size: 14px; font-weight: 600; color: var(--rp-ink); margin: 0; }
.rp-ind-method { font-size: 11px; color: var(--rp-ink-muted); margin: 2px 0 0; line-height: 1.4; }
.rp-ind-current { font-size: 16px; font-weight: 700; color: var(--rp-ink); margin: 0; }
.rp-ind-prev { font-size: 11px; color: var(--rp-ink-muted); margin: 2px 0 0; }

.rp-arrow { font-size: 12px; margin-left: 4px; }
.rp-arrow-up { color: var(--rp-improved-text); }
.rp-arrow-down { color: var(--rp-action-text); }
.rp-arrow-flat { color: var(--rp-ink-muted); }

.rp-badge {
  display: inline-flex; align-items: center;
  font-size: 11.5px; font-weight: 700; padding: 5px 10px; border-radius: 20px;
  white-space: nowrap;
}
.rp-badge.b-stable, .rp-badge.b-improved { background: var(--rp-stable-bg); color: var(--rp-stable-text); }
.rp-badge.b-monitor { background: var(--rp-monitor-bg); color: var(--rp-monitor-text); }
.rp-badge.b-action { background: var(--rp-action-bg); color: var(--rp-action-text); }

/* ---------- trend table ---------- */
.rp-trend-wrap {
  margin: 0 28px 16px;
  background: var(--rp-panel);
  border: 1px solid var(--rp-border);
  border-radius: 12px;
  padding: 18px;
  overflow-x: auto;
}
table.rp-trend-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.rp-trend-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--rp-ink-muted); font-weight: 600; padding: 8px 10px; border-bottom: 2px solid var(--rp-border);
  white-space: nowrap;
}
table.rp-trend-table td { padding: 9px 10px; border-bottom: 1px solid var(--rp-border); white-space: nowrap; }
table.rp-trend-table td.rp-trend-label { white-space: normal; font-weight: 500; color: var(--rp-ink); }
table.rp-trend-table td.rp-trend-val { font-weight: 600; }
table.rp-trend-table tr:last-child td { border-bottom: none; }
.rp-trend-date { color: var(--rp-ink-muted); font-weight: 400; font-size: 10.5px; }

/* ---------- footer contacts ---------- */
.rp-footer-grid { margin: 30px 28px 0; display: flex; gap: 12px; flex-wrap: wrap; }
.rp-footer-card-wrap { flex: 1 1 260px; min-width: 220px; }
.rp-footer-card { background: var(--rp-panel); border: 1px solid var(--rp-border); border-radius: 10px; padding: 14px 18px; }
.rp-footer-card h4 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--rp-ink-muted); font-weight: 700; margin: 0 0 8px; }
.rp-footer-row { display: flex; justify-content: space-between; font-size: 13px; padding: 3px 0; }
.rp-footer-row .k { color: var(--rp-ink-muted); }
.rp-footer-row .v { font-weight: 600; text-align: right; }

/* ---------- legal ---------- */
.rp-legal {
  margin: 26px 28px 34px;
  font-size: 11px; color: var(--rp-ink-muted); line-height: 1.6;
  border-top: 1px solid var(--rp-border); padding-top: 14px;
}

/* ---------- print ---------- */
@media print {
  /* Browsers strip background colours from printed/exported PDFs
     by default. This forces them to keep the report's colour —
     the teal masthead, the domain scan-strip bars, the stat tiles,
     and the badges — exactly as shown on screen. */
  .rp-sheet, .rp-sheet * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
    color-adjust: exact !important;
  }

  body.report-mode { background: #fff; }
  .rp-sheet { margin: 0; max-width: none; box-shadow: none; border-radius: 0; }
  .no-print-textarea { display: none !important; }
  .rp-narrative-print { display: block; }
  .rp-flag-card, .rp-domain-card, .rp-trend-wrap, .rp-dashboard, .rp-scan-strip, .rp-footer-card {
    page-break-inside: avoid;
  }
  .rp-indicator-row { page-break-inside: avoid; }
  .rp-domain-head { page-break-after: avoid; }
  .rp-section-heading { page-break-after: avoid; }
  .rp-narrative { page-break-inside: avoid; }
  @page { size: A4; margin: 12mm; }
}

@media (max-width: 700px) {
  .rp-cover-top { flex-direction: column; }
  .rp-cover-top-right { width: 100%; }
  .rp-dashboard { flex-wrap: wrap; }
  .rp-stat-tile-wrap { flex: 1 1 45%; }
}

/* ================================================================
   DESKTOP SHELL (sidebar + topbar)
   Applies to the Dashboard/People screen only, for now. Other
   screens (client detail, visit checklist, org admin, etc.) still
   use the narrow mobile layout via #app's default max-width — see
   body.shell-mode below for the one exception.
   ================================================================ */

body.shell-mode {
  background: #EAE8E0;
}
body.shell-mode #app {
  max-width: none;
}

.sh-shell {
  display: flex;
  min-height: 100vh;
}

.sh-sidenav {
  width: 230px;
  flex-shrink: 0;
  background: #0A4F3E;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 18px 0;
}
.sh-sidenav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 14px;
}
.sh-sidenav-mark {
  width: 28px; height: 28px; border-radius: 7px; background: var(--sage);
  display: flex; align-items: center; justify-content: center;
  font-family: Georgia, serif; color: #0A4F3E; font-size: 15px; flex-shrink: 0;
}
.sh-sidenav-brand-text { font-size: 13px; font-weight: 600; }
.sh-sidenav-org { font-size: 10.5px; color: #BFE4D6; margin-top: 1px; }
.sh-sidenav-item {
  display: block;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  color: #CFEBE0;
  border-left: 3px solid transparent;
  cursor: pointer;
}
.sh-sidenav-item:hover { background: rgba(255, 255, 255, 0.05); }
.sh-sidenav-item.active {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-left-color: var(--sage);
}
.sh-sidenav-footer {
  margin-top: auto;
  padding: 14px 18px 0;
  font-size: 11px;
  color: #7FB9A5;
}

.sh-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.sh-topbar {
  background: #fff;
  border-bottom: 1px solid var(--border);
  padding: 12px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}
.sh-topbar-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.sh-topbar-profile {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 10px 5px 5px; border-radius: 20px; border: 1px solid var(--border);
}
.sh-topbar-avatar {
  width: 24px; height: 24px; border-radius: 50%; background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 10px; font-weight: 700;
}
.sh-topbar-name { font-size: 12px; font-weight: 600; }
.sh-topbar-role { font-size: 10px; color: var(--muted); }

.sh-content { padding: 24px 26px 60px; flex: 1; }

.sh-page-header {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.sh-page-title { font-size: 24px; font-family: Georgia, serif; color: var(--text); }
.sh-page-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }

.sh-kpi-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.sh-kpi-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; }
.sh-kpi-value { font-size: 26px; font-weight: 700; color: var(--text); font-family: Georgia, serif; line-height: 1; }
.sh-kpi-label { font-size: 12px; color: var(--muted); margin-top: 6px; }
.sh-kpi-card.warn .sh-kpi-value { color: var(--amber-text); }
.sh-kpi-card.alert .sh-kpi-value { color: var(--red-text); }

.sh-table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.sh-table thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.05em; font-weight: 700;
  color: var(--muted); padding: 11px 16px; background: #F9F8F5; border-bottom: 1px solid var(--border);
}
.sh-table tbody tr { border-top: 1px solid var(--border); cursor: pointer; }
.sh-table tbody tr:hover { background: #FAFAF6; }
.sh-table td { padding: 12px 16px; font-size: 13px; vertical-align: middle; }
.sh-person-cell { display: flex; align-items: center; gap: 10px; }
.sh-person-avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; flex-shrink: 0;
}
.sh-person-name { font-weight: 600; color: var(--text); }
.sh-open-link { font-size: 12px; font-weight: 700; color: var(--teal); }

.sh-hamburger-btn {
  display: none;
  width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--border);
  background: #fff; align-items: center; justify-content: center; font-size: 18px;
  cursor: pointer; flex-shrink: 0;
}

.sh-nav-backdrop {
  display: none;
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); z-index: 40;
}
.sh-nav-backdrop.open { display: block; }

@media (max-width: 900px) {
  .sh-sidenav {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 50;
    transform: translateX(-100%);
    transition: transform 0.18s ease;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.2);
  }
  .sh-sidenav.open { transform: translateX(0); }
  .sh-hamburger-btn { display: inline-flex; }
  .sh-kpi-strip { grid-template-columns: repeat(2, 1fr); }
  .sh-content { padding: 18px 16px 60px; }
  .sh-table { font-size: 12px; }
  .sh-table thead th:nth-child(2), .sh-table td:nth-child(2) { display: none; } /* hide "Plan" column on small screens */
  .sh-two-col-grid { grid-template-columns: 1fr !important; }
}

.sh-two-col-grid { display: grid; }

.sh-filter-bar { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.sh-filter-chip {
  font-size: 12.5px; font-weight: 500; padding: 7px 13px; border-radius: 8px;
  border: 1px solid var(--border); background: #fff; color: var(--muted); cursor: pointer;
}
.sh-filter-chip.active { border-color: var(--teal); color: var(--teal); background: var(--green-bg); font-weight: 600; }

/* ---------------- Person Profile ---------------- */
.sh-hero-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; margin-bottom: 18px; display: flex; justify-content: space-between;
  align-items: flex-start; gap: 16px; flex-wrap: wrap;
}
.sh-hero-left { display: flex; gap: 14px; align-items: center; }
.sh-hero-avatar {
  width: 48px; height: 48px; border-radius: 50%; background: var(--teal); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 17px; font-weight: 700; flex-shrink: 0;
}
.sh-hero-name { font-size: 20px; font-family: Georgia, serif; color: var(--text); }
.sh-hero-meta { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.sh-hero-right { text-align: right; }
.sh-hero-status { font-size: 14px; font-weight: 600; }
.sh-hero-status-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.sh-tab-bar { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.sh-tab-item {
  font-size: 13px; font-weight: 600; padding: 9px 14px; color: var(--muted);
  border-bottom: 2.5px solid transparent; cursor: pointer;
}
.sh-tab-item.active { color: var(--teal); border-bottom-color: var(--teal); }

.sh-domain-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.sh-domain-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.sh-domain-card-name { font-size: 13.5px; font-weight: 600; margin-bottom: 3px; }
.sh-domain-card-status { font-size: 12px; color: var(--muted); }
.sh-domain-bar-mini { display: flex; height: 6px; border-radius: 3px; overflow: hidden; margin-top: 8px; background: var(--border); }
.sh-domain-bar-mini > div { border-right: 1px solid #fff; }
.sh-domain-bar-mini > div:last-child { border-right: none; }
.sh-seg-s { background: #0F6E56; }
.sh-seg-m { background: #EF9F27; }
.sh-seg-a { background: #D85A30; }

.sh-measure-table-wrap { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px; overflow-x: auto; }
table.sh-measure-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.sh-measure-table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 2px solid var(--border); white-space: nowrap;
}
table.sh-measure-table td { padding: 9px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.sh-measure-table td.sh-m-label { white-space: normal; font-weight: 600; color: var(--text); }
table.sh-measure-table tr:last-child td { border-bottom: none; }

/* ================================================================
   FAMILY MEMBER EXPERIENCE
   A deliberately separate, simplified surface — narrow mobile-first
   layout (uses #app's default max-width, no shell/report-mode
   override), plain-language cards rather than clinical detail.
   ================================================================ */
.family-shell { min-height: 100vh; background: var(--bg); }
.family-header { background: #0A4F3E; color: #fff; padding: 22px 20px; }
.family-header-brand { font-size: 13px; font-weight: 700; letter-spacing: 0.03em; margin-bottom: 3px; }
.family-header-greeting { font-size: 20px; font-family: Georgia, serif; }
.family-body { padding: 18px; }
.family-status-card {
  background: #fff; border-radius: 14px; padding: 22px; text-align: center;
  border: 1px solid var(--border); margin-bottom: 16px;
}
.family-status-icon { font-size: 34px; margin-bottom: 8px; }
.family-status-headline { font-size: 17px; font-weight: 600; margin-bottom: 6px; }
.family-status-sub { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
.family-section-title { font-size: 15px; font-weight: 600; margin: 20px 0 10px; font-family: Georgia, serif; }
.family-card { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.family-card-title { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; }
.family-card-body { font-size: 12.5px; color: var(--muted); line-height: 1.55; }

/* ---------------- Family access panel (staff side, Client Detail) --------------- */
.family-access-row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-top: 1px solid var(--border); }
.family-access-row:first-child { border-top: none; }
.family-access-name { font-size: 13px; font-weight: 600; }
.family-access-meta { font-size: 11.5px; color: var(--muted); }
.family-access-revoke { font-size: 11.5px; font-weight: 600; color: var(--red-text); cursor: pointer; }

/* ================================================================
   MODULE B — OUTCOMES & IMPACT
   Reuses the shell (sh-*) design language, not the rp- print
   system — this is an internal working record, not a family-facing
   printed document like the Module A wellbeing report.
   ================================================================ */
.ob-status-pill {
  font-size: 10.5px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}
.ob-status-pill.not_started { background: #EFEDE5; color: var(--muted); }
.ob-status-pill.in_progress { background: var(--amber-bg); color: var(--amber-text); }
.ob-status-pill.achieved { background: var(--green-bg); color: var(--green-text); }
.ob-status-pill.declined { background: var(--red-bg); color: var(--red-text); }
.ob-status-pill.not_applicable { background: #EFEDE5; color: var(--muted); }

.ob-domain-card {
  background: #fff; border: 1px solid var(--border); border-radius: 12px;
  padding: 16px 18px; margin-bottom: 14px;
}
.ob-domain-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.ob-domain-name { font-size: 15px; font-weight: 600; }
.ob-domain-category { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; }
.ob-domain-previous { font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.ob-domain-field { margin-bottom: 10px; }
.ob-domain-field label { display: block; font-size: 12.5px; font-weight: 500; margin-bottom: 5px; color: var(--muted); }
.ob-domain-field select, .ob-domain-field input, .ob-domain-field textarea {
  width: 100%; padding: 10px 12px; border: 0.5px solid var(--border); border-radius: 8px;
  font-size: 14px; font-family: inherit; background: #fff;
}
.ob-domain-field textarea { min-height: 70px; resize: vertical; }

.ob-concern-card {
  background: #fff; border: 1px solid var(--border); border-left: 4px solid var(--amber);
  border-radius: 0 10px 10px 0; padding: 14px 16px; margin-bottom: 12px;
}
.ob-concern-card.action { border-left-color: var(--red); }
.ob-concern-top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.ob-concern-title { font-size: 14px; font-weight: 600; }
.ob-intervention-row { background: var(--bg); border-radius: 8px; padding: 10px 12px; margin-top: 8px; font-size: 12.5px; }
.ob-intervention-type { font-weight: 600; }
.ob-followup-row { font-size: 12px; color: var(--muted); margin-top: 6px; padding-left: 10px; border-left: 2px solid var(--border); }

/* ---------------- Outcomes aggregate (Org Admin) ---------------- */
.ob-agg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.ob-agg-card { background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.ob-agg-card-name { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.ob-agg-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--border); margin-bottom: 8px; }
.ob-agg-bar > div { border-right: 1px solid #fff; }
.ob-agg-bar > div:last-child { border-right: none; }
.ob-agg-stats { font-size: 11px; color: var(--muted); }
.ob-agg-suppressed { font-size: 11.5px; color: var(--muted); font-style: italic; }
