/* Care Taker components. Every class starts with ct-. Documented in docs/DESIGN.md. */

/* Icon: inline SVG, outline, 1.5 stroke */
.ct-icon { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* App bar */
.ct-app-bar { background: var(--color-surface); border-bottom: 1px solid var(--color-border); position: sticky; top: 0; z-index: 10; }
@media (max-width: 719px) { .ct-app-bar { position: static; } }
.ct-app-bar__inner {
  max-width: var(--content-max); margin: 0 auto; padding: var(--space-3) var(--space-4);
  display: flex; flex-direction: column; gap: var(--space-2);
}
.ct-brand { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); color: var(--color-ink); text-decoration: none; font-weight: var(--weight-bold); font-size: var(--text-lg); }
.ct-brand .ct-icon { color: var(--color-primary); width: 1.75em; height: 1.75em; }

/* Segmented control (role switcher) */
.ct-segmented {
  display: flex; flex-wrap: wrap; gap: var(--space-1); padding: var(--space-1); width: 100%;
  background: var(--color-surface-sunken); border-radius: var(--radius-md);
}
.ct-segmented__item {
  flex: 1 1 auto; min-height: var(--tap-min); padding: 0 var(--space-3);
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  border: 0; border-radius: var(--radius-sm); background: transparent; cursor: pointer;
  color: var(--color-ink-muted); font-weight: var(--weight-medium); text-decoration: none; white-space: nowrap;
  transition: background 150ms ease-out, color 150ms ease-out;
}
.ct-segmented__item:hover { color: var(--color-ink); }
.ct-segmented--fill .ct-segmented__item { flex: 1 1 0; }
.ct-segmented__item[aria-checked="true"],
.ct-segmented__item[aria-current="page"] { background: var(--color-surface); color: var(--color-primary); box-shadow: var(--shadow-1); font-weight: var(--weight-bold); }

/* Buttons */
.ct-btn {
  min-height: var(--tap-min); padding: 0 var(--space-5);
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  border-radius: var(--radius-md); border: 1px solid transparent; cursor: pointer;
  font-weight: var(--weight-medium); font-size: var(--text-md); line-height: var(--leading-tight);
  text-decoration: none; transition: background 150ms ease-out, border-color 150ms ease-out;
}
.ct-btn--primary { background: var(--color-primary); color: var(--color-ink-inverse); }
.ct-btn--primary:hover { background: var(--color-primary-hover); color: var(--color-ink-inverse); }
.ct-btn--secondary { background: var(--color-surface); color: var(--color-primary); border-color: var(--color-border-strong); }
.ct-btn--secondary:hover { background: var(--color-primary-soft); }
.ct-btn--ghost { background: transparent; color: var(--color-primary); }
.ct-btn--ghost:hover { background: var(--color-primary-soft); }
.ct-btn--danger { background: var(--status-urgent); color: var(--color-ink-inverse); }
.ct-btn--danger:hover { background: var(--color-ink); }
.ct-btn--sm { min-height: var(--tap-min); padding: 0 var(--space-3); font-size: var(--text-sm); }
.ct-btn--block { width: 100%; }
.ct-btn:disabled, .ct-btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.ct-btn--loading { position: relative; color: transparent !important; pointer-events: none; }
.ct-btn--loading::after {
  content: ""; position: absolute; width: 1.1em; height: 1.1em; border-radius: var(--radius-pill);
  border: 2px solid var(--color-ink-inverse); border-right-color: transparent; animation: ct-spin 700ms linear infinite;
}
.ct-btn--secondary.ct-btn--loading::after, .ct-btn--ghost.ct-btn--loading::after { border-color: var(--color-primary); border-right-color: transparent; }
@keyframes ct-spin { to { transform: rotate(360deg); } }

/* Cards */
.ct-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); }
.ct-card--raised { box-shadow: var(--shadow-2); border-color: transparent; }
.ct-card--sunken { background: var(--color-surface-sunken); border-color: transparent; }
.ct-card__head { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: baseline; justify-content: space-between; margin-bottom: var(--space-4); }
.ct-card__head p { color: var(--color-ink-muted); font-size: var(--text-sm); }
@media (max-width: 719px) { .ct-card { padding: var(--space-4); } }

.ct-section-title { display: flex; gap: var(--space-2); align-items: center; }
.ct-section-title .ct-icon { color: var(--color-primary); }

/* Status pill: icon + label + color */
.ct-status {
  display: inline-flex; align-items: center; gap: var(--space-1);
  padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill);
  font-size: var(--text-sm); font-weight: var(--weight-medium); line-height: var(--leading-tight); white-space: nowrap;
}
.ct-status .ct-icon { width: 1.1em; height: 1.1em; }
.ct-status--taken { color: var(--status-taken); background: var(--status-taken-bg); }
.ct-status--later { color: var(--status-later); background: var(--status-later-bg); }
.ct-status--urgent { color: var(--status-urgent); background: var(--status-urgent-bg); }
.ct-status--stopped { color: var(--status-stopped); background: var(--status-stopped-bg); }
.ct-status--missed { color: var(--status-missed); background: var(--status-missed-bg); }
.ct-status--unclear { color: var(--status-unclear); background: var(--status-unclear-bg); }
.ct-status--pending { color: var(--color-ink-muted); background: var(--color-surface-sunken); }

/* Tag: small neutral label, for example "Language under review" */
.ct-tag { display: inline-flex; align-items: center; gap: var(--space-1); padding: 0 var(--space-2); border-radius: var(--radius-sm); border: 1px solid var(--color-border-strong); font-size: var(--text-xs); font-weight: var(--weight-medium); color: var(--color-ink-muted); }

/* Fields */
.ct-field { display: flex; flex-direction: column; gap: var(--space-1); }
.ct-field__label { font-weight: var(--weight-medium); }
.ct-field__help { font-size: var(--text-sm); color: var(--color-ink-muted); }
.ct-field__error { font-size: var(--text-sm); color: var(--status-urgent); display: flex; gap: var(--space-1); align-items: center; }
.ct-field__error:empty { display: none; }
.ct-input, .ct-select{
  min-height: var(--tap-min); width: 100%; padding: var(--space-2) var(--space-3);
  background: var(--color-surface); border: 1px solid var(--color-border-strong); border-radius: var(--radius-md);
}
/* Selects draw their own chevron, inset from the right edge by the same space as the text on the
   left, so the field looks even on both sides in every browser. */
.ct-select {
  appearance: none; -webkit-appearance: none; padding-right: calc(var(--space-6) + var(--space-3));
  background-image:
    linear-gradient(45deg, transparent calc(50% - 1px), var(--color-ink-muted) calc(50% - 1px), var(--color-ink-muted) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(135deg, transparent calc(50% - 1px), var(--color-ink-muted) calc(50% - 1px), var(--color-ink-muted) calc(50% + 1px), transparent calc(50% + 1px));
  background-size: 0.45rem 0.45rem, 0.45rem 0.45rem;
  background-position: calc(100% - var(--space-4) - 0.45rem) 50%, calc(100% - var(--space-4)) 50%;
  background-repeat: no-repeat;
  cursor: pointer;
}
.ct-input:focus-visible, .ct-select:focus-visible{ border-color: var(--color-focus); }
.ct-input[aria-invalid="true"] { border-color: var(--status-urgent); }
.ct-fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.ct-fieldset legend { font-weight: var(--weight-medium); padding: 0; margin-bottom: var(--space-1); }
.ct-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-4); }
.ct-form-grid .ct-span-2 { grid-column: 1 / -1; }
@media (max-width: 559px) { .ct-form-grid { grid-template-columns: minmax(0, 1fr); } }

/* Checkbox and choice chips */
.ct-check { display: flex; gap: var(--space-3); align-items: flex-start; min-height: var(--tap-min); padding: var(--space-2) 0; cursor: pointer; }
.ct-check input { width: 1.5em; height: 1.5em; margin: var(--space-1) 0 0; accent-color: var(--color-primary); flex: none; }
.ct-choices { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ct-choice { position: relative; }
.ct-choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.ct-choice span {
  display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-min); padding: 0 var(--space-4);
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); background: var(--color-surface);
}
.ct-choice input:checked + span { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); font-weight: var(--weight-medium); }
.ct-choice input:focus-visible + span { box-shadow: var(--focus-ring); }

/* Chip: tappable sample phrase */
.ct-chip {
  min-height: var(--tap-min); padding: var(--space-2) var(--space-4); border-radius: var(--radius-pill);
  border: 1px dashed var(--color-border-strong); background: var(--color-surface); cursor: pointer; text-align: left;
}
.ct-chip:hover { background: var(--color-primary-soft); border-color: var(--color-primary); }
.ct-chip:disabled { opacity: 0.45; cursor: not-allowed; }

/* Table: stacked cards under 720px */
.ct-table-wrap { overflow-x: auto; }
.ct-table { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
.ct-table th {
  position: sticky; top: 0; background: var(--color-surface); text-align: left; font-size: var(--text-sm);
  color: var(--color-ink-muted); font-weight: var(--weight-medium); padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--color-border-strong);
}
.ct-table td { padding: var(--space-3); border-bottom: 1px solid var(--color-border); vertical-align: top; }
.ct-table tbody tr:hover { background: var(--color-surface-sunken); }
@media (max-width: 719px) {
  .ct-table thead { display: none; }
  .ct-table, .ct-table tbody, .ct-table tr, .ct-table td { display: block; width: 100%; }
  .ct-table tr { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-2) var(--space-3); margin-bottom: var(--space-3); }
  .ct-table td { border: 0; padding: var(--space-2) 0; }
  .ct-table td::before { content: attr(data-label); display: block; color: var(--color-ink-muted); font-size: var(--text-sm); }
}

