/* Caplet design system — canonical source for tokens (SPEC §6).
   If a value here drifts from SPEC §6 the CSS wins; update the spec to match. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/static/fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/static/fonts/Inter-Medium.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/static/fonts/Inter-SemiBold.woff2') format('woff2');
}

:root {
  /* Palette §6.1 */
  --bg:               #E8F0EE;
  --paper:            #FAF7F2;
  --navy:             #1B3A5C;
  --midnight:         #0D1F35;
  --cranberry:        #C0546A;
  --cranberry-active: #A03050;
  --aqua:             #1D9E75;
  --card-border:      #D4CFC8;
  --body:             #2A3A34;
  --disclaim:         #6A9A8E;
  --muted:            #3A6B5E;
  --nav-inactive:     #8AB4C8;

  /* Meeting-type colors §6.2 */
  --mt-iep:        #C0546A;
  --mt-doctor:     #1D9E75;
  --mt-therapy:    #7A6BAA;
  --mt-school:     #D2A14A;
  --mt-specialist: #1B3A5C;
  --mt-other:      #6A9A8E;

  /* Radii §6.4 */
  --r-card:    14px;
  --r-bubble:  18px;
  --r-button:  12px;

  /* Spacing §6.4 */
  --tap-min: 44px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--body);
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Disclosure banner §5.3 + §21
   Sticky top of viewport on every screen. */
.disclosure-banner {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  color: var(--disclaim);
  font-style: italic;
  font-size: 11px;
  line-height: 1.5;
  text-align: center;
  padding: 12px 16px;
  border-bottom: 0.5px solid var(--card-border);
}

/* Wordmark — top-left of every authed screen §7.4 */
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--navy);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.5px;
}
.wordmark svg { width: 22px; height: 22px; }

/* ========================================================================
   App shell — used inside /app
   Mobile-first layout: banner / top bar / scrolling main / bottom nav.
   ======================================================================== */

body.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 8px;
  flex-shrink: 0;
}
.app-header .shortcuts {
  display: flex;
  gap: 14px;
  align-items: center;
}
.app-header .shortcuts button {
  background: none;
  border: none;
  padding: 4px;
  cursor: pointer;
  color: var(--nav-inactive);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.app-header .shortcuts button svg { width: 18px; height: 18px; display: block; }
.app-header .shortcuts.dimmed button { opacity: 0.4; pointer-events: none; }

.app-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.screen { display: none; padding: 16px; }
.screen.active { display: block; }

.placeholder {
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  text-align: center;
  margin: 96px auto 0;
  max-width: 280px;
  line-height: 1.5;
}

.bottomnav {
  background: var(--navy);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}
.bottomnav button {
  background: none;
  border: none;
  padding: 6px 2px;
  color: var(--nav-inactive);
  font-family: inherit;
  font-size: 9px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: var(--tap-min);
  min-width: 0;
  letter-spacing: 0;
}
.bottomnav button svg { width: 20px; height: 20px; }
.bottomnav button.active { color: var(--aqua); }

/* ========================================================================
   Phase 3: Home + Picker + Recording + Processing + Capsule debug
   ======================================================================== */

/* Buttons — shared primary CTA used in error states and the iOS modal. */
.btn-primary {
  display: inline-block;
  min-height: var(--tap-min);
  padding: 12px 22px;
  background: var(--navy);
  color: var(--paper);
  border: none;
  border-radius: var(--r-button);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn-primary:active { transform: scale(0.98); }

/* === Home — SPEC §10 === */
.screen--home {
  display: none;
  padding: 14px 16px 16px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.screen--home.active { display: flex; }

.home__prompt {
  margin: 8px 0 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.2px;
}

.record-button-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 14px;
}
.record-button-wrap--center { margin-top: 120px; }

.record-button {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: var(--navy);
  border: 3px solid var(--cranberry);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: transform 120ms ease;
}
.record-button:active { transform: scale(0.98); }
.record-button svg { width: 44px; height: 44px; color: var(--bg); }

.record-button--stop {
  border-color: var(--cranberry-active);
  animation: caplet-breathe 2s ease-in-out infinite;
}
.record-button--stop svg { width: 30px; height: 30px; }
@keyframes caplet-breathe {
  0%, 100% { transform: scale(1.0); }
  50%      { transform: scale(1.05); }
}

/* 18-min pulse rim throb (SPEC §6.4). Triggered by JS adding the class briefly. */
.record-button--pulse-rim {
  animation: caplet-breathe 2s ease-in-out infinite, caplet-pulse-rim 1s ease-out 1;
}
@keyframes caplet-pulse-rim {
  0%   { box-shadow: 0 0 0 0 var(--cranberry-active); }
  100% { box-shadow: 0 0 0 16px rgba(160, 48, 80, 0); }
}

.waveform-static {
  display: flex;
  gap: 4px;
  align-items: flex-end;
  height: 16px;
  margin-bottom: 22px;
}
.waveform-static span {
  display: block;
  width: 3px;
  background: var(--nav-inactive);
  opacity: 0.55;
  border-radius: 1px;
}
.waveform-static span:nth-child(1) { height: 6px; }
.waveform-static span:nth-child(2) { height: 10px; }
.waveform-static span:nth-child(3) { height: 14px; }
.waveform-static span:nth-child(4) { height: 9px; }
.waveform-static span:nth-child(5) { height: 5px; }

.text-button {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(29, 158, 117, 0.08);
  border: 2px solid var(--navy);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  margin-bottom: 10px;
}
.text-button:active { transform: scale(0.98); }
.text-button svg { width: 22px; height: 22px; color: var(--aqua); }

.home__handle {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  margin: 0;
}

/* === Picker — SPEC §11 === */
.screen--picker {
  display: none;
  padding: 8px 16px 24px;
  flex-direction: column;
}
.screen--picker.active { display: flex; }

.picker__heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--midnight);
  margin: 16px 4px 14px;
  text-align: left;
}

