/* Plain, large and readable on a phone. The page turns red while the red panel is shown. */
:root {
  --bg: #fbfaf7;
  --ink: #1d1d1b;
  --muted: #5c5a55;
  --line: #d9d5cc;
  --user: #e6eef7;
  --bot: #ffffff;
  --accent: #1f5f8b;
  --red: #b3261e;
  --red-bg: #fde8e6;
  --amber: #8a5a00;
  --amber-bg: #fff4d6;
  font-size: 19px;
}
* { box-sizing: border-box; }
body {
  margin: 0 auto;
  max-width: 46rem;
  padding: 0 1rem 2rem;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
}
/* Red while the newest message is a red reply. */
body:has(#messages > .red-panel:last-child) { --bg: var(--red-bg); --accent: var(--red); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
h1 { font-size: 1.4rem; margin: 1rem 0 0.5rem; }
.notice { color: var(--muted); font-size: 0.9rem; border-left: 4px solid var(--line); padding-left: 0.75rem; }
.red-panel, .amber-strip { border-radius: 12px; padding: 1rem; margin: 1rem 0; }
/* Room above the sticky message box, so a bubble scrolled into view is not hidden under it. */
#messages > * { scroll-margin-top: 0.5rem; scroll-margin-bottom: 13rem; }
.red-panel, .bubble.assistant.red-panel { background: var(--red); color: #fff; margin-right: 0; }
.red-panel .who { color: #fff; }
.red-panel:focus, .amber-strip:focus { outline: 3px solid var(--ink); outline-offset: 2px; }
.red-heading, .amber-strip h2 { font-size: 1.25rem; margin: 0.25rem 0 0.5rem; }
.checkin-support { background: var(--amber-bg); border: 2px solid var(--amber); border-radius: 12px; padding: 1rem; margin: 1rem 0; }
.checkin-support .call { background: var(--amber); color: #fff; }
.amber-strip { background: var(--amber-bg); border: 2px solid var(--amber); }
.contacts { list-style: none; padding: 0; margin: 0.5rem 0; display: grid; gap: 0.5rem; }
.contacts li { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.75rem; }
.call {
  display: inline-block; min-width: 9rem; padding: 0.6rem 1rem; border-radius: 999px;
  font-size: 1.15rem; font-weight: 700; text-align: center; text-decoration: none;
  background: #fff; color: var(--red);
}
.amber-strip .call { background: var(--amber); color: #fff; }
.contact-hours, .draft { font-size: 0.85rem; opacity: 0.85; }
.bubble { border-radius: 12px; padding: 0.75rem 1rem; margin: 0.75rem 0; border: 1px solid var(--line); }
.bubble.user { background: var(--user); margin-left: 2rem; }
.bubble.assistant { background: var(--bot); margin-right: 1rem; }
.bubble.red-reply { border: 2px solid var(--red); }
.bubble.error { border: 2px solid var(--amber); background: var(--amber-bg); }
.bubble p { white-space: pre-wrap; overflow-wrap: anywhere; }
.answer p { white-space: normal; }
.who { font-size: 0.8rem; color: var(--muted); margin: 0; text-transform: uppercase; letter-spacing: 0.04em; }
.status { color: var(--muted); font-style: italic; }
.answer.live { white-space: pre-wrap; }
.history { margin: 0.5rem 0; }
.history ul { padding-left: 1.25rem; margin: 0.25rem 0; display: grid; gap: 0.35rem; }
.history a[aria-current="page"] { font-weight: 700; color: var(--ink); }
.history time { color: var(--muted); font-size: 0.85rem; margin-left: 0.5rem; }
.kept { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.5rem; }
.bubble.interrupted { border: 2px dashed var(--amber); }
.welcome { background: var(--bot); border: 1px solid var(--line); border-radius: 12px; padding: 0.75rem 1rem; margin: 0.75rem 0; }
.welcome h2 { font-size: 1.15rem; margin: 0 0 0.25rem; }
.examples { padding-left: 1.25rem; margin: 0.5rem 0 0; display: grid; gap: 0.4rem; }
.answer ul, .answer ol { padding-left: 1.5rem; margin: 0.4rem 0; }
.answer li + li { margin-top: 0.25rem; }
.sources { border-top: 1px solid var(--line); margin-top: 0.75rem; font-size: 0.9rem; }
.sources h3 { font-size: 0.95rem; margin: 0.5rem 0; }
.sources ol { padding-left: 1.25rem; }
.source-card { margin-bottom: 0.5rem; }
.source-card > * { margin-right: 0.5rem; }
.publisher, .date { color: var(--muted); }
.source-card .section { font-weight: 600; }
.source-card .excerpt { margin: 0.25rem 0 0; padding-left: 0.75rem; border-left: 3px solid var(--muted); font-size: 0.9em; }
.label { font-size: 0.75rem; padding: 0.1rem 0.4rem; border-radius: 4px; font-weight: 700; }
.web-label { background: var(--amber-bg); color: var(--amber); }
.draft-label { background: #eee; color: var(--muted); }
.web-notice { font-weight: 700; color: var(--amber); }
.scope-notice { background: var(--amber-bg); border-left: 4px solid var(--amber); padding: 0.5rem 0.75rem; margin: 0 0 0.75rem; }
.ask { position: sticky; bottom: 0; background: var(--bg); padding: 0.75rem 0; display: grid; gap: 0.5rem; }
.ask label { font-weight: 700; }
textarea { width: 100%; font: inherit; padding: 0.6rem; border-radius: 8px; border: 2px solid var(--line); }
button {
  font: inherit; font-weight: 700; padding: 0.7rem 1.4rem; border-radius: 8px; border: 0;
  background: var(--accent); color: #fff; cursor: pointer; min-height: 3rem;
}
button.secondary { background: transparent; color: var(--accent); border: 2px solid var(--accent); padding: 0.4rem 0.9rem; min-height: 2.5rem; }
a { color: var(--accent); }
sup a { text-decoration: none; font-weight: 700; padding: 0 0.1rem; }

/* Navigation between the four pages. */
.nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1rem; margin: 0 0 0.75rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--line); }
.nav a { padding: 0.35rem 0; font-weight: 600; text-decoration: none; }
.nav a[aria-current="page"] { color: var(--ink); border-bottom: 3px solid var(--accent); }
.page h2 { font-size: 1.25rem; margin: 1rem 0 0.5rem; }
.languages { display: flex; gap: 1rem; }
.languages a[aria-current="true"], .languages button[aria-current="true"] { font-weight: 700; color: var(--ink); }
.languages button.link { background: none; border: none; padding: 0; min-height: 2.75rem; color: var(--accent, inherit); text-decoration: underline; cursor: pointer; font: inherit; }
.form select { min-height: 2.75rem; font: inherit; max-width: 100%; }

/* Forms: profile and check-in. */
.form { display: grid; gap: 0.75rem; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 1rem 0.75rem; margin: 0; }
legend { font-weight: 700; padding: 0 0.25rem; }
.form > label { font-weight: 700; }
.choice { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; }
input[type="radio"] { width: 1.4rem; height: 1.4rem; margin: 0; accent-color: var(--accent); }
input[type="text"] { width: 100%; font: inherit; padding: 0.6rem; border-radius: 8px; border: 2px solid var(--line); }
.hint { color: var(--muted); font-size: 0.9rem; margin: 0 0 0.25rem; }
#form-error:empty { display: none; }
.scale-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.9rem; }
.point { display: flex; align-items: center; gap: 0.3rem; min-height: 2.75rem; font-weight: 700; }
.anchor { color: var(--muted); font-size: 0.85rem; flex-basis: 100%; }
.anchor:last-child { text-align: left; }
@media (min-width: 40rem) { .anchor { flex-basis: auto; } }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
a.button { display: inline-block; font-weight: 700; padding: 0.4rem 0.9rem; border-radius: 8px; text-decoration: none; }
a.button.secondary { color: var(--accent); border: 2px solid var(--accent); }
button.danger { background: var(--red); }
button.small { padding: 0.3rem 0.8rem; min-height: 2.5rem; font-size: 0.9rem; }
.data { margin-top: 2rem; border-top: 1px solid var(--line); }

/* Checklist. */
.theme h3 { font-size: 1.1rem; margin: 1.25rem 0 0.5rem; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.6rem; }
.step { background: var(--bot); border: 1px solid var(--line); border-radius: 12px; padding: 0.6rem 1rem; }
.step.done { border-color: #3c7a3c; }
.step.done summary { color: var(--muted); }
summary { cursor: pointer; font-weight: 700; min-height: 2.5rem; display: list-item; padding-top: 0.25rem; }
details p { overflow-wrap: anywhere; }
.card { border-left: 4px solid var(--accent); padding: 0.25rem 0 0.25rem 0.75rem; margin: 0.75rem 0; }
.card h4 { margin: 0.25rem 0; font-size: 1rem; }
.card dl { margin: 0; }
.card dt { font-weight: 700; font-size: 0.9rem; margin-top: 0.4rem; }
/* An automatic display translation (decision D4a): marked, with the original one tap away. */
.translation-note { font-size: 0.85rem; color: var(--muted); font-style: italic; margin: 0.25rem 0; }
.original-text > summary { font-size: 0.85rem; color: var(--muted); cursor: pointer; }
.original { border-left: 2px solid #ccc; padding-left: 0.5rem; color: var(--muted); }
.name-in { font-weight: 400; }
.contact-kind { font-weight: 700; }
.contact-languages { display: block; font-size: 0.85rem; color: var(--muted); }
.card dd { margin: 0; overflow-wrap: anywhere; }
.card ul, .sources ul { padding-left: 1.25rem; margin: 0.25rem 0; }
.sources h4 { font-size: 0.95rem; margin: 0.5rem 0 0.25rem; }
.sources li { overflow-wrap: anywhere; }
.step-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin-top: 0.5rem; }
.done-mark { color: #3c7a3c; font-weight: 700; }

/* Check-in trend: the caregiver's own answers, one row per check-in, no score. */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 0.95rem; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.bar { display: inline-block; height: 0.8rem; border-radius: 3px; background: var(--accent); vertical-align: middle; }
.bar.lvl-1 { width: 0.6rem; }
.bar.lvl-2 { width: 1.2rem; }
.bar.lvl-3 { width: 1.8rem; }
.bar.lvl-4 { width: 2.4rem; }
.bar.lvl-5 { width: 3rem; }

/* The demo notice (docs/legal-notice.md): big and plain at the top, the full text small below. */
.demo-banner { background: var(--ink); color: #fff; margin: 0 -1rem; padding: 0.75rem 1rem; }
.demo-banner p { margin: 0.15rem 0; }
.demo-banner strong { font-size: 1.15rem; line-height: 1.35; }
.demo-banner a { color: #fff; font-weight: 700; }
.legal { margin-top: 3rem; padding-top: 0.75rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.75rem; line-height: 1.45; }
.legal h2 { font-size: 0.85rem; margin: 0 0 0.25rem; }
.legal p { margin: 0.4rem 0; }
.consent-notice { font-size: 0.9rem; }