/* Progress: label always in text */
.ct-progress { display: flex; flex-direction: column; gap: var(--space-1); }
.ct-progress__label { display: flex; justify-content: space-between; gap: var(--space-2); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
.ct-progress__label strong { font-weight: var(--weight-medium); }
.ct-progress progress {
  appearance: none; -webkit-appearance: none; width: 100%; height: var(--space-2); border: 0;
  border-radius: var(--radius-pill); background: var(--color-surface-sunken); overflow: hidden;
}
.ct-progress progress::-webkit-progress-bar { background: var(--color-surface-sunken); border-radius: var(--radius-pill); }
.ct-progress progress::-webkit-progress-value { background: var(--color-primary); border-radius: var(--radius-pill); }
.ct-progress progress::-moz-progress-bar { background: var(--color-primary); border-radius: var(--radius-pill); }
.ct-progress--accent progress::-webkit-progress-value { background: var(--color-accent); }
.ct-progress--accent progress::-moz-progress-bar { background: var(--color-accent); }

/* Metric tile */
.ct-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, calc(50% - var(--space-2))), 1fr)); gap: var(--space-3); }
.ct-metric { background: var(--color-surface-sunken); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); display: flex; flex-direction: column; gap: var(--space-1); }
.ct-metric__value { font-size: var(--text-2xl); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; line-height: var(--leading-tight); }
.ct-metric__label { font-size: var(--text-sm); }
.ct-metric__target { font-size: var(--text-xs); color: var(--color-ink-muted); display: flex; gap: var(--space-1); align-items: center; }
.ct-metric--ok .ct-metric__target { color: var(--status-taken); }
.ct-metric--bad .ct-metric__target { color: var(--status-urgent); }

/* Flag item */
.ct-flag-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.ct-flag-item {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-2) var(--space-4);
  padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface);
}
.ct-flag-item--urgent { border-color: var(--status-urgent); border-left-width: var(--space-1); }
.ct-flag-item--closed { background: var(--color-surface-sunken); }
.ct-flag-item__head { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.ct-flag-item__name { font-weight: var(--weight-bold); }
.ct-flag-item__body { grid-column: 1 / 2; display: flex; flex-direction: column; gap: var(--space-1); }
.ct-flag-item__action { grid-column: 2 / 3; grid-row: 1 / span 2; align-self: center; display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
@media (max-width: 559px) {
  .ct-flag-item { grid-template-columns: minmax(0, 1fr); }
  .ct-flag-item__action { grid-column: 1; grid-row: auto; }
}

/* Quote: the patient's exact words */
.ct-quote { margin: 0; padding-left: var(--space-3); border-left: 3px solid var(--color-accent); font-size: var(--text-lg); }
.ct-quote::before { content: "\201C"; }
.ct-quote::after { content: "\201D"; }

/* Empty state */
.ct-empty { text-align: center; padding: var(--space-6) var(--space-4); color: var(--color-ink-muted); display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.ct-empty .ct-icon { width: 2.25em; height: 2.25em; color: var(--color-border-strong); }

/* Toast */
.ct-toasts { position: fixed; bottom: var(--space-4); left: 50%; transform: translateX(-50%); z-index: 30; display: flex; flex-direction: column; gap: var(--space-2); width: min(420px, calc(100% - var(--space-6))); }
.ct-toast {
  background: var(--color-ink); color: var(--color-ink-inverse); padding: var(--space-3) var(--space-4); border-radius: var(--radius-md);
  box-shadow: var(--shadow-2); display: flex; gap: var(--space-2); align-items: center; animation: ct-toast-in var(--dur-2) var(--ease-out);
}
.ct-toast--error .ct-icon { color: var(--status-urgent-bg); }
@keyframes ct-toast-in { from { opacity: 0; transform: translateY(var(--space-2)); } }

/* List rows inside cards */
.ct-list { list-style: none; padding: 0; margin: 0; }
.ct-list > li { padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-3); align-items: center; justify-content: space-between; }
.ct-list > li:last-child { border-bottom: 0; }

/* Definition list */
.ct-dl { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: var(--space-1) var(--space-4); margin: 0; }
.ct-dl dt { color: var(--color-ink-muted); font-size: var(--text-sm); padding-top: var(--space-1); }
.ct-dl dd { margin: 0; }

/* Week strip */
.ct-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); }
.ct-week__day { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-1); border-radius: var(--radius-md); background: var(--color-surface-sunken); font-variant-numeric: tabular-nums; text-align: center; }
.ct-week__day--today { outline: 2px solid var(--color-primary); }
.ct-week__name { font-size: var(--text-xs); color: var(--color-ink-muted); }
.ct-week__count { font-weight: var(--weight-bold); }
.ct-week__mark { display: flex; }
.ct-week__mark .ct-icon { width: 1.25em; height: 1.25em; }
.ct-week__mark--all { color: var(--status-taken); }
.ct-week__mark--some { color: var(--status-later); }
.ct-week__mark--none { color: var(--status-missed); }

/* Patient phone: keypad phone frame */
.ct-phone__status { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-ink-muted); font-variant-numeric: tabular-nums; }
.ct-phone__caller { text-align: center; display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-2) 0; }
.ct-phone__caller-name { font-size: var(--text-xl); font-weight: var(--weight-bold); }
.ct-phone__avatar { width: var(--space-8); height: var(--space-8); border-radius: var(--radius-pill); background: var(--color-primary-soft); color: var(--color-primary); display: grid; place-items: center; }
.ct-phone__avatar .ct-icon { width: 2em; height: 2em; }
@keyframes ct-ring { 0% { box-shadow: 0 0 0 0 var(--color-primary-soft); } 70% { box-shadow: 0 0 0 var(--space-4) transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.ct-phone__transcript { flex: 1; overflow-y: auto; max-height: 280px; display: flex; flex-direction: column; gap: var(--space-2); font-size: var(--text-md); }
.ct-phone__line { padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); max-width: 92%; }
.ct-phone__line--bot { background: var(--color-primary-soft); align-self: flex-start; }
.ct-phone__line--patient { background: var(--color-accent-soft); align-self: flex-end; }
.ct-phone__line--system { align-self: center; font-size: var(--text-xs); color: var(--color-ink-muted); padding: 0; }
.ct-phone__line-en { display: block; font-size: var(--text-sm); color: var(--color-ink-muted); }
.ct-phone__heard { font-size: var(--text-sm); background: var(--color-surface-sunken); border-radius: var(--radius-sm); padding: var(--space-2) var(--space-3); display: flex; flex-wrap: wrap; gap: var(--space-1) var(--space-2); align-items: center; }
.ct-phone__heard:empty { display: none; }
.ct-phone__live { font-size: var(--text-sm); color: var(--color-ink-muted); min-height: 1.6em; font-style: italic; }
.ct-phone__state { display: flex; align-items: center; justify-content: center; gap: var(--space-2); font-weight: var(--weight-medium); min-height: var(--space-6); }

/* Mic level: five bars set by data-level */
.ct-mic { display: inline-flex; gap: 2px; align-items: flex-end; height: 1.1em; }
.ct-mic span { width: var(--space-1); background: var(--color-border-strong); border-radius: 1px; }
.ct-mic span:nth-child(1) { height: 30%; } .ct-mic span:nth-child(2) { height: 50%; } .ct-mic span:nth-child(3) { height: 70%; }
.ct-mic span:nth-child(4) { height: 85%; } .ct-mic span:nth-child(5) { height: 100%; }
.ct-mic[data-level="1"] span:nth-child(-n+1), .ct-mic[data-level="2"] span:nth-child(-n+2),
.ct-mic[data-level="3"] span:nth-child(-n+3), .ct-mic[data-level="4"] span:nth-child(-n+4),
.ct-mic[data-level="5"] span:nth-child(-n+5) { background: var(--status-taken); }

/* Notice: inline message box */
.ct-notice { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--status-unclear-bg); color: var(--color-ink); }
.ct-notice .ct-icon { color: var(--status-unclear); margin-top: var(--space-1); }
.ct-notice--warn { background: var(--status-later-bg); }
.ct-notice--warn .ct-icon { color: var(--status-later); }

/* ---- Product website: bands, hero, split method, rail, comparison, FAQ ---- */
.ct-band { background: var(--color-bg); }
.ct-band--surface { background: var(--color-surface); }
.ct-band__inner { max-width: var(--content-max); margin: 0 auto; padding: var(--space-8) var(--space-4); }
@media (max-width: 719px) { .ct-band__inner { padding: var(--space-6) var(--space-4); } }

/* Section label: a small heading above a section title (never a pill). */
.ct-eyebrow {
  display: block; margin: 0 0 var(--space-2);
  color: var(--color-primary); font-size: var(--text-xs); font-weight: var(--weight-bold);
  letter-spacing: 0.12em; text-transform: uppercase; line-height: var(--leading-tight);
}

.ct-hero__ctas { display: flex; flex-wrap: wrap; gap: var(--space-3); justify-content: center; margin-top: var(--space-2); }
@media (max-width: 719px) {
        .ct-hero__ctas { justify-content: flex-start; width: 100%; }
  }

.ct-section-head { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); align-items: flex-end; justify-content: space-between; margin-bottom: var(--space-6); }
.ct-section-head__copy { display: flex; flex-direction: column; gap: var(--space-2); max-width: 62ch; }
.ct-section-head__copy h2 { font-size: var(--text-2xl); }

/* Comparison table (desktop grid, mobile stacked cards) */
.ct-compare { border: 1px solid var(--color-border); border-radius: var(--radius-lg); background: var(--color-surface); overflow: hidden; }
.ct-compare__row { display: grid; grid-template-columns: 0.9fr 1.25fr 1.25fr; border-top: 1px solid var(--color-border); }
.ct-compare__row--head { border-top: 0; font-size: var(--text-sm); font-weight: var(--weight-bold); }
.ct-compare__cell { padding: var(--space-4); font-size: var(--text-sm); display: flex; gap: var(--space-2); align-items: flex-start; }
.ct-compare__cell--dim { font-weight: var(--weight-bold); color: var(--color-ink); }
.ct-compare__cell--ours { background: var(--status-taken-bg); color: var(--color-ink); }
.ct-compare__cell--ours .ct-icon { color: var(--status-taken); margin-top: 2px; }
.ct-compare__cell--other { color: var(--color-ink-muted); }
.ct-compare__cell--other .ct-icon { color: var(--color-ink-muted); margin-top: 2px; }
@media (max-width: 799px) {
  .ct-compare__row--head { display: none; }
  .ct-compare__row { grid-template-columns: minmax(0, 1fr); }
  .ct-compare__cell { padding: var(--space-3) var(--space-4); }
  .ct-compare__cell--dim { background: var(--color-surface-sunken); }
}

