/* ===========================================================================
   Care Thread — additions to the engagement app's design system (/app.css).

   ⚠️ app.css tokens win over the mockups' values (Taner, 2026-10-01): the
   mockups set layout, components and copy; colour and type come from app.css.
   Mapping used here:
     mockup navy wordmark (#1C2C66)  → --blue-ink
     mockup Newsreader headings      → --font-display (Crimson Text)
     mockup Instrument Sans UI       → --font-ui (Inter)
     mockup cream ground (#FBF8F1)   → --cream / .sky-soft
     mockup blue accent (#2B4BB3)    → --blue
     mockup orange CTA               → .btn-primary (--orange)

   New tokens, only where app.css has no equivalent (each says why):
     --teal / --teal-wash   "in treatment" chips: the mockups distinguish
                            treatment (teal) from packet-complete (green)
     --red / --red-wash     declined / not responding: app.css has only the
                            .btn-danger literal (#a5300a), promoted to a token
     --amber-wash           app.css has --amber for text but no wash

   Light only, like app.css.
   =========================================================================== */

:root {
  --teal:       #0e6b74;
  --teal-wash:  #e3f3f4;
  --red:        #a5300a;
  --red-wash:   #fdece6;
  --amber-wash: #fdf1dc;
}

.ct-shell {
  max-width: 1232px; margin: 0 auto;
  padding-left: calc(24px + env(safe-area-inset-left));
  padding-right: calc(24px + env(safe-area-inset-right));
}
.ct-root { padding: 36px 0 72px; }
.ct-root.ct-mobile { padding: 0 0 48px; }

/* ── masthead ─────────────────────────────────────────────────────────────── */
.ct-masthead-row { display: flex; align-items: center; justify-content: space-between; height: 76px; gap: 18px; }
.ct-brand { display: flex; flex-direction: column; text-decoration: none; line-height: 1; }
.ct-wordmark {
  font-family: var(--font-display); font-weight: 700; font-size: 28px;
  letter-spacing: -.02em; color: var(--blue-ink);
}
.ct-powered {
  margin-top: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.ct-masthead .nav a { font-size: 16px; }
.ct-masthead .nav .nav-signout { border: 1px solid var(--ink); color: var(--ink); margin-left: 18px; }
@media (max-width: 760px) {
  .ct-masthead-row { height: auto; min-height: 64px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
  .ct-wordmark { font-size: 23px; }
  /* Staff screens are desktop-first, but a phone must still reach every tab:
     the nav becomes its own scrollable row under the wordmark rather than
     being clipped by the masthead. */
  .ct-masthead #ct-nav { width: 100%; overflow-x: auto; scrollbar-width: none; }
  .ct-masthead .nav a { font-size: 14px; padding: 8px 10px; flex: none; }
  .ct-masthead .nav .nav-signout { margin-left: auto; }
}
/* Link-styled buttons (<a class="btn">) must not inherit link underlines. */
.ct-shell a.btn { text-decoration: none; }

.ct-demo-note {
  background: var(--amber-wash); color: var(--amber); font-size: 13px; font-weight: 600;
  text-align: center; padding: 7px 16px; border-bottom: 1px solid #f1dcb5;
}

/* ── page heads ───────────────────────────────────────────────────────────── */
.ct-back { display: inline-flex; gap: 6px; font-size: 15px; font-weight: 600; color: var(--blue); text-decoration: none; margin-bottom: 10px; }
.ct-back:hover { text-decoration: underline; }
.ct-h1 { font-family: var(--font-display); font-weight: 600; font-size: 46px; letter-spacing: -.02em; line-height: 1.05; }
.ct-h2 { font-family: var(--font-display); font-weight: 600; font-size: 24px; letter-spacing: -.01em; line-height: 1.15; }
.ct-lede { font-family: var(--font-serif); font-size: 18.5px; line-height: 1.5; color: var(--muted); max-width: 720px; margin-top: 12px; }
.ct-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-bottom: 26px; }
.ct-meta { font-size: 15px; color: var(--muted); margin-top: 10px; }
.ct-meta b { color: var(--ink); }
@media (max-width: 760px) { .ct-h1 { font-size: 34px; } }

/* ── cards ────────────────────────────────────────────────────────────────── */
.ct-card {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px;
}
.ct-card + .ct-card { margin-top: 18px; }
.ct-card-title { font-family: var(--font-display); font-weight: 600; font-size: 24px; margin-bottom: 14px; }
.ct-grid { display: grid; gap: 22px; }
.ct-grid-2 { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.ct-grid-r3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1.75fr); }
@media (max-width: 980px) { .ct-grid-2, .ct-grid-r3 { grid-template-columns: 1fr; } }

/* ── the one status chip (spec §7: same look on every screen) ─────────────── */
.ct-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;
}
.ct-chip::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.ct-chip--blue  { color: var(--blue);  background: var(--blue-wash); }
.ct-chip--green { color: var(--green); background: var(--green-wash); }
.ct-chip--teal  { color: var(--teal);  background: var(--teal-wash); }
.ct-chip--amber { color: var(--amber); background: var(--amber-wash); }
.ct-chip--red   { color: var(--red);   background: var(--red-wash); }
.ct-chip--grey  { color: var(--muted); background: var(--line-soft); }