.picker__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.picker__card {
  width: 100%;
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-card);
  padding: 18px 18px;
  min-height: 64px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 14px;
  cursor: pointer;
  font-family: inherit;
}
.picker__card:active { transform: scale(0.995); }
.picker__dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.picker__card[data-meeting-type="iep"] .picker__dot            { background: var(--mt-iep); }
.picker__card[data-meeting-type="doctor"] .picker__dot         { background: var(--mt-doctor); }
.picker__card[data-meeting-type="therapy"] .picker__dot        { background: var(--mt-therapy); }
.picker__card[data-meeting-type="school-checkin"] .picker__dot { background: var(--mt-school); }
.picker__card[data-meeting-type="specialist"] .picker__dot     { background: var(--mt-specialist); }
.picker__card[data-meeting-type="other"] .picker__dot          { background: var(--mt-other); }
.picker__label { font-size: 16px; font-weight: 500; color: var(--midnight); }

.picker__cancel {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-style: italic;
  margin: 16px auto 0;
  cursor: pointer;
  padding: 8px 16px;
}

/* === Recording — SPEC §12 === */
.screen--recording {
  display: none;
  padding: 24px 16px 16px;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.screen--recording.active { display: flex; }

.recording__listening {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  margin: 22px 0 0;
}

.recording__error {
  margin-top: 48px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.recording__error-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

/* === Processing — SPEC §13 === */
.screen--processing {
  display: none;
  padding: 0 16px;
  /* Absolutely fill the scroll area (.app-main is position:relative) so the flex
     centering below puts the wave + label in the vertical middle. A percentage
     min-height won't resolve here because the body uses min-height, not height. */
  position: absolute;
  inset: 0;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.screen--processing.active { display: flex; }

.processing__wave {
  width: 220px;
  height: 36px;
  margin-bottom: 14px;
  overflow: hidden;
  position: relative;
}
.processing__wave svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 400%;
  height: 100%;
  animation: caplet-wave 2.4s linear infinite;
}
.processing__wave-delay {
  animation-duration: 3.1s !important;
  opacity: 0.4;
  animation-direction: reverse !important;
}
@keyframes caplet-wave {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

.processing__msg {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  margin: 0;
}

.processing__error {
  margin-top: 24px;
  max-width: 300px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
/* Without this, the `display: flex` above overrides the `hidden` attribute, so the
   error block (and its "Back home" button) stays visible during normal processing —
   showing as an empty blue box. Mirrors .toast[hidden] / .ios-modal[hidden] etc. */
.processing__error[hidden] { display: none; }
.processing__error-copy {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

/* === Capsule debug (Phase 3 preview; replaced in Phase 4) === */
.screen--capsule {
  display: none;
  padding: 16px;
}
.screen--capsule.active { display: block; }

/* Date-and-type pill + close link (SPEC §15.2) */
.capsule__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.capsule-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--body);
}
.capsule-pill__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mt-other);
}
.capsule-pill[data-meeting-type="iep"]         { border-color: var(--mt-iep); }
.capsule-pill[data-meeting-type="doctor"]      { border-color: var(--mt-doctor); }
.capsule-pill[data-meeting-type="therapy"]     { border-color: var(--mt-therapy); }
.capsule-pill[data-meeting-type="school-checkin"] { border-color: var(--mt-school); }
.capsule-pill[data-meeting-type="specialist"]  { border-color: var(--mt-specialist); }
.capsule-pill[data-meeting-type="other"]       { border-color: var(--mt-other); }
.capsule-pill[data-meeting-type="iep"] .capsule-pill__dot         { background: var(--mt-iep); }
.capsule-pill[data-meeting-type="doctor"] .capsule-pill__dot      { background: var(--mt-doctor); }
.capsule-pill[data-meeting-type="therapy"] .capsule-pill__dot     { background: var(--mt-therapy); }
.capsule-pill[data-meeting-type="school-checkin"] .capsule-pill__dot { background: var(--mt-school); }
.capsule-pill[data-meeting-type="specialist"] .capsule-pill__dot  { background: var(--mt-specialist); }
.capsule-pill[data-meeting-type="other"] .capsule-pill__dot       { background: var(--mt-other); }
.capsule__close {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  text-decoration: none;
}

/* Voice-deleted notice (SPEC §5.6) */
.voice-notice {
  background: var(--bg);
  border: 0.5px solid var(--aqua);
  border-radius: 10px;
  padding: 10px;
  color: var(--aqua);
  font-size: 12px;
  font-weight: 500;
  width: 100%;
  margin: 12px 0 16px;
}

/* Capsule cards (SPEC §15.4) */
.capsule-card {
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-card);
  padding: 14px 16px;
  margin: 0 0 10px;
}
.capsule-card__header {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  color: var(--midnight);
  text-transform: uppercase;
  margin: 0 0 8px;
}
.capsule-card__body {
  font-size: 13px;
  font-weight: 400;
  line-height: 1.65;
  color: var(--body);
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
}
/* Bulleted sections */
.capsule-bullets {
  margin: 0;
  padding-left: 18px;
  list-style: disc;
}
.capsule-bullets li {
  margin: 0 0 5px;
  word-break: break-word;
}
.capsule-bullets li:last-child { margin-bottom: 0; }
.capsule-card__empty {
  margin: 0;
  font-size: 13px;
  font-style: italic;
  color: var(--muted, #8a8a8a);
}
/* Prep "Prior meeting" sub-headers (two sections inside one card) */
.capsule-card__subhead {
  font-size: 11px;
  font-weight: 600;
  color: var(--body);
  margin: 10px 0 6px;
}
.capsule-card__subhead:first-of-type { margin-top: 0; }

.perspective-disclaim {
  font-size: 11px;
  font-style: italic;
  color: var(--disclaim);
  line-height: 1.5;
  margin: 16px 0 12px;
}

/* Flag trigger (SPEC §15.7) */
.flag-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 6px 0;
  color: var(--disclaim);
  font-style: italic;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  min-height: var(--tap-min);
}
.flag-button svg { width: 14px; height: 14px; }