/* FAQ accordion */
.ct-faq { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr); gap: var(--space-6); align-items: start; }
.ct-faq__list { border-top: 1px solid var(--color-border); }
.ct-faq__item { border-bottom: 1px solid var(--color-border); }
.ct-faq__q {
  cursor: pointer; list-style: none; min-height: var(--tap-min); padding: var(--space-3) 0;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-4);
  font-weight: var(--weight-bold); color: var(--color-ink);
}
.ct-faq__q::-webkit-details-marker { display: none; }
.ct-faq__q::after { content: "+"; font-size: var(--text-xl); color: var(--color-primary); line-height: 1; transition: transform 150ms ease-out; }
.ct-faq__item[open] .ct-faq__q::after { transform: rotate(45deg); }
.ct-faq__a { padding: 0 0 var(--space-4); color: var(--color-ink-muted); font-size: var(--text-md); max-width: 66ch; }
@media (max-width: 819px) { .ct-faq { grid-template-columns: minmax(0, 1fr); gap: var(--space-4); } }

/* ---- Mobile Application Prototype (Tour -> Login -> Setup -> Live App) ---- */
/* The page: the phone stays in view on the left, the controls on the right. */
.ct-mobile-showcase { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: var(--space-6) var(--space-7); align-items: start; }
.ct-mobile-showcase__device { position: sticky; top: calc(var(--space-8) + var(--space-5)); display: flex; justify-content: center; }
.ct-mobile-showcase__head { display: flex; flex-direction: column; gap: var(--space-2); }
.ct-mobile-showcase__head h1 { margin: 0; }
@media (max-width: 899px) {
  .ct-mobile-showcase { grid-template-columns: minmax(0, 1fr); }
  .ct-mobile-showcase__side { display: contents; }
  .ct-mobile-showcase__head { order: 1; }
  .ct-mobile-showcase__device { position: static; order: 2; }
  .ct-mobile-showcase__side > :not(.ct-mobile-showcase__head) { order: 3; }
}
@media (max-height: 700px) and (min-width: 900px) { .ct-mobile-showcase__device { position: static; } }

/* A real smartphone: a 9:19.5 body sized to the screen, an even bezel, side buttons, the island,
   a status bar, a tab bar and the home indicator. The app scrolls inside it; the body never grows. */
.ct-device {
  --dev-h: clamp(36rem, calc(100svh - 9rem), 46rem);
  position: relative; height: var(--dev-h); aspect-ratio: 9 / 19.5; width: auto; max-width: 100%; margin: 0 auto;
  background: var(--color-ink); padding: 0.6rem; border-radius: 3.1rem;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--color-ink-inverse) 12%, transparent), var(--shadow-pill), var(--shadow-2);
  display: flex; flex-direction: column;
}
.ct-device::before, .ct-device::after { content: ""; position: absolute; width: 3px; border-radius: var(--radius-sm); background: var(--color-ink); }
.ct-device::before { left: -3px; top: 18%; height: 12%; }
.ct-device::after { right: -3px; top: 24%; height: 9%; }
.ct-device__notch {
  position: absolute; z-index: 3; top: 1.2rem; left: 50%; transform: translateX(-50%);
  width: 5.5rem; height: 1.55rem; border-radius: var(--radius-pill); background: var(--color-ink);
}
.ct-device__screen {
  position: relative; flex: 1; min-height: 0; background: var(--color-bg); color: var(--color-ink);
  border-radius: 2.5rem; display: flex; flex-direction: column; overflow: hidden;
}
.ct-device__statusbar {
  flex: none; height: 3rem; padding: 0 1.75rem 0.35rem 2rem; display: flex; justify-content: space-between; align-items: center;
  background: var(--color-surface); font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-ink);
}
.ct-device__icons { display: inline-flex; align-items: center; gap: var(--space-2); }
.ct-device__signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 0.7rem; }
.ct-device__signal span { width: 3px; border-radius: 1px; background: var(--color-ink); }
.ct-device__signal span:nth-child(1) { height: 40%; } .ct-device__signal span:nth-child(2) { height: 60%; }
.ct-device__signal span:nth-child(3) { height: 80%; } .ct-device__signal span:nth-child(4) { height: 100%; }
.ct-device__battery { position: relative; width: 1.4rem; height: 0.7rem; border: 1.5px solid var(--color-ink); border-radius: 3px; }
.ct-device__battery::before { content: ""; position: absolute; inset: 1.5px; right: 30%; border-radius: 1px; background: var(--color-ink); }
.ct-device__battery::after { content: ""; position: absolute; right: -4px; top: 30%; width: 2px; height: 40%; border-radius: 1px; background: var(--color-ink); }
.ct-device__body { flex: 1; min-height: 0; padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-4); overflow-y: auto; overscroll-behavior: contain; }
.ct-device__nav {
  flex: none; background: var(--color-surface); border-top: 1px solid var(--color-border);
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--space-1); padding: var(--space-1) var(--space-2) 1.35rem;
}
.ct-device__home {
  position: absolute; z-index: 2; bottom: 0.5rem; left: 50%; transform: translateX(-50%);
  width: 7rem; height: 0.3rem; border-radius: var(--radius-pill); background: var(--color-ink);
}
.ct-device__nav[hidden] + .ct-device__home { bottom: 0.5rem; }
.ct-device__body:has(+ .ct-device__nav[hidden]) { padding-bottom: 1.75rem; }
.ct-device__tab {
  min-height: var(--tap-min); border: 0; border-radius: var(--radius-sm); background: transparent;
  color: var(--color-ink-muted); cursor: pointer; padding: var(--space-1);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: var(--text-xs); font-weight: var(--weight-medium); white-space: nowrap;
}
.ct-device__tab:hover { color: var(--color-ink); background: var(--color-surface-sunken); }
.ct-device__tab[aria-selected="true"] { color: var(--color-primary); background: var(--color-primary-soft); font-weight: var(--weight-bold); }

/* Onboarding slide: the card on top, the dots and Back and Next pinned to the bottom of the screen. */
.ct-mob-slide { display: flex; flex-direction: column; gap: var(--space-3); min-height: 100%; }
.ct-mob-slide h2 { font-size: var(--text-xl); }
.ct-mob-slide .ct-eyebrow { margin: 0; min-width: 0; }
.ct-mob-slide > .ct-row:first-child { flex-wrap: nowrap; }
.ct-mob-slide > .ct-row:first-child .ct-btn { flex: none; }
.ct-mob-slide .ct-card { padding: var(--space-4); gap: var(--space-2); }
.ct-mob-slide .ct-phone__avatar { width: var(--space-7); height: var(--space-7); }
.ct-mob-slide .ct-dots { margin-top: auto; }
.ct-mob-slide__actions { flex-wrap: nowrap; }
.ct-dots { display: flex; gap: var(--space-2); justify-content: center; align-items: center; }
.ct-dot { width: var(--space-2); height: var(--space-2); border-radius: var(--radius-pill); background: var(--color-border-strong); border: 0; padding: 0; }
.ct-dot--active { width: var(--space-5); background: var(--color-primary); }

.ct-otp-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-2); }
.ct-otp-box {
  min-height: var(--tap-min); text-align: center; font-size: var(--text-xl); font-weight: var(--weight-bold);
  font-variant-numeric: tabular-nums; border-radius: var(--radius-md); border: 1px solid var(--color-border-strong); background: var(--color-surface);
}
.ct-otp-box:focus-visible { border-color: var(--color-focus); box-shadow: var(--focus-ring); }

.ct-stage-pills { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ct-stage-pill {
  min-height: var(--tap-min); padding: 0 var(--space-3); border-radius: var(--radius-pill);
  border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-ink-muted);
  font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; display: inline-flex; align-items: center; gap: var(--space-1);
}
.ct-stage-pill:hover { color: var(--color-ink); border-color: var(--color-primary); }
.ct-stage-pill[aria-current="step"] { background: var(--color-primary-soft); border-color: var(--color-primary); color: var(--color-primary); font-weight: var(--weight-bold); }

/* Footer and signature lockup */
.ct-footer { background: var(--color-bg); }
.ct-footer__inner { max-width: var(--content-max); margin: 0 auto; padding: var(--space-7) var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: var(--space-6); font-size: var(--text-sm); color: var(--color-ink-muted); }
.ct-footer__cols { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); gap: var(--space-5) var(--space-4); }
@media (max-width: 959px) {
  .ct-footer__cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ct-footer__about { grid-column: 1 / -1; }
}
@media (max-width: 519px) { .ct-footer__cols { grid-template-columns: minmax(0, 1fr); } }
.ct-footer__about { display: flex; flex-direction: column; gap: var(--space-3); max-width: 44ch; }
.ct-footer__credits { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.ct-footer__col h2 { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-ink); margin-bottom: var(--space-2); }
.ct-footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.ct-footer__col a { display: inline-flex; align-items: center; min-height: var(--tap-min); color: var(--color-ink-muted); text-decoration: none; }
.ct-footer__col a:hover { color: var(--color-primary); text-decoration: underline; }
.ct-footer__plain { gap: var(--space-2) !important; }
.ct-footer__plain li { padding: var(--space-1) 0; }
.ct-signature { display: flex; align-items: center; justify-content: center; gap: var(--space-4); margin: var(--space-6) auto var(--space-4); color: var(--color-ink); }
.ct-signature .ct-logo { width: clamp(3rem, 9vw, 6.5rem); height: clamp(3rem, 9vw, 6.5rem); }
.ct-signature .ct-logo__heart { transform-origin: 14px 16px; animation: ct-heartbeat 2.4s ease-in-out infinite; }
.ct-signature__word { font-size: clamp(2.5rem, 9vw, 6.5rem); font-weight: var(--weight-bold); letter-spacing: -0.03em; line-height: 1; white-space: nowrap; }
@keyframes ct-heartbeat { 0%, 60%, 100% { transform: scale(1); } 10% { transform: scale(1.18); } 20% { transform: scale(0.96); } 30% { transform: scale(1.1); } }
@media (prefers-reduced-motion: reduce) { .ct-signature .ct-logo__heart { animation: none; } }
.ct-footer__bottom {
  border-top: 1px solid var(--color-border); padding-top: var(--space-4);
  display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-5); justify-content: space-between; align-items: center;
}
.ct-footer__bottom nav { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); }
.ct-footer__bottom a { display: inline-flex; align-items: center; min-height: var(--tap-min); }

