/* ===========================================================================
   Care Thread — the patient's journey screens (public/journey.js), inside the
   engagement app. Everything is scoped under .jr / .jr-*.

   ⚠️ app.css tokens win over the mockups' colours and type (Taner,
   2026-10-01); the mockups (boards 10–13, 390 wide) set layout, components and
   copy. The few Care Thread pieces this page needs are copied from
   public/care/care.css under a .jr- prefix, with the same values, because
   care.css isn't loaded here:
     the status chip palette   blue / green / teal / amber / red / grey
     the timeline              done / now / future
     the navy "next step" card --blue-ink
   New colours (same as care.css, each because app.css has no equivalent):
     teal  #0e6b74 / #e3f3f4   "in treatment"
     red   #a5300a / #fdece6   declined / not responding (app.css .btn-danger)
     amber wash #fdf1dc        app.css has --amber text but no wash

   Mobile first. At desktop width the journey stays one calm column centred in
   the app's .shell — it is a sequence of steps, not a dashboard.
   =========================================================================== */

.jr {
  --jr-teal: #0e6b74; --jr-teal-wash: #e3f3f4;
  --jr-red: #a5300a;  --jr-red-wash: #fdece6;
  --jr-amber-wash: #fdf1dc;
  max-width: 520px; margin: 0 auto;
}
#view-app > .jr { margin-top: -12px; }