/* Survey block (SPEC §5.8 + §15.8) */
.survey {
  margin: 16px 0 24px;
  padding: 16px;
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-card);
}
.survey__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  margin: 0 0 14px;
}
.survey__field {
  border: none;
  padding: 0;
  margin: 0 0 14px;
}
.survey__q {
  font-size: 12px;
  font-weight: 400;
  color: var(--body);
  margin-bottom: 8px;
  line-height: 1.4;
}
.survey__radios {
  display: flex;
  gap: 8px;
}
.survey__radios label {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 4px;
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-button);
  background: var(--bg);
  font-size: 12px;
  cursor: pointer;
}
.survey__radios input[type="radio"] {
  margin: 0;
  accent-color: var(--navy);
}
.survey__textarea {
  width: 100%;
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-button);
  background: var(--bg);
  padding: 8px 10px;
  font-family: inherit;
  font-size: 12px;
  color: var(--body);
  resize: vertical;
  min-height: 60px;
}
.survey__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.survey__skip {
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.survey__submit {
  min-width: 140px;
  height: var(--tap-min);
}
.survey__thanks {
  margin: 0;
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  text-align: center;
  padding: 20px 0;
}

/* Add follow-up button (Phase 6 — disabled placeholder for Phase 4) */
.follow-up-button {
  display: block;
  width: 100%;
  height: var(--tap-min);
  border: none;
  border-radius: var(--r-button);
  background: var(--navy);
  color: var(--bg);
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  margin: 24px 0 12px;
  cursor: pointer;
}
.follow-up-button__hint {
  font-weight: 400;
  font-size: 12px;
  opacity: 0.7;
  margin-left: 6px;
}
.btn-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* Flag modal (SPEC §20). Reuses .ios-modal scaffold. */
.ios-modal__inner--wide { max-width: 360px; }
.flag-modal__textarea {
  width: 100%;
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-button);
  background: var(--bg);
  padding: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--body);
  resize: vertical;
  min-height: 88px;
}
.flag-modal__actions {
  display: flex;
  gap: 10px;
  width: 100%;
}
.flag-modal__actions .btn-primary,
.flag-modal__actions .btn-ghost { flex: 1; }
.btn-ghost {
  background: none;
  border: 0.5px solid var(--card-border);
  color: var(--muted);
  font-family: inherit;
  font-weight: 500;
  font-size: 14px;
  border-radius: var(--r-button);
  min-height: var(--tap-min);
  cursor: pointer;
}