/* Legal page */
.ct-legal { max-width: 760px; margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-7); }
.ct-legal h1 { margin-bottom: var(--space-4); }
.ct-legal h2 { margin: var(--space-6) 0 var(--space-3); }
.ct-legal p, .ct-legal li { max-width: 68ch; }
.ct-legal li + li { margin-top: var(--space-2); }

/* Logo: a phone with a heart */
.ct-logo { width: 1.75em; height: 1.75em; flex: none; overflow: visible; }
.ct-logo__phone { fill: none; stroke: var(--color-primary); stroke-width: 2.2; }
.ct-logo__heart { fill: var(--color-primary); }
.ct-logo__slot { stroke: var(--color-primary); stroke-width: 2.2; stroke-linecap: round; }
.ct-brand .ct-logo { width: 1.75em; height: 1.75em; }

/* Floating pill navbar: brand, links (Overview, Features menu, Tour, Mobile app, Devices), Call.
   Under 900px the links fold into a Menu panel. Every label stays on one line. */
.ct-pill-header {
  position: sticky;
  top: var(--space-3);
  z-index: 100;
  padding: 0 var(--space-4);
  margin: var(--space-3) 0 var(--space-4);
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.ct-pill-navbar {
  pointer-events: auto;
  position: relative;
  width: 100%;
  max-width: min(1280px, 100%);
  min-height: 68px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-areas: "brand links actions";
  align-items: center;
  gap: var(--space-2) var(--space-4);
  padding: var(--space-2) var(--space-2) var(--space-2) var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-pill);
  box-shadow: var(--shadow-pill);
}
.ct-pill-navbar * { white-space: nowrap; }
.ct-pill-brand {
  grid-area: brand;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  color: var(--color-ink);
  text-decoration: none;
  font-weight: var(--weight-bold);
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}
.ct-nav-links { grid-area: links; display: flex; align-items: center; justify-content: center; gap: var(--space-1); }
.ct-nav-link {
  display: inline-flex; align-items: center; gap: var(--space-1);
  min-height: 44px; padding: 0 var(--space-4);
  border: 0; border-radius: var(--radius-pill); background: transparent; cursor: pointer;
  color: var(--color-ink-muted); font-size: var(--text-md); font-weight: var(--weight-medium); text-decoration: none;
  transition: color 150ms ease-out, background 150ms ease-out;
}
.ct-nav-link:hover { color: var(--color-ink); background: var(--color-surface-sunken); }
.ct-nav-link[aria-current="page"], .ct-nav-dd__btn.is-current { color: var(--color-ink); background: var(--color-surface-sunken); font-weight: var(--weight-bold); }
.ct-nav-dd { position: relative; }
.ct-nav-dd__chev { width: 1em; height: 1em; transition: transform var(--dur-2) var(--ease-out); }
.ct-nav-dd__btn[aria-expanded="true"] .ct-nav-dd__chev { transform: rotate(180deg); }
.ct-nav-dd__panel {
  position: absolute; top: calc(100% + var(--space-3)); left: 50%;
  transform: translate(-50%, calc(-1 * var(--space-2)));
  width: min(620px, 92vw); padding: var(--space-4);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); box-shadow: var(--shadow-2);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--dur-1) var(--ease-out), transform var(--dur-1) var(--ease-out), visibility 0s linear var(--dur-1);
}
.ct-nav-dd__panel.is-open {
  opacity: 1; visibility: visible; pointer-events: auto;
  transform: translate(-50%, 0);
  transition: opacity var(--dur-2) var(--ease-out), transform var(--dur-2) var(--ease-out), visibility 0s linear 0s;
}
.ct-nav-dd__title { font-size: var(--text-sm); color: var(--color-ink-muted); padding: 0 var(--space-3) var(--space-2); }
.ct-nav-dd__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-1); }
.ct-nav-dd__item { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3); border-radius: var(--radius-md); color: var(--color-ink); text-decoration: none; white-space: normal; }
.ct-nav-dd__item * { white-space: normal; }
.ct-nav-dd__item:hover, .ct-nav-dd__item[aria-current="page"] { background: var(--color-surface-sunken); }
.ct-nav-dd__item > .ct-icon { color: var(--color-primary); margin-top: 2px; width: 1.4em; height: 1.4em; }
.ct-nav-dd__item strong { display: block; font-size: var(--text-md); }
.ct-nav-dd__item span span { display: block; font-size: var(--text-sm); color: var(--color-ink-muted); line-height: var(--leading-tight); margin-top: 2px; }
.ct-nav-dd__more { display: inline-flex; align-items: center; gap: var(--space-1); margin: var(--space-2) var(--space-3) 0; font-weight: var(--weight-medium); text-decoration: none; }
.ct-pill-actions { grid-area: actions; display: flex; align-items: center; gap: var(--space-2); }
.ct-btn--pill-cta {
  min-height: var(--tap-min);
  padding: 0 var(--space-5);
  border-radius: var(--radius-pill);
  background: var(--color-cta-lavender);
  border: 1.5px solid var(--color-ink);
  color: var(--color-ink);
  font-size: var(--text-md);
  font-weight: var(--weight-bold);
}
.ct-btn--pill-cta:hover { background: var(--color-cta-lavender-hover); color: var(--color-ink); }
.ct-nav-menu { display: none; }

@media (max-width: 1099px) {
  .ct-nav-link { padding: 0 var(--space-3); font-size: var(--text-sm); }
  .ct-pill-navbar { gap: var(--space-2); padding-left: var(--space-4); }
}

/* Phones and small tablets: brand, Call and Menu; the links open and close smoothly as a drawer. */
@media (max-width: 899px) {
  .ct-pill-header { top: var(--space-2); padding: 0 var(--space-2); margin-top: var(--space-2); }
  .ct-pill-navbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand . actions" "links links links";
    border-radius: var(--radius-lg);
    min-height: 60px;
    row-gap: 0;
    padding: var(--space-2) var(--space-3);
    transition: box-shadow 260ms ease, border-color 260ms ease;
  }
  .ct-pill-brand { font-size: var(--text-md); }
  .ct-btn--pill-cta { min-height: 44px; padding: 0 var(--space-4); font-size: var(--text-sm); }
  .ct-nav-menu {
    display: inline-flex; align-items: center; gap: var(--space-1);
    min-height: 44px; padding: 0 var(--space-3);
    border: 1px solid var(--color-border-strong); border-radius: var(--radius-pill); background: var(--color-surface);
    color: var(--color-ink); font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer;
    transition: background 180ms ease, border-color 180ms ease;
  }
  .ct-nav-menu[aria-expanded="true"] {
    background: var(--color-surface-sunken);
    border-color: var(--color-ink);
  }
  .ct-nav-links {
    display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start;
    gap: var(--space-1);
    max-height: 0; opacity: 0; visibility: hidden; overflow: hidden;
    padding: 0 var(--space-1); margin-top: 0;
    border-top: 1px solid transparent;
    transform: translateY(-6px);
    pointer-events: none;
    transition: max-height 320ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 220ms ease,
                transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
                padding 260ms ease,
                margin-top 260ms ease,
                border-color 220ms ease,
                visibility 0s linear 320ms;
  }
  .ct-pill-navbar.is-open .ct-nav-links {
    max-height: calc(100dvh - 108px);
    opacity: 1; visibility: visible; overflow-y: auto;
    padding: var(--space-3) var(--space-1) var(--space-2);
    margin-top: var(--space-2);
    border-top-color: var(--color-border);
    transform: translateY(0);
    pointer-events: auto;
    transition-delay: 0s;
  }
  .ct-nav-link {
    justify-content: space-between; font-size: var(--text-md);
    min-height: var(--tap-min); padding: 0 var(--space-3);
    border-radius: var(--radius-md);
  }
  .ct-nav-dd { display: flex; flex-direction: column; }
  .ct-nav-dd__panel {
    position: static; transform: none; width: 100%;
    max-height: 0; opacity: 0; visibility: hidden; overflow: hidden;
    padding: 0 var(--space-2); margin: 0;
    background: var(--color-surface-sunken); border: 0; border-radius: var(--radius-md); box-shadow: none;
    transition: max-height 280ms cubic-bezier(0.22, 1, 0.36, 1),
                opacity 200ms ease,
                padding 240ms ease,
                margin 240ms ease,
                visibility 0s linear 280ms;
  }
  .ct-nav-dd__panel.is-open {
    max-height: 680px; opacity: 1; visibility: visible;
    transform: none;
    padding: var(--space-2); margin: var(--space-1) 0;
    transition-delay: 0s;
  }
  .ct-nav-dd__grid { grid-template-columns: minmax(0, 1fr); gap: var(--space-1); }
  .ct-nav-dd__item { padding: var(--space-3); border-radius: var(--radius-md); background: var(--color-surface); }
  .ct-nav-dd__more { margin: var(--space-2) var(--space-2) var(--space-1); padding: var(--space-1) 0; }
  .ct-nav-dd__title { display: none; }
}
@media (max-width: 380px) {
  .ct-btn--pill-cta span { display: none; }
  .ct-btn--pill-cta { padding: 0 var(--space-3); }
}

/* Simulated clock on role screens */
.ct-simclock { display: inline-flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-4); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); background: var(--color-surface-sunken); font-size: var(--text-sm); color: var(--color-ink-muted); font-variant-numeric: tabular-nums; }
.ct-simclock strong { color: var(--color-ink); font-weight: var(--weight-medium); }
/* On the Patient phone screen the clock sits centred right above the phone. */
.ct-phone-page__device > .ct-simclock { display: flex; width: max-content; max-width: 100%; margin: 0 auto var(--space-3); }

/* Editorial Hero Typography */
/* Hero headline: both sentences on one line on wide screens; on narrow screens
   each sentence keeps its own single line. A sentence never breaks inside. */
.ct-hero__sentence { display: inline-block; white-space: nowrap; }
@media (max-width: 1099px) {
    .ct-hero__sentence { display: block; }
}

.ct-hero__serif-italic {
  font-family: var(--font-serif);
  font-style: italic;
  color: var(--color-primary);
}

.ct-btn--hero-cta {
  background: var(--color-cta-lavender);
  border: 1.5px solid var(--color-ink);
  color: var(--color-ink);
  border-radius: var(--radius-md);
  padding: 0 var(--space-5);
  font-weight: var(--weight-bold);
  box-shadow: 0 2px 8px rgba(27, 31, 36, 0.08);
  transition: all 200ms ease;
}

