/* SickKids-inspired colour layer. Keep layout and character artwork in styles.css.
   Reference: https://www.sickkids.ca/en/care-services/clinics/chronic-pain-clinic/
   Blue #0067b1 and pale #f7fafd sampled from the reference page, September 2026.
   Cyan is a decorative accent; text uses deeper blue for contrast. */
:root {
  --navy: #0067b1;
  --blue: #0067b1;
  --ink: #344b5e;
  --muted: #596f80;
  --bg: #f7fafd;
  --soft: #e8f4fa;
  --line: #d9e7ef;
  --accent: #45b8d3;
  --accent-ink: #087d9b;
  --blue-hover: #00538f;
  --blue-tint: #e3f2fb;
  --blue-rgb: 0 103 177;
  --accent-rgb: 69 184 211;
  --shadow: 0 5px 20px rgb(var(--blue-rgb) / .05);
  --shadow-sm: 0 2px 6px rgb(var(--blue-rgb) / .1);
  --shadow-md: 0 4px 14px rgb(var(--blue-rgb) / .15);
  --shadow-lg: 0 6px 18px rgb(var(--blue-rgb) / .15);
  /* Surfaces, lines and inks (2 October 2026). The long tail of near-identical pale blues was folded into these. */
  --white: #ffffff;
  --surface: #eef6fb;
  --line-strong: #b8d9ec;
  --blue-soft: #73a9cc;
  --blue-faint: #a9c8d4;
  --ink-soft: #365c78;
  --navy-deep: #294d7c;
  --accent-soft: #7fd6c8;
  --danger: #a1392f;
  --danger-deep: #86302a;
  --danger-tint: #fdf1ef;
  --danger-line: #e6c5c1;
  --success: #2e7d52;
  /* Type scale, rem. base is the body size; headings use 2xl and up. */
  --text-xs: .75rem;
  --text-sm: .8125rem;
  --text-base: .875rem;
  --text-md: .9375rem;
  --text-lg: 1rem;
  --text-xl: 1.125rem;
  --text-2xl: 1.3125rem;
  --text-3xl: 1.625rem;
  --text-4xl: 2.125rem;
  --text-display: 2.625rem;
  /* Radii. xs for chips and bars, sm for buttons and inputs, md for cards, lg for sheets and dialogs, xl for the big panels. */
  --radius-xs: 4px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --radius-circle: 50%;
  /* Motion. One easing, two durations; respect prefers-reduced-motion. */
  --ease: cubic-bezier(.2,.8,.2,1);
  --motion-fast: .22s;
  --motion-base: .3s;
  /* Side-chat sender names, one colour per seat, all from the blue, cyan and warm accents of the palette. */
  --sender-1: #0067b1;
  --sender-2: #087d9b;
  --sender-3: #2e7d52;
  --sender-4: #b4541a;
  --sender-5: #b0306a;
  --sender-6: #00538f;
  --sender-7: #00796b;
  --sender-8: #7a5c0a;
}