/* Toast (used for flag confirmation) */
.toast {
  position: fixed;
  bottom: calc(72px + env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  background: var(--paper);
  color: var(--aqua);
  font-size: 12px;
  padding: 10px 14px;
  border: 0.5px solid var(--aqua);
  border-radius: var(--r-button);
  z-index: 250;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.toast[hidden] { display: none; }

/* Capsule delete link (SPEC §15.10) — tiny right-aligned destructive link. */
.capsule__delete {
  display: block;
  text-align: right;
  color: var(--disclaim);
  font-style: italic;
  font-size: 11px;
  text-decoration: none;
  margin: 0 0 24px;
}

/* Destructive confirm button — cranberry instead of navy. */
.btn-danger {
  background: var(--cranberry);
}
.btn-danger:active { background: var(--cranberry-active); }

/* ========================================================================
   Phase 5: Timeline (SPEC §16)
   ======================================================================== */
.screen--timeline {
  display: none;
  padding: 0 16px 16px;
}
.screen--timeline.active { display: block; }

.timeline__heading {
  font-size: 18px;
  font-weight: 600;
  color: var(--midnight);
  margin: 16px 0 14px;
  text-align: left;
}

.timeline__list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.timeline__empty {
  color: var(--muted);
  font-style: italic;
  font-size: 14px;
  text-align: center;
  margin: 96px auto 0;
}
.timeline__empty[hidden] { display: none; }

/* IntersectionObserver target — invisible 1px strip at the list's bottom. */
.timeline__sentinel { height: 1px; }

/* Capsule bubble (SPEC §16). 4px left-edge stripe in the meeting-type color. */
.tl-bubble {
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-left: 4px solid var(--mt-other);
  border-radius: var(--r-card);
  padding: 14px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  display: block;
}
.tl-bubble:active { transform: scale(0.995); }
.tl-bubble[data-meeting-type="iep"]            { border-left-color: var(--mt-iep); }
.tl-bubble[data-meeting-type="doctor"]         { border-left-color: var(--mt-doctor); }
.tl-bubble[data-meeting-type="therapy"]        { border-left-color: var(--mt-therapy); }
.tl-bubble[data-meeting-type="school-checkin"] { border-left-color: var(--mt-school); }
.tl-bubble[data-meeting-type="specialist"]     { border-left-color: var(--mt-specialist); }
.tl-bubble[data-meeting-type="other"]          { border-left-color: var(--mt-other); }

.tl-bubble__top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.tl-bubble__type {
  font-size: 14px;
  font-weight: 600;
  color: var(--midnight);
}
.tl-bubble__date {
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}
.tl-bubble__body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--body);
  margin: 0;
  word-break: break-word;
}