.ct-btn--hero-cta:hover {
  background: var(--color-cta-lavender-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(110, 70, 200, 0.14);
}

/* Stage Cards */

@keyframes ct-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Neat & Clean Role Screens Polish (#desk, #nurse, #phone, #family, #doctor) */
#view.ct-page {
  animation: ct-fade-up 320ms cubic-bezier(0.16, 1, 0.3, 1);
}

#view.ct-page h1 {
  font-family: var(--font-serif);
  font-size: var(--text-3xl);
  font-weight: var(--weight-regular);
  letter-spacing: -0.02em;
}

/* Scroll reveals (public/js/motion.js). Hidden only after the script adds html.ct-motion,
   which never happens under reduced motion, so without it every block is visible.
   Opacity and transform only, so nothing shifts the layout. */
html.ct-motion [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 24px, 0);
  transition: opacity 400ms cubic-bezier(0.22, 1, 0.36, 1), transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}
html.ct-motion [data-reveal="left"] { transform: translate3d(-24px, 0, 0); }
html.ct-motion [data-reveal="right"] { transform: translate3d(24px, 0, 0); }
html.ct-motion [data-reveal-group] > * {
  opacity: 0;
  transform: translate3d(0, 18px, 0);
  transition: opacity 350ms cubic-bezier(0.22, 1, 0.36, 1), transform 350ms cubic-bezier(0.22, 1, 0.36, 1),
    translate var(--dur-2) var(--ease-out), box-shadow var(--dur-2) var(--ease-out), border-color var(--dur-2) var(--ease-out);
}
html.ct-motion [data-reveal-group] > :nth-child(2) { transition-delay: 60ms; }
html.ct-motion [data-reveal-group] > :nth-child(3) { transition-delay: 120ms; }
html.ct-motion [data-reveal-group] > :nth-child(4) { transition-delay: 180ms; }
html.ct-motion [data-reveal-group] > :nth-child(5) { transition-delay: 240ms; }
html.ct-motion [data-reveal-group] > :nth-child(6) { transition-delay: 300ms; }
html.ct-motion [data-reveal-group] > :nth-child(7) { transition-delay: 360ms; }
html.ct-motion [data-reveal-group] > :nth-child(8) { transition-delay: 420ms; }
html.ct-motion [data-reveal-group] > :nth-child(9) { transition-delay: 480ms; }
html.ct-motion [data-reveal-group] > :nth-child(10) { transition-delay: 540ms; }
html.ct-motion [data-reveal-group] > :nth-child(11) { transition-delay: 600ms; }
html.ct-motion [data-reveal-group] > :nth-child(12) { transition-delay: 660ms; }
html.ct-motion [data-reveal-group] > :nth-child(13) { transition-delay: 720ms; }
html.ct-motion [data-reveal-group] > :nth-child(14) { transition-delay: 780ms; }
html.ct-motion [data-reveal][data-revealed],
html.ct-motion [data-reveal-group][data-revealed] > * { opacity: 1; transform: none; }
html.ct-motion [data-reveal-group][data-settled] > * { transition-delay: 0s; }

/* Landing cards share one hover: a small lift and a deeper shadow. It uses translate, so it never
   fights the reveal's transform, and its transition lives in the reveal rule above. */
.ct-people__fig { transition: translate var(--dur-2) var(--ease-out); }
.ct-every__item:hover, .ct-role-tile:hover, .ct-persona:hover { translate: 0 calc(-1 * var(--space-1)); box-shadow: var(--shadow-2); }
.ct-people__fig:hover { translate: 0 calc(-1 * var(--space-1)); }
@media (prefers-reduced-motion: reduce) {
  .ct-every__item:hover, .ct-role-tile:hover, .ct-persona:hover, .ct-people__fig:hover { translate: none; }
}
html.ct-motion .ct-reveal--delay-1 { transition-delay: 60ms; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }

/* Numbered index (01, 02, ...): two columns of ruled rows */
.ct-index { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 var(--space-6); margin-top: var(--space-6); list-style: none; padding: 0; }
.ct-index__row { display: grid; grid-template-columns: 2.5rem minmax(0, 1fr); gap: var(--space-3); padding: var(--space-5) 0; border-top: 1px solid var(--color-border); align-items: baseline; }
.ct-index__num { font-size: var(--text-sm); font-weight: var(--weight-bold); color: var(--color-primary); font-variant-numeric: tabular-nums; }
.ct-index__row h3 { font-size: var(--text-lg); }
.ct-index__row p { margin-top: var(--space-1); color: var(--color-ink-muted); }
@media (max-width: 899px) { .ct-index { grid-template-columns: minmax(0, 1fr); } }

@media (prefers-reduced-motion: reduce) {
  .ct-reveal {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
}

/* Voice to report ribbon (public/js/voice-ribbon.js) */
@keyframes ct-bar { 0%, 100% { transform: scaleY(0.2); } 50% { transform: scaleY(1); } }

/* The report as it lands in Care Taker */

.ct-section-title-lg { font-family: var(--font-serif); font-weight: var(--weight-regular); font-size: clamp(1.75rem, 3vw, 2.5rem); letter-spacing: -0.02em; margin-top: var(--space-3); max-width: 26ch; }
.ct-section-lead { margin-top: var(--space-3); font-size: var(--text-lg); color: var(--color-ink-muted); max-width: 64ch; }

/* Health devices screen */
.ct-feedback { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.ct-feedback__item { display: flex; gap: var(--space-3); align-items: flex-start; padding: var(--space-3) var(--space-4); border-radius: var(--radius-md); background: var(--color-surface-sunken); }
.ct-feedback__item .ct-icon { margin-top: var(--space-1); color: var(--status-unclear); }
.ct-feedback__item--ok .ct-icon { color: var(--status-taken); }
.ct-feedback__item--flag { background: var(--status-later-bg); }
.ct-feedback__item--flag .ct-icon { color: var(--status-later); }
.ct-dv-kind { display: flex; gap: var(--space-3); align-items: flex-start; min-width: 0; }
.ct-dv-kind > .ct-icon { color: var(--color-primary); margin-top: var(--space-1); }
.ct-dv-tables { margin-top: var(--space-5); }
.ct-dv-tables h3 { margin-bottom: var(--space-2); }
.ct-dv-week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-2); align-items: end; }
.ct-dv-week__day { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); font-variant-numeric: tabular-nums; }
.ct-dv-week__name { font-size: var(--text-xs); color: var(--color-ink-muted); }
.ct-dv-week__val { font-size: var(--text-xs); font-weight: var(--weight-medium); }
.ct-dv-week__day--today .ct-dv-week__name { color: var(--color-primary); font-weight: var(--weight-bold); }
.ct-dv-week__bar { appearance: none; -webkit-appearance: none; width: var(--space-6); height: calc(var(--space-8) * 1.5); writing-mode: vertical-lr; direction: rtl; border: 0; border-radius: var(--radius-sm); background: var(--color-surface-sunken); overflow: hidden; }
.ct-dv-week__bar::-webkit-progress-bar { background: var(--color-surface-sunken); border-radius: var(--radius-sm); }
.ct-dv-week__bar::-webkit-progress-value { background: var(--color-border-strong); border-radius: var(--radius-sm); }
.ct-dv-week__bar::-moz-progress-bar { background: var(--color-border-strong); }
.ct-dv-week__bar.is-met::-webkit-progress-value { background: var(--color-primary); }
.ct-dv-week__bar.is-met::-moz-progress-bar { background: var(--color-primary); }
.ct-metric--hint { background: var(--color-surface); border: 1px dashed var(--color-border-strong); justify-content: center; }
.ct-form-grid--3 { grid-template-columns: repeat(auto-fill, minmax(min(180px, 100%), 1fr)); }
.ct-dr-patient { max-width: 320px; }
@media (max-width: 899px) { .ct-nav-dd__btn { width: 100%; } }

/* ==========================================================================
   Home, 28 Nov: hero with a live call, pinned stories, languages, devices
   ========================================================================== */
.ct-hero2 {
  max-width: var(--content-max); margin: 0 auto; padding: var(--space-6) var(--space-4) var(--space-7);
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--space-6); align-items: center;
}
.ct-hero2__copy { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-4); }
.ct-hero2__title { font-family: var(--font-serif); font-weight: var(--weight-regular); font-size: clamp(2.1rem, 4.2vw, 3.6rem); line-height: 1.08; letter-spacing: -0.025em; margin: 0; }
.ct-hero2__title .ct-hero__sentence { display: block; }
.ct-hero2__one { font-size: var(--text-lg); font-weight: var(--weight-bold); margin-top: var(--space-2); }
.ct-hero2__lead { font-size: var(--text-lg); color: var(--color-ink-muted); max-width: 52ch; margin-top: var(--space-1); }
.ct-hero2__note { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-ink-muted); }
.ct-hero2 .ct-hero__ctas { justify-content: flex-start; margin-top: var(--space-1); }

/* Mobile word-stream connector into top of phone (hidden on desktop where left-to-right stream connects) */

@media (max-width: 959px) {
  .ct-hero2 { grid-template-columns: minmax(0, 1fr); padding-top: var(--space-4); gap: var(--space-4); }
      .ct-hcall {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
      "mstream mstream"
      "phone reports";
  }
        .ct-hcall__phone { grid-area: phone; }
  }
@media (max-width: 559px) {
  .ct-hero2__title { font-size: clamp(1.7rem, 8.4vw, 2.3rem); }
  .ct-hero2__one, .ct-hero2__lead { font-size: var(--text-md); }
  .ct-hero2 .ct-hero__ctas { width: 100%; }
  .ct-hero2 .ct-hero__ctas .ct-btn { flex: 1 1 100%; }
}