.primary { background: var(--blue); box-shadow: var(--shadow-sm); }
.primary:hover:not(:disabled) { background: var(--blue-hover); }
.secondary { border-color: var(--line-strong); }
.secondary:hover:not(:disabled) { background: var(--soft); }
button:focus-visible, a:focus-visible, input:focus-visible,
textarea:focus-visible, select:focus-visible, .provider-card:focus-visible,
.icc-choice input:focus-visible+span, .icc-periods button:focus-visible,
.icc-measure:focus-visible, .icc-chart-scroll:focus-visible,
.icc-table-scroll:focus-visible, .icc-answer-history>summary:focus-visible {
  outline-color: var(--blue);
}
.brand>span, .rounds-avatar span { color: var(--accent); }
.landing { background: linear-gradient(115deg, var(--white) 15%, var(--bg) 60%, var(--surface)); }
.landing-copy h1>span { color: var(--accent-ink); }
.landing-copy>p, .landing-note, .landing-footer, .brand-caption,
.release-info, .lab-credit { color: var(--muted); }
.eyebrow, .landing-features .icon { color: var(--blue); }
.landing-features { border-color: var(--line); }
.sidebar, .side-chat>header { background: var(--white); }
.nav-item.selected, .role-tab.active, .chip.active, .selected-btn {
  color: var(--blue); background: var(--blue-tint); border-color: var(--line-strong);
}
.nav-item:hover { background: var(--soft); }
.sidebar-label, .sidebar-art p, .subtle, .nav-item { color: var(--muted); }
.nav-item.selected { color: var(--blue); }
.chosen .provider-selection, .icc-choice input:checked+span {
  background: var(--blue); border-color: var(--blue); color: var(--white);
}
.provider-card.chosen { border-color: var(--blue); }
.step-indicator>span.active { background: var(--blue); }
.user-avatar, .initial { background: var(--blue-tint); }
/* Riley's face in the demo (29 September 2026): the picture fills the round avatar. */
.user-avatar.face, .initial.face { padding: 0; overflow: hidden; background: var(--line); }
.user-avatar.face img, .initial.face img { display: block; width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius-circle); }
.soft-icon { background: var(--soft); color: var(--accent-ink); }
.bubble { background: var(--bg); border-color: var(--line); color: var(--ink); }
.user-bubble { background: var(--blue-tint); color: var(--navy-deep); }
.side-chat { background: var(--surface); border-color: var(--line); }
/* The side chat reveal (owner decision, 4 October 2026): the first side message of a viewing. */
.chat-note { display: flex; align-items: center; justify-content: center; gap: 8px; width: fit-content; max-width: 100%; margin: 14px auto 10px; padding: 7px 14px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--white); color: var(--muted); font: inherit; font-size: var(--text-sm); line-height: 1.4; text-align: left; animation: appear var(--motion-base) ease-out; }
.chat-note .icon { width: 15px; height: 15px; flex: none; color: var(--accent-ink); }
.chat-note .icon-chevron { color: var(--muted); }
button.chat-note { cursor: pointer; }
button.chat-note:hover { border-color: var(--line-strong); color: var(--ink); }
.chat-layout .conversation > *, .chat-layout #chat-scroll > *, .chat-layout .side-chat { transition: opacity .6s var(--ease), box-shadow .6s var(--ease); }
.chat-layout.side-reveal .conversation > :not(#chat-scroll), .chat-layout.side-reveal #chat-scroll > :not(.chat-note) { opacity: .5; }
.chat-layout.side-reveal .side-chat { box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .35), var(--shadow-lg); }
@media (prefers-reduced-motion: reduce) { .chat-note { animation: none; } .chat-layout .conversation > *, .chat-layout #chat-scroll > *, .chat-layout .side-chat { transition: none; } .chat-layout.side-reveal .conversation > :not(#chat-scroll), .chat-layout.side-reveal #chat-scroll > :not(.chat-note) { opacity: 1; } }
.side-chat-bubble { color: var(--ink); border-color: var(--line); }
/* Side chat reads like a WhatsApp group: every colleague's bubble looks the same, and names carry the colour. */
.side-chat-row .side-chat-bubble, .side-chat-row:nth-child(even) .side-chat-bubble { background: var(--white); border-color: var(--line); }
.side-chat-row.continued { margin-top: -14px; }
.side-chat-row.continued .side-chat-bubble { border-radius: var(--radius-md); }
.side-avatar-space { width: 28px; flex: none; }
.side-quote { display: block; margin: 0 0 8px; padding: 6px 10px; border-left: 3px solid var(--sender); background: var(--surface); border-radius: var(--radius-xs); font-size: var(--text-sm); line-height: 1.45; white-space: normal; }
.side-quote b { display: block; color: var(--sender); font-weight: 600; }
.side-quote span { color: var(--muted); }
.side-typing .side-chat-bubble { display: inline-block; padding: 10px 14px; }
.side-chat-meta b, .side-chat .huddle-heading>.icon { color: var(--blue); }
.side-chat-members, .side-chat-state, .side-chat-meta span,
.side-chat-notice, .side-chat>footer, .side-chat-empty,
.message-meta>span, .composer-meta, .provider-name>span,
.provider-quote, .provider-perspective, .provider-detail, .team-footnote,
.page-heading p, .role-title p, .modal-lead, .field, .consent,
.selection-hint, .note-box { color: var(--muted); }
.side-chat>footer, .demo-controls { background: var(--bg); }
.demo-control-row b, .demo-time { color: var(--blue); }
.demo-progress input { accent-color: var(--blue); }
.demo-progress input::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--blue) var(--progress), var(--line) var(--progress));
}
.demo-progress input::-webkit-slider-thumb { background: var(--blue); }
.demo-progress input::-moz-range-progress { background: var(--blue); }
.demo-progress input::-moz-range-thumb { background: var(--blue); }
.icc-periods, .icc-question-number { background: var(--soft); }
.icc-periods button[aria-pressed="true"], .icc-question-number { color: var(--blue); }
.icc-measure[aria-pressed="true"] { border-color: var(--blue); background: var(--blue-tint); }
.icc-example-banner { background: var(--blue-tint); border-color: var(--line-strong); color: var(--navy-deep); }
.icc-question legend { color: var(--ink); }