/* ========================================================================
   Phase 6: Follow-ups + prep view + prep bubbles (SPEC §18, §10.3, §16)
   ======================================================================== */

/* Prep view — same card styling as the capsule view; Suggested Questions header
   tinted --aqua to distinguish AI-generated content (SPEC §18.2). */
.screen--prep {
  display: none;
  padding: 16px;
}
.screen--prep.active { display: block; }

.capsule-card__header--aqua { color: var(--aqua); }

/* Shared PREP READY pill — used on the home prep bubble and timeline prep bubble. */
.prep-pill {
  display: inline-block;
  background: var(--aqua);
  color: #fff;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.3px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

/* Home prep bubbles container — stacked soonest-first (SPEC §10.3). */
.prep-bubbles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  /* Sits below the record button now — top margin separates it from the
     record cluster so the button stays the clear priority (Christine 6/14). */
  margin: 28px 0 4px;
}
.prep-bubbles:empty { display: none; }

/* Home prep bubble (SPEC §10.3). 4px left stripe in the parent capsule's
   meeting-type color; subtle pulse (§6.4). */
.prep-bubble {
  position: relative;
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-left: 4px solid var(--mt-other);
  border-radius: var(--r-bubble);
  padding: 18px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  cursor: pointer;
  display: block;
  animation: prep-pulse 3s ease-in-out infinite;
}
.prep-bubble:active { transform: scale(0.995); }
.prep-bubble[data-meeting-type="iep"]            { border-left-color: var(--mt-iep); }
.prep-bubble[data-meeting-type="doctor"]         { border-left-color: var(--mt-doctor); }
.prep-bubble[data-meeting-type="therapy"]        { border-left-color: var(--mt-therapy); }
.prep-bubble[data-meeting-type="school-checkin"] { border-left-color: var(--mt-school); }
.prep-bubble[data-meeting-type="specialist"]     { border-left-color: var(--mt-specialist); }
.prep-bubble[data-meeting-type="other"]          { border-left-color: var(--mt-other); }

.prep-bubble .prep-pill {
  position: absolute;
  top: 14px;
  right: 14px;
}
.prep-bubble__top {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  color: var(--midnight);
  margin: 0 0 6px;
  padding-right: 84px;
}
.prep-bubble__mid {
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  margin: 0 0 8px;
}
.prep-bubble__bottom {
  font-size: 16px;
  font-weight: 600;
  color: var(--midnight);
  margin: 0;
}

@keyframes prep-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(29, 158, 117, 0); }
  50%      { box-shadow: 0 0 0 4px rgba(29, 158, 117, 0.12); }
}

/* Timeline prep variant (SPEC §16). --bg background, 1px dashed meeting-type
   border, no left stripe; PREP READY pill when within 3 days. */
.tl-prep {
  position: relative;
  background: var(--bg);
  border: 1px dashed var(--mt-other);
  border-radius: var(--r-card);
  padding: 14px;
  cursor: pointer;
  width: 100%;
  text-align: left;
  font-family: inherit;
  display: block;
}
.tl-prep:active { transform: scale(0.995); }
.tl-prep[data-meeting-type="iep"]            { border-color: var(--mt-iep); }
.tl-prep[data-meeting-type="doctor"]         { border-color: var(--mt-doctor); }
.tl-prep[data-meeting-type="therapy"]        { border-color: var(--mt-therapy); }
.tl-prep[data-meeting-type="school-checkin"] { border-color: var(--mt-school); }
.tl-prep[data-meeting-type="specialist"]     { border-color: var(--mt-specialist); }
.tl-prep[data-meeting-type="other"]          { border-color: var(--mt-other); }

.tl-prep__top {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-bottom: 6px;
  /* Reserve space so the title clears the absolutely-positioned PREP READY pill
     (top:12 right:12). */
  padding-right: 88px;
}
.tl-prep__type {
  font-size: 14px;
  font-weight: 600;
  color: var(--midnight);
}
.tl-prep__date {
  font-size: 12px;
  color: var(--muted);
}
.tl-prep__body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--body);
  margin: 0;
}
.tl-prep .prep-pill {
  position: absolute;
  top: 12px;
  right: 12px;
}