/* Hero call: a smartphone on a call, and the reports it creates */
.ct-hcall { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--space-5); align-items: center; }
.ct-hcall__phone { position: relative; width: 248px; aspect-ratio: 9 / 18.5; background: var(--color-ink); border-radius: 38px; padding: 10px; box-shadow: var(--shadow-2); }
.ct-hcall__notch { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); width: 72px; height: 18px; border-radius: var(--radius-pill); background: var(--color-ink); z-index: 2; }
.ct-hcall__screen { height: 100%; border-radius: 30px; background: var(--color-surface); display: flex; flex-direction: column; overflow: hidden; }
.ct-hcall__status { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px 0; font-size: var(--text-xs); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.ct-hcall__net { display: inline-flex; gap: 2px; align-items: flex-end; height: 10px; }
.ct-hcall__net span { width: 3px; background: var(--color-ink); border-radius: 1px; }
.ct-hcall__net span:nth-child(1) { height: 40%; } .ct-hcall__net span:nth-child(2) { height: 70%; } .ct-hcall__net span:nth-child(3) { height: 100%; }
.ct-hcall__caller { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: var(--space-4) var(--space-3) var(--space-2); text-align: center; }
.ct-hcall__avatar { width: 56px; height: 56px; border-radius: var(--radius-pill); background: var(--color-primary-soft); display: grid; place-items: center; margin-bottom: var(--space-1); }
.ct-hcall__avatar .ct-logo { width: 32px; height: 32px; }
.ct-hcall[data-state="ringing"] .ct-hcall__avatar { animation: ct-ring 1.4s ease-out infinite; }
.ct-hcall__caller strong { font-size: var(--text-md); }
.ct-hcall__sub { font-size: var(--text-xs); color: var(--color-ink-muted); }
.ct-hcall__talk { flex: 1; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; gap: var(--space-2); padding: var(--space-2) var(--space-3); }
.ct-hcall__bubble { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-sm); line-height: var(--leading-tight); max-width: 90%; animation: ct-bubble-in 300ms cubic-bezier(0.22, 1, 0.36, 1); }
.ct-hcall__bubble--bot { align-self: flex-start; background: var(--color-primary-soft); border-bottom-left-radius: var(--radius-sm); }
.ct-hcall__bubble--patient { align-self: flex-end; background: var(--color-accent-soft); border-bottom-right-radius: var(--radius-sm); }
.ct-hcall__gloss { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--color-ink-muted); }
@keyframes ct-bubble-in { from { opacity: 0; transform: translateY(8px); } }
.ct-hcall__foot { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); padding: var(--space-2) var(--space-3) var(--space-4); border-top: 1px solid var(--color-border); }
.ct-hcall__bars { display: flex; gap: 3px; align-items: center; height: 22px; }
.ct-hcall__bars span { width: 3px; height: 100%; border-radius: var(--radius-pill); background: var(--color-border-strong); transform: scaleY(0.25); }
.ct-hcall[data-state="speaking"] .ct-hcall__bars span { background: var(--color-primary); animation: ct-bar 700ms ease-in-out infinite; }
.ct-hcall[data-state="listening"] .ct-hcall__bars span { background: var(--color-accent); animation: ct-bar 900ms ease-in-out infinite; }
.ct-hcall__bars span:nth-child(2n) { animation-delay: -200ms; } .ct-hcall__bars span:nth-child(3n) { animation-delay: -450ms; }
.ct-hcall__state { display: inline-flex; align-items: center; gap: var(--space-1); font-size: var(--text-xs); font-weight: var(--weight-bold); color: var(--color-ink-muted); white-space: nowrap; }
.ct-hcall[data-state="done"] .ct-hcall__state { color: var(--status-taken); }
.ct-hcall[data-state="urgent"] .ct-hcall__state { color: var(--status-urgent); }
@media (max-width: 559px) {
  .ct-hcall {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "mstream"
      "phone"
      "reports";
    justify-items: center;
    gap: var(--space-4);
  }
  .ct-hcall__phone { width: min(260px, 78vw); }
          }

/* Pinned story: the section holds still while its steps advance with the scroll */
.ct-story { position: relative; background: var(--color-ink); color: var(--color-ink-inverse); }
.ct-story--4 { height: 360vh; }
.ct-story--6 { height: 520vh; }
.ct-story__sticky { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: center; gap: var(--space-5); max-width: var(--content-max); margin: 0 auto; padding: 96px var(--space-4) var(--space-6); }
.ct-story__head { text-align: center; display: flex; flex-direction: column; align-items: center; }
.ct-story__head .ct-section-title-lg { color: var(--color-ink-inverse); max-width: none; }
.ct-story .ct-eyebrow { color: var(--color-accent); }
.ct-story__body { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-5); align-items: center; }
.ct-story__tabs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.ct-story__tab {
  width: 100%; display: flex; align-items: center; gap: var(--space-3); min-height: var(--tap-min); padding: var(--space-2) var(--space-3);
  border: 0; border-radius: var(--radius-pill); background: transparent; color: rgba(255, 255, 255, 0.62); font-size: var(--text-md); font-weight: var(--weight-medium); text-align: left; cursor: pointer;
  transition: background 250ms ease-out, color 250ms ease-out;
}
.ct-story__tab .ct-icon { width: 2.1em; height: 2.1em; padding: 0.45em; border-radius: var(--radius-pill); background: rgba(255, 255, 255, 0.08); }
.ct-story__tab:hover { color: var(--color-ink-inverse); }
.ct-story__tab.is-done { color: rgba(255, 255, 255, 0.8); }
.ct-story__tab.is-active { background: var(--color-surface); color: var(--color-ink); box-shadow: var(--shadow-2); }
.ct-story__tab.is-active .ct-icon { background: var(--color-ink); color: var(--color-ink-inverse); }
.ct-story__stage { position: relative; min-height: 460px; }
.ct-story__panel {
  position: absolute; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: var(--space-6); align-items: center;
  opacity: 0; visibility: hidden; transform: translateY(24px); transition: opacity 450ms cubic-bezier(0.22, 1, 0.36, 1), transform 450ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 450ms;
}
.ct-story__panel.is-active { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.ct-story__copy { display: flex; flex-direction: column; gap: var(--space-3); align-items: flex-start; }
.ct-story__step { font-size: var(--text-sm); color: var(--color-accent); font-weight: var(--weight-bold); font-variant-numeric: tabular-nums; }
.ct-story__copy h3 { font-size: clamp(1.6rem, 2.6vw, 2.25rem); line-height: 1.15; letter-spacing: -0.015em; }
.ct-story__copy p { color: rgba(255, 255, 255, 0.78); font-size: var(--text-lg); }
.ct-story__copy ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.ct-story__copy li { display: flex; gap: var(--space-2); align-items: flex-start; }
.ct-story__copy li .ct-icon { margin-top: 3px; color: var(--color-accent); }
.ct-btn--on-dark { background: var(--color-surface); color: var(--color-ink); border-radius: var(--radius-pill); margin-top: var(--space-2); }
.ct-btn--on-dark:hover { background: var(--color-primary-soft); color: var(--color-ink); }

/* UI cards inside the stories */
.ct-ui__row { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); background: var(--color-surface-sunken); font-size: var(--text-sm); }
.ct-ui__row > span:first-child { display: inline-flex; align-items: center; gap: var(--space-2); }
.ct-ui__ok { background: var(--status-taken-bg); color: var(--status-taken); font-weight: var(--weight-bold); }
.ct-ui__bubble { margin: 0; padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); font-size: var(--text-md); line-height: var(--leading-tight); max-width: 92%; }
.ct-ui__bubble span { display: block; margin-top: 2px; font-size: var(--text-xs); color: var(--color-ink-muted); }
.ct-ui__bubble--bot { align-self: flex-start; background: var(--color-primary-soft); }
.ct-ui__bubble--patient { align-self: flex-end; background: var(--color-accent-soft); }
.ct-ui__bubble .ct-icon { display: inline; vertical-align: -0.2em; }
.ct-ui__wave { display: inline-flex; gap: 3px; align-items: center; height: 18px; }
.ct-ui__wave span { width: 3px; height: 100%; border-radius: var(--radius-pill); background: var(--color-primary); animation: ct-bar 800ms ease-in-out infinite; }
.ct-ui__wave span:nth-child(2n) { animation-delay: -250ms; } .ct-ui__wave span:nth-child(3n) { animation-delay: -500ms; }
.ct-ui__week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: var(--space-1); }
.ct-ui__week span { display: flex; flex-direction: column; align-items: center; padding: var(--space-1) 0; border-radius: var(--radius-sm); background: var(--color-surface-sunken); font-size: var(--text-xs); font-variant-numeric: tabular-nums; min-height: 44px; }
.ct-ui__week b { font-weight: var(--weight-medium); color: var(--color-ink-muted); }
.ct-ui__week .is-ok { background: var(--status-taken-bg); color: var(--status-taken); font-weight: var(--weight-bold); }
.ct-ui__week .is-some { background: var(--status-later-bg); color: var(--status-later); font-weight: var(--weight-bold); }

/* Stories on phones and tablets, or with reduced motion: no pinning, the steps stack */
@media (max-width: 899px), (prefers-reduced-motion: reduce) {
  .ct-story--4, .ct-story--6 { height: auto; }
  .ct-story__sticky { position: static; height: auto; padding: var(--space-7) var(--space-4); }
  .ct-story__tabs { display: none; }
  .ct-story__body { grid-template-columns: minmax(0, 1fr); }
  .ct-story__stage { min-height: 0; display: flex; flex-direction: column; gap: var(--space-7); }
  .ct-story__panel { position: static; opacity: 1; visibility: visible; transform: none; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); }
}

/* Languages */
.ct-split2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: var(--space-7); align-items: center; }
.ct-checks { list-style: none; padding: 0; margin: var(--space-4) 0 0; display: flex; flex-direction: column; gap: var(--space-2); }
.ct-checks li { display: flex; gap: var(--space-2); align-items: flex-start; }
.ct-checks .ct-icon { color: var(--status-taken); margin-top: 3px; }
@media (max-width: 899px) { .ct-split2 { grid-template-columns: minmax(0, 1fr); gap: var(--space-5); } }