/* ── header: wordmark + one link ─────────────────────────────────────────── */
.jr-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 18px; }
.jr-brand { display: flex; flex-direction: column; line-height: 1; }
.jr-wordmark { font-family: var(--font-display); font-weight: 700; font-size: 24px; letter-spacing: -.02em; color: var(--blue-ink); }
.jr-powered { margin-top: 4px; font-size: 10px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.jr-link {
  font-size: 15px; font-weight: 600; color: var(--blue); text-decoration: none; padding: 2px 0;
  background: none; border: 0; cursor: pointer;
}
.jr-link:hover { text-decoration: underline; }
.jr-note .jr-link, .jr-dialog-p .jr-link { font-size: inherit; text-decoration: underline; }

.jr-steprow { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.jr-back { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; font-weight: 600; color: var(--blue); text-decoration: none; }
.jr-back:hover { text-decoration: underline; }
.jr-step { font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* ── type ────────────────────────────────────────────────────────────────── */
.jr .eyebrow { margin-bottom: 6px; }
.jr-h1 { font-family: var(--font-display); font-weight: 600; font-size: 34px; line-height: 1.12; letter-spacing: -.02em; }
.jr-lede { font-family: var(--font-serif); font-size: 17px; line-height: 1.55; color: var(--muted); margin-top: 12px; }
.jr-label { font-size: 11.5px; font-weight: 700; letter-spacing: .11em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.jr-gap { margin-top: 22px; }
.jr-gap-sm { margin-top: 4px; }
.jr-note { font-size: 13.5px; color: var(--muted); text-align: center; margin-top: 16px; line-height: 1.55; }
.jr-hint { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.jr-center { text-align: center; }
.jr-error { color: var(--jr-red, #a5300a); font-size: 14px; margin-top: 10px; }
.jr-dialog-p { font-size: 15.5px; line-height: 1.55; margin-bottom: 12px; }

/* ── cards ───────────────────────────────────────────────────────────────── */
.jr-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; margin-top: 20px;
}
.jr-form .field:last-of-type { margin-bottom: 4px; }

.jr-actions { display: grid; gap: 12px; margin-top: 22px; }
.jr-actions .btn { padding-top: 15px; padding-bottom: 15px; }

/* P1: the text message, as received */
.jr-sms {
  background: #efebe4; border-radius: 18px; padding: 12px 16px;
  font-size: 14.5px; line-height: 1.5; color: var(--ink); margin-bottom: 22px;
}

/* P1: referred by / treatment center / treatment */
.jr-dl { padding-top: 6px; padding-bottom: 6px; }
.jr-dl-row { padding: 12px 0; }
.jr-dl-row + .jr-dl-row { border-top: 1px solid var(--line-soft); }
.jr-dl-k { font-size: 11.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.jr-dl-v { font-weight: 600; font-size: 16px; margin-top: 3px; }
.jr-dl-sub { font-size: 13.5px; color: var(--muted); }

/* P2 / sharing: party rows */
.jr-parties { padding-top: 6px; padding-bottom: 6px; }
.jr-party { display: flex; align-items: center; gap: 14px; padding: 12px 0; }
.jr-parties > .jr-party + .jr-party, .jr-share + .jr-share { border-top: 1px solid var(--line-soft); }
.jr-avatar {
  flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: 15px; background: var(--blue-ink);
}
.jr-avatar--site { background: var(--jr-teal); }
.jr-party-main { flex: 1 1 auto; min-width: 0; }
.jr-party-name { font-weight: 700; font-size: 16px; }
.jr-party-sub { font-size: 13.5px; color: var(--muted); line-height: 1.4; }
.jr-tick {
  flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  background: var(--green-wash); color: var(--green);
}
.jr-ic { display: inline-grid; place-items: center; flex: none; }

/* P2: what this means */
.jr-means { list-style: none; display: grid; gap: 14px; }
.jr-means li { display: flex; gap: 12px; font-size: 15px; line-height: 1.5; }
.jr-means .jr-ic { color: var(--blue); margin-top: 2px; }

/* P3: what <site> needs */
.jr-needs-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.jr-needs-title { font-weight: 700; font-size: 16px; }
.jr-needs-count { font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.jr-bar { height: 7px; border-radius: 999px; background: var(--line-soft); overflow: hidden; margin: 10px 0 8px; }
.jr-bar > span { display: block; height: 100%; background: var(--blue); border-radius: 999px; transition: width .4s var(--ease); }
.jr-bar.done > span { background: var(--green); }
.jr-checks { list-style: none; }
.jr-checks li { display: flex; align-items: center; gap: 12px; padding: 8px 0; font-size: 15px; }
.jr-checks li.missing { color: var(--amber); }
.jr-check { color: var(--green); display: inline-grid; }
.jr-hollow { flex: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid currentColor; }

/* P3: connected portals */
.jr-portals { padding-top: 6px; padding-bottom: 6px; }
.jr-portal { display: flex; align-items: center; gap: 12px; padding: 13px 0; }
.jr-portal + .jr-portal { border-top: 1px solid var(--line-soft); }
.jr-portal-mark {
  flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  background: #f3efe6; color: var(--muted); font-size: 17px;
}
.jr-portal-main { flex: 1 1 auto; min-width: 0; }
.jr-portal-name { font-weight: 700; font-size: 15.5px; }
.jr-portal-sub { font-size: 13.5px; color: var(--muted); line-height: 1.35; }
.jr-searchbox { margin-top: 20px; }
.jr-searchbox input { padding-top: 15px; padding-bottom: 15px; font-size: 16px; }
.jr-searchbox .jr-ic { position: absolute; left: 20px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.jr .search-mode { text-align: center; }

/* ── the status chip (care.css's, same palette) ──────────────────────────── */
.jr-chip {
  display: inline-flex; align-items: center; gap: 7px; white-space: nowrap;
  padding: 4px 11px; border-radius: 999px; font-size: 13.5px; font-weight: 600; line-height: 1.35;
}
.jr-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.jr-chip--blue  { color: var(--blue);  background: var(--blue-wash); }
.jr-chip--green { color: var(--green); background: var(--green-wash); }
.jr-chip--teal  { color: var(--jr-teal); background: var(--jr-teal-wash); }
.jr-chip--amber { color: var(--amber); background: var(--jr-amber-wash); }
.jr-chip--red   { color: var(--jr-red);   background: var(--jr-red-wash); }
.jr-chip--grey  { color: var(--muted); background: var(--line-soft); }
.jr-chiprow { margin-top: 12px; }

/* ── P4 ──────────────────────────────────────────────────────────────────── */
.jr-navy { background: var(--blue-ink); color: #fff; border-radius: var(--radius); padding: 20px 20px 22px; margin-top: 18px; }
.jr-navy .eyebrow { color: #c9dcf7; }
.jr-navy-title { font-family: var(--font-display); font-size: 21px; line-height: 1.3; margin-top: 4px; }
.jr-navy-detail { font-size: 13.5px; color: #c9dcf7; margin-top: 8px; line-height: 1.45; }

.jr-tl-card { padding: 22px 20px 4px; }
.jr-tl { list-style: none; position: relative; }
.jr-tl li { position: relative; padding: 0 0 22px 34px; }
.jr-tl li::before { content: ""; position: absolute; left: 6px; top: 22px; bottom: 2px; width: 2px; background: var(--line); }
.jr-tl li:last-child::before { display: none; }
.jr-tl .dot { position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--blue); }
.jr-tl .dot.now { background: var(--paper); border: 3px solid var(--orange); }
.jr-tl .dot.future { background: var(--paper); border: 2px solid var(--blue-pale); }
.jr-tl .t { font-weight: 700; font-size: 15.5px; line-height: 1.35; }
.jr-tl .d { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.jr-tl li.future .t, .jr-tl li.future .d { color: var(--faint); }
.jr-tl li.future .t { font-weight: 600; }

.jr-two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.jr-two .btn { white-space: normal; text-align: left; justify-content: flex-start; line-height: 1.3; padding: 13px 18px; min-height: 60px; }

/* ── manage sharing ──────────────────────────────────────────────────────── */
.jr-share { padding: 4px 0 14px; }
.jr-share .jr-party { padding-bottom: 6px; }
.jr-share-status { font-size: 13.5px; color: var(--green); margin: 0 0 10px 58px; }
.jr-share-status.off { color: var(--muted); }
.jr-stop { margin-left: 58px; }
.jr-confirm {
  margin: 4px 0 0; padding: 14px 16px; border-radius: var(--radius-sm);
  background: var(--jr-red-wash); border: 1px solid #f3c9b8; font-size: 15px; line-height: 1.5;
}
.jr-confirm .jr-actions { margin-top: 14px; }

/* ── messages ────────────────────────────────────────────────────────────── */
.jr-thread { display: flex; flex-direction: column; gap: 10px; max-height: 46dvh; overflow-y: auto; margin-bottom: 14px; }
.jr-msg { max-width: 85%; align-self: flex-start; }
.jr-msg.mine { align-self: flex-end; }
.jr-msg-body { background: #efebe4; padding: 10px 14px; border-radius: 16px; font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
.jr-msg.mine .jr-msg-body { background: var(--blue-wash); color: var(--blue-ink); }
.jr-msg-meta { font-size: 12px; color: var(--faint); margin-top: 3px; }
.jr-msg.mine .jr-msg-meta { text-align: right; }
.jr-textarea {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-sm); background: #fdfbf7;
  border: 1px solid var(--line); resize: vertical; margin-bottom: 10px; font-size: 15px;
}
.jr-textarea:focus { outline: none; background: var(--paper); border-color: var(--blue); box-shadow: 0 0 0 4px rgba(27,86,171,.12); }
.jr-note-host .jr-actions { margin-top: 8px; }

/* ── footer: sponsor-free ────────────────────────────────────────────────── */
.jr-foot {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--line);
  font-size: 12px; color: var(--faint); text-align: center;
}

@media (max-width: 620px) {
  #view-app > .jr { margin-top: -18px; }
  .jr-h1 { font-size: 31px; }
}

/* An <a> styled as a button (Continue, Done for now) is a button, not a link. */
.jr a.btn { text-decoration: none; }
.jr-means .jr-ic { align-self: flex-start; margin-top: 3px; }
/* app.css positions `.searchbox svg` itself; here the wrapper span does. */
.jr-searchbox .jr-ic svg { position: static; transform: none; }
.jr-note a { color: var(--blue); font-weight: 600; }