/* Add-follow-up modal extras (SPEC §18.1). */
.ios-modal__inner--left { text-align: left; align-items: stretch; }
.ios-modal__body--muted {
  color: var(--muted);
  font-style: italic;
  font-size: 12px;
  line-height: 1.5;
}
.follow-up-modal__label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--body);
  margin-top: 10px;
}
.follow-up-modal__optional {
  font-weight: 400;
  color: var(--muted, #8a8a8a);
}
.follow-up-modal__date {
  width: 100%;
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-button);
  background: var(--bg);
  padding: 10px;
  margin-top: 4px;
  font-family: inherit;
  font-size: 14px;
  color: var(--body);
  min-height: var(--tap-min);
}
/* Three side-by-side time selects (hour : minute am/pm). */
.follow-up-modal__timerow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.follow-up-modal__time {
  width: auto;
  flex: 1 1 0;
  margin-top: 0;
}
.follow-up-modal__timesep {
  color: var(--muted, #8a8a8a);
  font-size: 16px;
}
/* Minute / AM-PM dim out while no hour is chosen (blank "--" = no time). */
.follow-up-modal__time--dim { opacity: 0.4; }

/* === iOS pre-record warning modal (SPEC §12) === */
.ios-modal {
  position: fixed;
  inset: 0;
  background: rgba(13, 31, 53, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 24px;
}
.ios-modal[hidden] { display: none; }
.ios-modal__inner {
  background: var(--paper);
  border-radius: var(--r-bubble);
  padding: 24px;
  max-width: 320px;
  width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.ios-modal__heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--midnight);
  margin: 0;
}
.ios-modal__body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--body);
  margin: 0;
}

/* ========================================================================
   Phase 7: Calendar month grid (SPEC §17)
   Forward-looking 6×7 grid; colored dots per follow-up by meeting type.
   ======================================================================== */
.screen--calendar {
  display: none;
  padding: 16px;
}
.screen--calendar.active { display: block; }

.cal__headrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.cal__nav {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.cal__title {
  font-size: 16px;
  font-weight: 600;
  color: var(--midnight);
}

.cal__dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: 4px;
}
.cal__dow span {
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cal__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  touch-action: pan-y;
}

.cal__cell {
  min-height: 48px;
  max-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 5px;
  gap: 3px;
  position: relative;
  border: none;
  background: none;
  font-family: inherit;
  cursor: default;
}
/* Days that actually have follow-ups become tappable. */
.cal__cell--has { cursor: pointer; }
.cal__cell--has:active .cal__daynum { transform: scale(0.95); }
.cal__cell--flash { background: rgba(29, 158, 117, 0.08); border-radius: 8px; }

.cal__daynum {
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: transform 100ms ease;
}
.cal__cell--out .cal__daynum {
  color: var(--nav-inactive);
  opacity: 0.6;
}
.cal__cell--today .cal__daynum {
  box-shadow: 0 0 0 2px var(--navy);
  color: var(--navy);
  font-weight: 600;
}

.cal__dots {
  display: flex;
  flex-direction: row;
  gap: 2px;
  justify-content: center;
  align-items: center;
  min-height: 6px;
}
.cal__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mt-other);
  flex-shrink: 0;
}
.cal__dot[data-meeting-type="iep"]            { background: var(--mt-iep); }
.cal__dot[data-meeting-type="doctor"]         { background: var(--mt-doctor); }
.cal__dot[data-meeting-type="therapy"]        { background: var(--mt-therapy); }
.cal__dot[data-meeting-type="school-checkin"] { background: var(--mt-school); }
.cal__dot[data-meeting-type="specialist"]     { background: var(--mt-specialist); }
.cal__dot[data-meeting-type="other"]          { background: var(--mt-other); }
.cal__dot--more {
  width: auto;
  height: auto;
  border-radius: 0;
  background: none;
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--muted);
}

/* Bottom sheet (SPEC §17) — slides up from below on a day-with-follow-ups tap. */
.bottomsheet {
  position: fixed;
  inset: 0;
  z-index: 220;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}
.bottomsheet[hidden] { display: none; }
.bottomsheet__scrim {
  position: absolute;
  inset: 0;
  background: rgba(13, 31, 53, 0.45);
}
.bottomsheet__inner {
  position: relative;
  background: var(--paper);
  border-top-left-radius: var(--r-bubble);
  border-top-right-radius: var(--r-bubble);
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  animation: sheet-up 220ms ease-out;
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.bottomsheet__heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--midnight);
  margin: 0 0 12px;
}
.bottomsheet__rows {
  display: flex;
  flex-direction: column;
}

.sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--tap-min);
  width: 100%;
  background: none;
  border: none;
  border-top: 0.5px solid var(--card-border);
  padding: 10px 0;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.sheet-row:active { opacity: 0.7; }
.sheet-row__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--mt-other);
  flex-shrink: 0;
}
.sheet-row__dot[data-meeting-type="iep"]            { background: var(--mt-iep); }
.sheet-row__dot[data-meeting-type="doctor"]         { background: var(--mt-doctor); }
.sheet-row__dot[data-meeting-type="therapy"]        { background: var(--mt-therapy); }
.sheet-row__dot[data-meeting-type="school-checkin"] { background: var(--mt-school); }
.sheet-row__dot[data-meeting-type="specialist"]     { background: var(--mt-specialist); }
.sheet-row__dot[data-meeting-type="other"]          { background: var(--mt-other); }
.sheet-row__name {
  font-size: 14px;
  color: var(--midnight);
  font-weight: 500;
}
.sheet-row__suffix {
  font-size: 13px;
  color: var(--muted);
}
.sheet-row__badge {
  margin-left: auto;
  font-size: 11px;
  white-space: nowrap;
}
.sheet-badge--ready {
  color: var(--aqua);
  font-weight: 600;
}
.sheet-badge--none {
  color: var(--muted);
  font-style: italic;
}

.bottomsheet__close {
  display: block;
  text-align: center;
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  text-decoration: none;
  margin-top: 14px;
  padding: 8px;
}

/* ========================================================================
   Phase 8: Text-input path (SPEC §14) + coming-soon tabs (SPEC §19)
   ======================================================================== */

/* Coming-soon placeholders (SPEC §19) — vertical center, single muted line. */
.screen--placeholder {
  display: none;
  padding: 16px;
}
.screen--placeholder.active {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen--placeholder .placeholder { margin: 0; }

/* Text-input screen (SPEC §14). */
.screen--text {
  display: none;
  padding: 16px;
  flex-direction: column;
}
.screen--text.active { display: flex; }

.text__heading {
  font-size: 16px;
  font-weight: 600;
  color: var(--midnight);
  margin: 8px 0 14px;
}

.text__chiprow {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
  border-radius: var(--r-button);
  transition: box-shadow 180ms ease;
}
/* Brief cue when the parent taps Save without choosing a meeting type. */
.text__chiprow--flash {
  box-shadow: 0 0 0 2px var(--cranberry);
}

/* Meeting-type chip. Selected state colors come from data-* attribute rules
   below (CSP drops inline style). Single-select toggled in JS. */
.text-chip {
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-radius: 999px;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  color: var(--body);
  cursor: pointer;
}
.text-chip:active { transform: scale(0.97); }
.text-chip[data-meeting-type="iep"][data-selected="true"]            { background: var(--mt-iep); color: #fff; border-color: var(--mt-iep); }
.text-chip[data-meeting-type="doctor"][data-selected="true"]         { background: var(--mt-doctor); color: #fff; border-color: var(--mt-doctor); }
.text-chip[data-meeting-type="therapy"][data-selected="true"]        { background: var(--mt-therapy); color: #fff; border-color: var(--mt-therapy); }
.text-chip[data-meeting-type="school-checkin"][data-selected="true"] { background: var(--mt-school); color: #fff; border-color: var(--mt-school); }
.text-chip[data-meeting-type="specialist"][data-selected="true"]     { background: var(--mt-specialist); color: #fff; border-color: var(--mt-specialist); }
.text-chip[data-meeting-type="other"][data-selected="true"]          { background: var(--mt-other); color: #fff; border-color: var(--mt-other); }

.text__area {
  width: 100%;
  background: var(--paper);
  border: 0.5px solid var(--card-border);
  border-radius: var(--r-card);
  padding: 14px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  color: var(--body);
  resize: vertical;
  min-height: 220px;
  margin-bottom: 16px;
}

.text__save {
  display: block;
  width: 100%;
  height: var(--tap-min);
}

.text__cancel {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
  text-align: center;
  text-decoration: none;
  margin-top: 16px;
}