/* Every device */
.ct-center-head { text-align: center; display: flex; flex-direction: column; align-items: center; }
.ct-center-head .ct-section-title-lg { max-width: none; }
.ct-every { list-style: none; padding: 0; margin: var(--space-6) 0 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); }
.ct-every__item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--space-1); padding: var(--space-5) var(--space-4); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
.ct-every__icon { width: 64px; height: 64px; fill: none; stroke: var(--color-primary); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; margin-bottom: var(--space-2); }
.ct-every__item span { font-size: var(--text-sm); color: var(--color-ink-muted); }
@media (max-width: 899px) { .ct-every { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ct-row--nowrap { flex-wrap: nowrap; }
.ct-row--nowrap > .ct-select, .ct-row--nowrap > .ct-input { flex: 1 1 auto; min-width: 0; }
/* Language picker (patient app) */
.ct-langpick__grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.ct-langpick__btn { display: flex; flex-direction: column; align-items: flex-start; min-height: var(--tap-min); padding: var(--space-2) var(--space-3); border-radius: var(--radius-md); border: 1px solid var(--color-border-strong); background: var(--color-surface); cursor: pointer; text-align: left; }
.ct-langpick__btn strong { font-size: var(--text-md); }
.ct-langpick__btn span { font-size: var(--text-xs); color: var(--color-ink-muted); }
.ct-langpick__btn[aria-pressed="true"] { border-color: var(--color-primary); background: var(--color-primary-soft); box-shadow: inset 0 0 0 1px var(--color-primary); }
.ct-chip--lang { display: inline-flex; align-items: center; gap: var(--space-1); min-height: 36px; padding: 0 var(--space-3); margin-top: var(--space-1); font-size: var(--text-sm); border-style: solid; }

/* On a real phone the prototype is the app: no bezel, full width, the page scrolls instead. */
@media (max-width: 479px) {
  .ct-device { height: auto; aspect-ratio: auto; width: 100%; padding: 0; background: transparent; box-shadow: none; border-radius: 0; }
  .ct-device::before, .ct-device::after, .ct-device__notch, .ct-device__home { display: none; }
  .ct-device__screen { border: 1px solid var(--color-border); border-radius: var(--radius-lg); overflow: visible; }
  .ct-device__statusbar { height: auto; padding: var(--space-2) var(--space-4); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
  .ct-device__body { overflow: visible; padding-bottom: var(--space-4); }
  .ct-device__nav { position: sticky; bottom: 0; z-index: 5; padding-bottom: var(--space-1); }
}
/* ==========================================================================
   Footer signature loop (public/js/signature.js). Everything is sized in em of
   .ct-sig, so the whole mark scales as one piece from phones to desktops.
   ========================================================================== */
.ct-sig { display: flex; align-items: center; justify-content: center; gap: 0.18em; font-size: clamp(2rem, 8vw, 5.5rem); line-height: 1; color: var(--color-ink); user-select: none; }

/* Phone */
.ct-sig__track { position: relative; display: flex; align-items: center; }
.ct-sig__phone { position: relative; flex: none; width: 1.05em; height: 1.5em; border: 0.075em solid var(--color-primary); border-radius: 0.22em; background: var(--color-surface); display: grid; place-items: center; z-index: 1; }
.ct-sig__phone > * { grid-area: 1 / 1; }
.ct-sig__heart { width: 0.52em; height: 0.52em; fill: var(--color-primary); transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out); }
.ct-sig__tick { width: 0.62em; height: 0.62em; fill: none; stroke: var(--status-taken); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.ct-sig__tick circle { stroke-dasharray: 54; stroke-dashoffset: 54; transition: stroke-dashoffset 450ms var(--ease-out); }
.ct-sig__tick path { stroke-dasharray: 14; stroke-dashoffset: 14; transition: stroke-dashoffset 300ms var(--ease-out) 200ms; }
.ct-sig__slot { align-self: end; margin-bottom: 0.12em; width: 0.28em; height: 0.05em; border-radius: var(--radius-pill); background: var(--color-primary); }

/* Label beside the phone: the wordmark, and Check in on the same spot */
.ct-sig__label { position: relative; margin-left: 1.3em; font-weight: var(--weight-bold); letter-spacing: -0.03em; white-space: nowrap; }

/* ---- phases ---- */

.ct-sig[data-phase="recorded"] .ct-sig__heart { opacity: 0; transform: scale(0.9); }
.ct-sig[data-phase="recorded"] .ct-sig__phone { animation: ct-sig-pulse 500ms var(--ease-out); }
@keyframes ct-sig-pulse { 50% { transform: scale(1.06); } }

.ct-sig[data-phase="tick"] .ct-sig__heart,
.ct-sig[data-phase="checkin"] .ct-sig__heart,
.ct-sig[data-phase="sweep"] .ct-sig__heart { opacity: 0; transform: scale(0.9); transition: none; }
.ct-sig[data-phase="tick"] .ct-sig__tick,
.ct-sig[data-phase="checkin"] .ct-sig__tick,
.ct-sig[data-phase="sweep"] .ct-sig__tick { opacity: 1; }
.ct-sig[data-phase="tick"] .ct-sig__tick circle, .ct-sig[data-phase="tick"] .ct-sig__tick path,
.ct-sig[data-phase="checkin"] .ct-sig__tick circle, .ct-sig[data-phase="checkin"] .ct-sig__tick path,
.ct-sig[data-phase="sweep"] .ct-sig__tick circle, .ct-sig[data-phase="sweep"] .ct-sig__tick path { stroke-dashoffset: 0; }

/* Phones: a shorter lane, readable words, and Recorded shown just under the phone */
@media (max-width: 559px) {
  .ct-sig { font-size: 2.1rem; }
      .ct-sig__phone { overflow: visible; }
  }

@media (prefers-reduced-motion: reduce) {
  .ct-sig, .ct-sig * { animation: none !important; transition: none !important; }
}

/* ==========================================================================
   Skeleton loaders and retry error state (P0)
   ========================================================================== */
.ct-skeleton {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2) 0;
  min-height: calc(var(--space-7) * 2);
}
.ct-skeleton__bar {
  display: block;
  height: var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--color-surface-sunken);
  width: 100%;
}
.ct-skeleton__bar:nth-child(2) { width: 82%; }
.ct-skeleton__bar:nth-child(3) { width: 64%; }
.ct-skeleton__bar:nth-child(4) { width: 76%; }
@media (prefers-reduced-motion: no-preference) {
  .ct-skeleton__bar {
    animation: ct-skel-pulse 1.2s var(--ease-in-out) infinite;
  }
  .ct-skeleton__bar:nth-child(2) { animation-delay: var(--stagger); }
  .ct-skeleton__bar:nth-child(3) { animation-delay: calc(var(--stagger) * 2); }
}
@keyframes ct-skel-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.48; }
}
/* The page skeleton every screen starts with. */
.ct-page-skeleton { display: flex; flex-direction: column; gap: var(--space-3); padding-top: var(--space-7); }
.ct-page-skeleton__title { width: min(22rem, 60%); height: var(--space-6); }
.ct-page-skeleton__line { width: min(34rem, 85%); }
.ct-page-skeleton__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-5); margin-top: var(--space-5); }
.ct-page-skeleton__card { padding: var(--space-5); border-radius: var(--radius-lg); background: var(--color-surface); border: 1px solid var(--color-border); }
@media (max-width: 719px) { .ct-page-skeleton__cards { grid-template-columns: minmax(0, 1fr); } }
.ct-loaded-fade {
  animation: ct-skel-reveal var(--dur-3) var(--ease-out);
}
@keyframes ct-skel-reveal {
  from { opacity: 0; }
  to { opacity: 1; }
}
.ct-error-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  border-radius: var(--radius-md);
  background: var(--status-urgent-bg);
  color: var(--status-urgent);
  font-weight: var(--weight-medium);
}
@media (prefers-reduced-motion: reduce) {
  .ct-skeleton__bar, .ct-loaded-fade { animation: none !important; }
}

/* ==========================================================================
   Dose confirmation chip (ct-dose-chip, P1)
   ========================================================================== */