/* Keep supporting copy readable on small screens and in dialogs. */
.setting-row p, .privacy-points p, .source-list span, .consent small,
.field small, .modal-scroll>p:not(.modal-lead), .circle-banner p,
.role-tab, .story-field>span, .story-section>p, .style-tag,
.demo-disclosure, .demo-service-note, .demo-time-row,
.conversation-title>span, .chat-date, .top-label { color: var(--muted); }
.field input::placeholder, .field textarea::placeholder,
.composer textarea::placeholder { color:var(--muted); }

.story-intro p, .story-field p, .circle-summary>span { color: var(--muted); }

/* Plan cards follow the SickKids palette (the leaf motif stays, coloured blue). */
.shared-plan { border-color: var(--line); background: linear-gradient(135deg, var(--bg), var(--white)); }
.shared-plan h3, .plan-label .icon { color: var(--blue); }
.shared-plan li:before { background: var(--blue-tint); color: var(--blue); }
.shared-plan .secondary { border-color: var(--line); color: var(--blue); }
.shared-plan li { color: var(--ink); }
/* New side-chat messages: a WhatsApp-style "N new messages" divider, a soft highlight that fades once read,
   a jump button when they are below the fold and a count on the Side chat button (owner request, 26 September 2026). */
.side-unread-divider { display: flex; justify-content: center; margin: 2px 0 16px; }
.side-unread-divider span { font-size: var(--text-xs); font-weight: 600; letter-spacing: .02em; color: var(--accent-ink); background: var(--blue-tint); border: 1px solid var(--line-strong); padding: 3px 12px; border-radius: var(--radius-pill); }
.side-chat-row .side-chat-bubble { position: relative; transition: background-color .9s ease, border-color .9s ease, box-shadow .9s ease; }
.side-chat-row.unread .side-chat-bubble { background: var(--surface); border-color: rgb(var(--accent-rgb) / .5); box-shadow: 0 0 0 3px rgb(var(--accent-rgb) / .14); }
.side-chat-row.unread .side-chat-bubble::after { content: ""; position: absolute; top: 10px; right: -4px; width: 9px; height: 9px; border-radius: var(--radius-circle); background: var(--accent); box-shadow: 0 0 0 2px var(--white); transition: opacity .6s ease; }
.side-jump { align-self: center; position: relative; z-index: 2; margin: -44px auto 10px; display: inline-flex; align-items: center; gap: 5px; padding: 6px 13px 6px 9px; border: 0; border-radius: var(--radius-pill); background: var(--accent-ink); color: var(--white); font: inherit; font-size: var(--text-sm); font-weight: 600; box-shadow: var(--shadow-md); cursor: pointer; }
.side-jump .icon { width: 15px; height: 15px; }
.side-jump[hidden] { display: none; }
.side-badge { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin-left: 2px; border-radius: var(--radius-sm); background: var(--accent-ink); color: var(--white); font-size: var(--text-xs); font-weight: 700; line-height: 1; }
.side-badge[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .side-chat-row .side-chat-bubble, .side-chat-row .side-chat-bubble::after { transition: none; } }
/* Messaging touches (owner request, 26 September 2026): times, day dividers, seen ticks, reply, react, copy and a jump button. */
.user-col { position: relative; display: flex; flex-direction: column; align-items: flex-end; max-width: 80%; min-width: 0; }
.user-col .user-bubble { max-width: 100%; }
.msg-foot { display: flex; align-items: center; gap: 4px; margin-top: 4px; font-size: var(--text-xs); color: var(--muted); }
.msg-seen { display: inline-flex; color: var(--accent-ink); }
.msg-seen .icon { width: 13px; height: 13px; stroke-width: 2.4; }
.msg-seen .icon + .icon { margin-left: -8px; }
.msg-time { font-size: var(--text-xs); color: var(--muted); }
.message-meta .msg-time::before { content: "·"; margin-right: 6px; }
.bubble-wrap { position: relative; }
.message-row.has-reaction .bubble-wrap { margin-bottom: 14px; }
.msg-reaction { position: absolute; left: 12px; bottom: -14px; display: inline-grid; place-items: center; min-width: 30px; height: 26px; padding: 0 7px; border-radius: var(--radius-pill); background: var(--white); border: 1px solid var(--line); box-shadow: var(--shadow-sm); font-size: var(--text-md); cursor: pointer; }
.message-row { position: relative; }
.msg-actions { position: absolute; top: -40px; right: 0; z-index: 4; display: flex; gap: 2px; padding: 3px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-pill); box-shadow: var(--shadow-md); opacity: 0; pointer-events: none; transform: translateY(4px); transition: opacity .15s ease, transform .15s ease; }
.message-row.user .msg-actions { top: 50%; right: 100%; margin-right: 8px; transform: translateY(-50%); }
.message-row.user:hover .msg-actions, .message-row.user:focus-within .msg-actions, .message-row.user.actions-open .msg-actions { transform: translateY(-50%); }
.message-row.user .react-tray { right: auto; left: 0; }
.message-row:hover .msg-actions, .message-row:focus-within .msg-actions, .message-row.actions-open .msg-actions { opacity: 1; pointer-events: auto; transform: none; }
.msg-actions > button { display: grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: var(--radius-circle); background: none; color: var(--blue); cursor: pointer; }
.msg-actions > button:hover, .msg-actions > button:focus-visible { background: var(--blue-tint); }
.msg-actions .icon { width: 16px; height: 16px; }
.react-tray { position: absolute; top: 36px; right: 0; display: flex; gap: 2px; padding: 4px 6px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-pill); box-shadow: var(--shadow-lg); }
.react-tray button { border: 0; background: none; font-size: var(--text-xl); width: 34px; height: 34px; border-radius: var(--radius-circle); cursor: pointer; transition: transform .12s ease; }
.react-tray button:hover, .react-tray button:focus-visible { transform: scale(1.2); background: var(--blue-tint); }
.react-tray button[aria-pressed="true"] { background: var(--blue-tint); }
.msg-quote { display: block; width: 100%; text-align: left; margin: 0 0 6px; padding: 6px 10px; border: 0; border-left: 3px solid var(--accent); border-radius: var(--radius-xs); background: var(--surface); font: inherit; font-size: var(--text-xs); line-height: 1.4; cursor: pointer; }
.msg-quote b { display: block; color: var(--accent-ink); font-weight: 600; }
.msg-quote span { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.reply-preview { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 7px 8px 7px 12px; border-left: 3px solid var(--accent); border-radius: var(--radius-sm); background: var(--surface); font-size: var(--text-sm); line-height: 1.4; }
.reply-preview > div { flex: 1; min-width: 0; }
.reply-preview b { display: block; color: var(--accent-ink); font-weight: 600; }
.reply-preview span { display: block; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-day { display: flex; justify-content: center; margin: 6px 0 18px; }
.chat-day span { font-size: var(--text-xs); font-weight: 600; color: var(--muted); background: var(--surface); padding: 3px 12px; border-radius: var(--radius-pill); }
.chat-jump { align-self: flex-end; position: relative; z-index: 3; margin: -50px 18px 12px auto; display: inline-flex; align-items: center; gap: 4px; min-width: 38px; height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius-pill); background: var(--white); color: var(--blue); font: inherit; font-size: var(--text-sm); font-weight: 600; box-shadow: var(--shadow-md); cursor: pointer; }
.chat-jump[hidden] { display: none; }
.chat-jump .icon { width: 17px; height: 17px; }
.chat-jump span:empty { display: none; }
@keyframes msg-flash { 0%, 100% { background: transparent; } 30% { background: var(--blue-tint); } }
.message-row.flash { animation: msg-flash 1.4s ease; border-radius: var(--radius-md); }
@media (hover: none) { .msg-actions, .message-row.user .msg-actions { top: auto; bottom: -42px; right: 0; margin: 0; transform: none; } .message-row.user:hover .msg-actions, .message-row.user.actions-open .msg-actions { transform: none; } .message-row.actions-open { margin-bottom: 56px; } }
@media (prefers-reduced-motion: reduce) { .msg-actions, .react-tray button { transition: none; } .message-row.flash { animation: none; outline: 2px solid var(--accent); } }