/* ── filter pills + search ────────────────────────────────────────────────── */
.ct-filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.ct-pill {
  display: inline-flex; align-items: center; gap: 9px; padding: 10px 18px;
  border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.ct-pill .n { font-size: 12.5px; padding: 1px 8px; border-radius: 999px; background: var(--line-soft); color: var(--muted); }
.ct-pill[aria-pressed="true"] { background: var(--blue); border-color: var(--blue); color: #fff; }
.ct-pill[aria-pressed="true"] .n { background: rgba(255,255,255,.22); color: #fff; }
.ct-search {
  flex: 1 1 260px; display: flex; align-items: center; gap: 10px;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper);
}
.ct-search input { border: 0; outline: 0; background: none; flex: 1; font-size: 15px; }

/* ── staff tables ─────────────────────────────────────────────────────────── */
.ct-table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.ct-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.ct-table th {
  text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--faint); padding: 18px 16px 14px; border-bottom: 1px solid var(--line); background: #fdfbf7;
}
.ct-table td { padding: 18px 16px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.ct-table tr:last-child td { border-bottom: 0; }
.ct-table tr[data-href] { cursor: pointer; }
.ct-table tr[data-href]:hover td { background: #fffaf2; }
.ct-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.ct-sub { font-size: 13px; color: var(--muted); margin-top: 3px; }
.ct-name { font-weight: 600; }

/* ── forms ────────────────────────────────────────────────────────────────── */
.ct-form .field textarea {
  width: 100%; min-height: 96px; padding: 14px 16px; border-radius: var(--radius-sm);
  background: #fdfbf7; border: 1px solid var(--line); resize: vertical;
}
.ct-form .field textarea:focus { outline: none; background: var(--paper); border-color: var(--blue); box-shadow: 0 0 0 4px rgba(27,86,171,.12); }
.ct-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.ct-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 620px) { .ct-row, .ct-row-3 { grid-template-columns: 1fr; } }
.ct-seg { display: inline-flex; gap: 8px; }
.ct-seg button { padding: 11px 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--paper); font-weight: 600; }
.ct-seg button[aria-pressed="true"] { background: var(--blue-ink); border-color: var(--blue-ink); color: #fff; }
.ct-error { color: var(--red); font-size: 14px; margin-top: 8px; }
.ct-hint { font-size: 13.5px; color: var(--muted); }

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

/* ── progress ─────────────────────────────────────────────────────────────── */
.ct-bar { height: 7px; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.ct-bar > span { display: block; height: 100%; background: var(--blue); border-radius: 999px; }
.ct-bar.done > span { background: var(--green); }

/* ── "what happens next" side panel ──────────────────────────────────────── */
.ct-steps { list-style: none; counter-reset: s; }
.ct-steps li { counter-increment: s; position: relative; padding-left: 42px; margin-bottom: 16px; font-size: 15px; line-height: 1.5; }
.ct-steps li::before {
  content: counter(s); position: absolute; left: 0; top: 0; width: 28px; height: 28px; border-radius: 50%;
  background: var(--blue-wash); color: var(--blue); font-size: 13px; font-weight: 700; display: grid; place-items: center;
}

/* ── patient (mobile-first) ───────────────────────────────────────────────── */
.ct-phone { max-width: 480px; margin: 0 auto; padding: 0 20px; }
.ct-phone .ct-h1 { font-size: 34px; }
.ct-note { font-size: 13.5px; color: var(--muted); text-align: center; margin-top: 14px; }
.ct-navy {
  background: var(--blue-ink); color: #fff; border-radius: var(--radius); padding: 22px;
}
.ct-navy .eyebrow { color: #c9dcf7; }

/* ── toasts ───────────────────────────────────────────────────────────────── */
.ct-toasts { position: fixed; bottom: calc(20px + env(safe-area-inset-bottom)); left: 50%; transform: translateX(-50%); z-index: 120; display: grid; gap: 8px; }
.ct-toast { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 999px; font-size: 14.5px; box-shadow: var(--shadow-lift); }

/* ── sign-in / unavailable ───────────────────────────────────────────────── */
.ct-auth { max-width: 440px; margin: 7vh auto 0; }
.ct-empty { text-align: center; padding: 60px 20px; color: var(--muted); }

/* ── message threads (CT.threadCard: R3, S3) ──────────────────────────────── */
.of-msgs { display: grid; gap: 10px; margin-bottom: 12px; }
.of-bubble { background: var(--cream); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14.5px; line-height: 1.45; margin-right: 12px; }
.of-bubble.mine { background: var(--blue-wash); margin-right: 0; margin-left: 12px; }
.of-bubble-who { font-weight: 700; }
.of-msg-form {
  display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 4px 4px 16px; background: var(--paper);
}
.of-msg-form:focus-within { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(27,86,171,.12); }
.of-msg-form input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; padding: 8px 0; font-size: 15px; }
.of-send-btn { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: var(--blue); }
.of-send-btn:hover { background: var(--blue-wash); }
.ct-thread-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: -4px 0 12px; }
.ct-thread-tabs .ct-pill { padding: 6px 14px; font-size: 13.5px; }
.ct-thread-note { font-size: 12.5px; color: var(--faint); margin: -6px 0 10px; }