.ct-phone__chip:empty { display: none; }
.ct-dose-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: var(--tap-min);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-md);
  font-size: var(--text-md);
  line-height: var(--leading-tight);
  white-space: normal;
  word-break: break-word;
  border: 1px solid var(--color-border-strong);
}
#ph-chip .ct-dose-chip,
#mb-body .ct-dose-chip {
  view-transition-name: dose-chip;
}
.ct-dose-chip[data-state="taken"] {
  border-color: var(--status-taken);
}
.ct-dose-chip[data-state="urgent"] {
  border-color: var(--status-urgent);
}
.ct-dose-chip__body {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-1) var(--space-2);
  min-width: 0;
}
.ct-dose-chip__label {
  font-weight: var(--weight-bold);
}
.ct-dose-chip.is-entering[data-state="pending"] {
  animation: ct-chip-rise var(--dur-2) var(--ease-out);
}
.ct-dose-chip.is-entering[data-state="taken"] {
  animation: ct-chip-rise var(--dur-2) var(--ease-out);
}
.ct-dose-chip.is-entering[data-state="taken"] .ct-dose-chip__stroke {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: ct-check-stroke var(--dur-3) var(--ease-out) forwards;
}
.ct-dose-chip.is-entering[data-state="taken"] .ct-dose-chip__time {
  display: inline-block;
  animation: ct-time-pop var(--dur-3) var(--ease-out);
}
@keyframes ct-chip-rise {
  from { opacity: 0; transform: translateY(var(--space-2)); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes ct-check-stroke {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}
@keyframes ct-time-pop {
  0% { opacity: 0; transform: translateY(var(--space-1)) scale(0.92); }
  60% { opacity: 1; transform: translateY(-1px) scale(1.04); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .ct-dose-chip, .ct-dose-chip * {
    animation: none !important;
    transition: none !important;
  }
}

/* ==========================================================================
   Live poll diff animations: row highlight, counter pop, flag stack-in (P2)
   ========================================================================== */
@media (prefers-reduced-motion: no-preference) {
  .ct-row-changed {
    animation: ct-row-flash var(--dur-3) var(--ease-out);
  }
  .ct-metric--pop .ct-metric__value,
  .ct-week__count--pop {
    display: inline-block;
    animation: ct-val-pop var(--dur-2) var(--ease-out);
  }
  .ct-flag-item--enter {
    animation: ct-flag-stack var(--dur-3) var(--ease-out);
  }
}
@keyframes ct-row-flash {
  0% { background-color: var(--color-primary-soft); }
  100% { background-color: transparent; }
}
@keyframes ct-val-pop {
  0% { transform: translateY(4px) scale(0.94); opacity: 0.5; }
  60% { transform: translateY(-1px) scale(1.04); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes ct-flag-stack {
  from { opacity: 0; transform: translateY(calc(-1 * var(--space-2))) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Home: sections alternate cream and white, and every white one fades in from the cream and back
   out to it, so there is never a hard edge and the page reads as one continuous screen. Each section
   keeps one even rhythm: 48px above and below its content (32px on phones), never a forced height. */
.ct-home > .ct-band, .ct-home > .ct-people { background: var(--color-bg); }
.ct-home > .ct-band--surface {
  background: linear-gradient(to bottom, var(--color-bg) 0%, var(--color-surface) 14%, var(--color-surface) 86%, var(--color-bg) 100%);
}
.ct-home > .ct-band > .ct-page, .ct-home > .ct-band > .ct-band__inner, .ct-home > .ct-people > .ct-people__inner {
  padding-top: var(--space-7); padding-bottom: var(--space-7);
}
@media (max-width: 719px) {
  .ct-home > .ct-band > .ct-page, .ct-home > .ct-band > .ct-band__inner, .ct-home > .ct-people > .ct-people__inner {
    padding-top: var(--space-6); padding-bottom: var(--space-6);
  }
}
[id] { scroll-margin-top: calc(var(--space-8) + var(--space-5)); }
.ct-story[id] { scroll-margin-top: 0; }

/* Persona cards on home: the same rhythm in both (label, title, text, list, actions), and the
   actions sit on the same line at the bottom of both cards whatever the text length. */
.ct-persona { display: flex; flex-direction: column; gap: var(--space-3); }
.ct-persona .ct-eyebrow { margin: 0; }
.ct-persona .ct-section-title { margin: 0; }
.ct-persona > p { min-height: calc(3 * var(--leading-body) * 1em); }
.ct-persona__actions { margin-top: auto; padding-top: var(--space-2); }

/* Page head on role screens: the title on the left; the patient picker and any page actions on the
   right, sitting on the title's baseline. On phones the tools go under the title, full width. */
.ct-page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--space-4) var(--space-6); }
.ct-page-head__title { min-width: 0; flex: 1 1 22rem; }
.ct-page-head__title h1 { margin: 0 0 var(--space-1); }
.ct-page-head__tools { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--space-3); }
.ct-field--picker { min-width: 14rem; gap: var(--space-1); }
@media (max-width: 719px) {
  .ct-page-head__tools { width: 100%; }
  .ct-page-head__tools > * { flex: 1 1 100%; }
}

/* Today on the devices screen: the tiles always fill the row. */
.ct-metrics--fill { grid-template-columns: repeat(auto-fit, minmax(min(12rem, 100%), 1fr)); }

/* Add a device: the kinds of device as a grid of tiles, three across on a laptop. */
.ct-dv-kinds { list-style: none; margin: 0 0 var(--space-3); padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(16rem, 100%), 1fr)); gap: var(--space-3); }
.ct-dv-kinds__item {
  display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-3);
  padding: var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface);
}
.ct-dv-kind > span { display: flex; flex-direction: column; gap: var(--space-1); }
/* Nurse measures: eight tiles as two even rows of four (two across on phones). */
.ct-metrics--quad { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 719px) { .ct-metrics--quad { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- The app on other devices (tablet, laptop, keypad phone) ---------- */
.ct-device__dots, .ct-device__url, .ct-device__base { display: none; }
.ct-device[hidden] { display: none; }
.ct-mb-devices .ct-segmented__item { padding: 0 var(--space-2); }

/* Tablet and laptop are wide: the device takes the full row, the controls sit under it in two columns. */
.ct-mobile-showcase[data-device="tablet"], .ct-mobile-showcase[data-device="laptop"] { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.ct-mobile-showcase[data-device="tablet"] .ct-mobile-showcase__side,
.ct-mobile-showcase[data-device="laptop"] .ct-mobile-showcase__side { display: contents; }
.ct-mobile-showcase[data-device="tablet"] .ct-mobile-showcase__head,
.ct-mobile-showcase[data-device="laptop"] .ct-mobile-showcase__head { order: 1; grid-column: 1 / -1; }
.ct-mobile-showcase[data-device="tablet"] .ct-mobile-showcase__device,
.ct-mobile-showcase[data-device="laptop"] .ct-mobile-showcase__device { order: 2; grid-column: 1 / -1; position: static; }
.ct-mobile-showcase[data-device="tablet"] .ct-mobile-showcase__side > :not(.ct-mobile-showcase__head),
.ct-mobile-showcase[data-device="laptop"] .ct-mobile-showcase__side > :not(.ct-mobile-showcase__head) { order: 3; }

/* Tablet: landscape 4:3 glass, an even bezel and the camera on the left edge. */
.ct-device--tablet {
  --dev-h: clamp(30rem, calc(100svh - 10rem), 42rem);
  aspect-ratio: 4 / 3; padding: 1rem; border-radius: 2rem;
}
.ct-device--tablet .ct-device__notch { top: 50%; left: 0.45rem; width: 0.4rem; height: 0.4rem; transform: translateY(-50%); background: color-mix(in srgb, var(--color-ink-inverse) 25%, var(--color-ink)); }
.ct-device--tablet .ct-device__screen { border-radius: var(--radius-lg); }
.ct-device--tablet .ct-device__statusbar { height: 2rem; padding: 0 var(--space-5); font-size: var(--text-xs); }
.ct-device--tablet .ct-device__home { width: 9rem; }
.ct-device--tablet .ct-device__nav { padding-bottom: 1.1rem; }

/* Laptop: the app in a browser window on the lid, with a hinge and a wider base under it;
   the tabs become a side bar. */
.ct-device--laptop {
  --dev-h: clamp(26rem, calc(100svh - 12rem), 36rem);
  aspect-ratio: 16 / 10; padding: 0.9rem 0.9rem 1.1rem; border-radius: var(--radius-lg) var(--radius-lg) var(--radius-sm) var(--radius-sm);
  overflow: visible;
}
.ct-device--laptop::before, .ct-device--laptop::after { display: none; }
.ct-device--laptop .ct-device__notch { top: 0.3rem; width: 0.35rem; height: 0.35rem; background: color-mix(in srgb, var(--color-ink-inverse) 25%, var(--color-ink)); }
.ct-device--laptop .ct-device__screen {
  border-radius: var(--radius-sm); display: grid;
  grid-template-columns: minmax(9rem, 12rem) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr);
}
.ct-device--laptop .ct-device__statusbar {
  grid-column: 1 / -1; height: 2.4rem; padding: 0 var(--space-4); gap: var(--space-3); justify-content: flex-start;
  background: var(--color-surface-sunken); border-bottom: 1px solid var(--color-border); font-size: var(--text-xs); font-weight: var(--weight-medium);
}
.ct-device--laptop .ct-device__dots { display: inline-flex; gap: var(--space-1); }
.ct-device--laptop .ct-device__dots span { width: 0.6rem; height: 0.6rem; border-radius: var(--radius-pill); background: var(--color-border-strong); }
.ct-device--laptop .ct-device__url {
  display: inline-flex; align-items: center; gap: var(--space-1); margin: 0 auto; padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-pill); background: var(--color-surface); border: 1px solid var(--color-border); color: var(--color-ink-muted);
}
.ct-device--laptop .ct-device__url .ct-icon { width: 1em; height: 1em; }
.ct-device--laptop .ct-device__icons { display: none; }
.ct-device--laptop .ct-device__nav {
  grid-column: 1; grid-row: 2; grid-auto-flow: row; grid-auto-rows: max-content; align-content: start;
  border-top: 0; border-right: 1px solid var(--color-border); padding: var(--space-3) var(--space-2);
}
.ct-device--laptop .ct-device__nav[hidden] { display: none; }
.ct-device--laptop .ct-device__nav .ct-device__tab { flex-direction: row; justify-content: flex-start; gap: var(--space-2); padding: 0 var(--space-3); font-size: var(--text-sm); }
.ct-device--laptop .ct-device__body { grid-column: 2; grid-row: 2; padding: var(--space-5); }
.ct-device--laptop .ct-device__nav[hidden] + .ct-device__home + * , .ct-device--laptop .ct-device__body:has(+ .ct-device__nav[hidden]) { grid-column: 1 / -1; padding-bottom: var(--space-5); }
.ct-device--laptop .ct-device__home { display: none; }
.ct-device--laptop .ct-device__base {
  display: block; position: absolute; left: -7%; right: -7%; bottom: -0.9rem; height: 0.9rem;
  background: var(--color-border-strong); border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: inset 0 1px 0 var(--color-surface-sunken), var(--shadow-2);
}
.ct-device--laptop .ct-device__base::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 16%; height: 0.35rem; transform: translateX(-50%);
  background: color-mix(in srgb, var(--color-ink) 30%, var(--color-border-strong)); border-radius: 0 0 var(--radius-sm) var(--radius-sm);
}
.ct-mobile-showcase[data-device="laptop"] .ct-mobile-showcase__device { padding: 0 7% var(--space-5); }

/* Wide screens: the app's cards spread into two columns; the first one (the greeting, the call)
   runs across. Onboarding, sign-in and setup stay a centred single column. */
.ct-device--tablet .ct-device__body, .ct-device--laptop .ct-device__body { container-type: inline-size; }
@container (min-width: 36rem) {
  .ct-device__body > .ct-stack { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; gap: var(--space-4); }
  .ct-device__body > .ct-stack > :first-child { grid-column: 1 / -1; }
  .ct-device__body > .ct-mob-slide, .ct-device__body > form, .ct-device__body > .ct-stack--lg { width: min(100%, 30rem); margin: 0 auto; }
}

/* Keypad phone: the handset, with ringing and replying beside it. */
.ct-mb-keypad { display: flex; flex-wrap: wrap; justify-content: center; align-items: flex-start; gap: var(--space-5); width: 100%; }
.ct-mb-keypad[hidden] { display: none; }
.ct-mb-keypad .ct-hs { width: auto; }
.ct-mb-keypad__side { width: min(100%, 19rem); }
.ct-mb-keypad .ct-phone__transcript { scroll-behavior: auto; }

@media (max-width: 899px) {
  .ct-mobile-showcase[data-device="tablet"], .ct-mobile-showcase[data-device="laptop"] { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 719px) {
  .ct-device--laptop .ct-device__screen { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; }
  .ct-device--laptop .ct-device__nav { grid-column: 1; grid-row: 3; grid-auto-flow: column; border-right: 0; border-top: 1px solid var(--color-border); padding: var(--space-1); }
  .ct-device--laptop .ct-device__nav .ct-device__tab { flex-direction: column; padding: var(--space-1); font-size: var(--text-xs); }
  .ct-device--laptop .ct-device__body { grid-column: 1; }
}
