:root {
  --ivory: #f5f0e6;
  --paper: #fffdf7;
  --parchment: #eee4cf;
  --gold: #c3a15b;
  --gold-dark: #95702e;
  --gold-light: #dfcb96;
  --bronze: #74551f;
  --indigo: #324866;
  --indigo-deep: #273b56;
  --indigo-soft: #e8edf2;
  --charcoal: #3b4b63;
  --ink: #4a5668;
  --muted: #747d8a;
  --line: #d9cfbc;
  --sage: #e9eee8;
  --rose: #f2e8df;
  --success: #40683d;
  --danger: #9f3d2e;
  --reader-font: 18px;
  --shadow: 0 16px 42px rgba(28, 42, 62, 0.1);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--ivory); }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 8% 8%, rgba(195, 161, 91, 0.13), transparent 28rem),
    radial-gradient(circle at 92% 92%, rgba(36, 52, 75, 0.08), transparent 32rem),
    var(--ivory);
  color: var(--ink);
  font-family: "Avenir Next", Avenir, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: url("/comprehend/brand/wm.webp") no-repeat center 48%;
  background-size: min(58vw, 520px);
  opacity: 0.018;
  pointer-events: none;
}

button, input, textarea, select { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(195, 161, 91, 0.42);
  outline-offset: 2px;
}

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { color: var(--charcoal); font-family: Georgia, "Times New Roman", serif; font-weight: 400; }
h1 { font-size: clamp(1.75rem, 4vw, 2.65rem); line-height: 1.17; margin-bottom: 0.75rem; letter-spacing: -0.018em; }
h2 { font-size: clamp(1.25rem, 2.4vw, 1.65rem); margin-bottom: 0.45rem; }

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* Chronicles strip: the same Back and Home as every other page in the book */
.chron {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: min(1080px, calc(100% - 22px));
  margin: 10px auto 0;
  font-family: Georgia, "Times New Roman", serif;
}
.chron .brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.chron .brand img { height: 34px; width: auto; }
.chron .brand b { display: block; font: italic 500 19px/1 Georgia, "Times New Roman", serif; color: var(--bronze); }
.chron .brand small { display: block; margin-top: 4px; font: 500 9.5px/1 "Avenir Next", Avenir, -apple-system, sans-serif; letter-spacing: .3em; color: var(--gold); }
.chron .btns { display: flex; gap: 8px; }
.chron .btn {
  display: inline-flex; align-items: center; height: 34px; padding: 0 14px;
  border: 1px solid rgba(168, 121, 46, .45); border-radius: 999px; background: rgba(243,235,227, .7);
  font: 500 11px/1 "Avenir Next", Avenir, -apple-system, sans-serif; letter-spacing: .22em; text-transform: uppercase; color: var(--bronze); text-decoration: none;
  transition: background .3s, color .3s;
}
.chron .btn:hover { background: var(--bronze); color: var(--paper); }
.chron .btn.home { border-color: var(--gold); color: var(--indigo); }

.app-header {
  position: sticky;
  top: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 14px;
  width: min(1080px, calc(100% - 22px));
  margin: 0 auto;
  padding: 9px 16px;
  border: 0;
  border-bottom: 1px solid rgba(195, 161, 91, 0.55);
  border-radius: 0;
  background: rgba(255, 253, 247, 0.97);
  box-shadow: 0 4px 18px rgba(28, 42, 62, 0.045);
  backdrop-filter: blur(10px);
}

.brand-button {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.brand-button img { width: auto; height: 42px; }
.brand-copy { display: flex; flex-direction: column; line-height: 1.03; }
.brand-copy small { color: var(--gold-dark); font-size: 0.52rem; letter-spacing: 0.15em; text-transform: uppercase; }
.brand-copy strong { color: var(--indigo); font-family: Georgia, serif; font-size: 1.28rem; font-style: italic; }
.brand-copy > span { color: var(--muted); font-size: 0.56rem; letter-spacing: 0.14em; text-transform: uppercase; }

.trial-badge, .source-pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 11px;
  border-radius: 999px;
  background: var(--parchment);
  color: var(--bronze);
  font-size: 0.76rem;
  font-weight: 700;
}

.patient-controls { display: flex; align-items: center; gap: 7px; }
.language-control { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 0.75rem; color: var(--muted); }
.language-control select, .speech-row select {
  max-width: 220px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
}

.shell { position: relative; z-index: 1; width: min(1120px, calc(100% - 28px)); margin: 24px auto 60px; }
.view.narrow { width: min(520px, 100%); margin-inline: auto; }

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 247, 0.97);
  box-shadow: 0 14px 38px rgba(28, 42, 62, 0.065);
}

.hero { display: flex; flex-direction: column; padding: 0; overflow: hidden; border-top: 2px solid var(--gold); background: linear-gradient(180deg, rgba(255, 253, 247, 0.99), rgba(249, 244, 234, 0.98)); text-align: center; }
.hero-brand { display: grid; place-items: center; padding: 38px 24px 6px; background: transparent; }
.hero-brand img { width: min(162px, 46vw); height: auto; filter: drop-shadow(0 7px 15px rgba(116, 85, 31, 0.14)); }
.hero-content { padding: 10px clamp(26px, 7vw, 84px) clamp(38px, 6vw, 68px); }
.hero-content > p:not(.eyebrow) { width: min(690px, 100%); margin: 0 auto 34px; color: var(--muted); font-size: 1.04rem; }
.eyebrow { margin-bottom: 0.45rem; color: var(--gold-dark); font-size: 0.7rem; font-weight: 800; letter-spacing: 0.13em; text-transform: uppercase; }
.quiet-centre { max-width: 680px; margin: 18px auto; color: var(--muted); font-size: 0.85rem; text-align: center; }

.role-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; width: min(720px, 100%); margin: 0 auto; }
.role-card {
  min-height: 148px;
  padding: 25px 22px;
  border: 0;
  border-top: 1px solid var(--gold);
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 253, 247, 0.45);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}
.role-card:hover { transform: translateY(-2px); border-color: var(--gold-dark); background: var(--paper); box-shadow: 0 10px 24px rgba(28, 42, 62, 0.07); }
.role-icon { display: block; margin-bottom: 12px; color: var(--gold-dark); font-family: Georgia, serif; font-size: 0.68rem; font-style: italic; letter-spacing: 0.14em; }
.role-card strong { display: block; margin-bottom: 8px; color: var(--indigo); font-family: Georgia, serif; font-size: 1.24rem; font-weight: 400; }
.role-card > span:last-child { display: block; color: var(--muted); font-size: 0.9rem; }

.login-card { padding: 28px; }
.login-card form { display: grid; gap: 12px; }
.login-logo { display: block; width: 96px; height: auto; margin: -8px auto 6px; filter: drop-shadow(0 5px 11px rgba(116, 85, 31, 0.11)); }
.text-back { margin: -6px 0 22px; padding: 4px 0; border: 0; background: transparent; color: var(--bronze); cursor: pointer; }

label { display: grid; gap: 5px; color: var(--ink); font-size: 0.84rem; font-weight: 700; }
label b { color: var(--danger); }
input, textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--ink);
}
textarea { resize: vertical; }

.primary-button, .secondary-button {
  min-height: 43px;
  padding: 10px 16px;
  border-radius: 12px;
  font-weight: 800;
  cursor: pointer;
}
.primary-button { border: 1px solid var(--indigo); background: var(--indigo); color: #fff; box-shadow: none; }
.primary-button:hover { background: var(--indigo-deep); }
.secondary-button { border: 1px solid var(--gold-light); background: #fff; color: var(--indigo); }
.compact { min-height: 36px; padding: 7px 12px; font-size: 0.84rem; }
.icon-button {
  min-width: 37px;
  height: 37px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font-weight: 800;
}
.button-row { display: flex; flex-wrap: wrap; gap: 9px; align-items: center; margin-top: 12px; }
button:disabled { cursor: not-allowed; opacity: 0.48; }
option:disabled, option.translation-only-option { color: #9b948b; }
.form-status, .record-status { min-height: 1.35em; margin: 9px 0 0; color: var(--muted); font-size: 0.82rem; }
.form-status.error, .record-status.error { color: var(--danger); }
.form-status.success { color: var(--success); }

.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin: 8px 2px 18px; }
.section-heading p { margin-bottom: 0; color: var(--muted); }
.form-section, .patient-section { margin-bottom: 15px; padding: 24px; }
.step-title { display: flex; align-items: center; gap: 11px; margin-bottom: 18px; }
.step-title > span {
  display: grid;
  place-items: center;
  width: 29px;
  height: 29px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  background: transparent;
  color: var(--indigo);
  font-size: 0.78rem;
  font-weight: 800;
}
.step-title h2 { margin: 0; }
.step-title.plain { margin-bottom: 11px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px 18px; }
.upload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.upload-card { display: grid; gap: 11px; padding: 17px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.document-number { color: var(--gold-dark); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; }
.file-input { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.file-picker { display: block; padding: 10px 13px; border: 1px dashed var(--gold); border-radius: 11px; color: var(--bronze); text-align: center; cursor: pointer; }
.upload-status { min-height: 2.4em; margin: 0; color: var(--muted); font-size: 0.79rem; }
.upload-status.ready { color: var(--success); }
.note-strip { margin: 14px 0 0; padding: 10px 13px; border-radius: 12px; background: var(--sage); color: #4d543e; font-size: 0.82rem; }
.share-result { margin-top: 16px; padding: 18px; border: 1px solid #bfd0b9; border-radius: 16px; background: #edf4e9; }
.share-result label { margin-top: 10px; }
.success-label { margin-bottom: 4px; color: var(--success); font-weight: 900; }
.package-list { display: grid; gap: 9px; }
.package-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 13px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.package-row strong, .package-row span { display: block; }
.package-row span { color: var(--muted); font-size: 0.78rem; }

.patient-welcome { padding: clamp(26px, 5vw, 46px); text-align: center; }
.patient-welcome > p:not(.eyebrow) { width: min(680px, 100%); margin: 0 auto 18px; }
.coordinator-card { display: inline-block; max-width: 620px; padding: 12px 20px; border-radius: 14px; background: var(--parchment); color: var(--ink); font-size: 0.86rem; }
.section-title-row { display: flex; justify-content: space-between; gap: 15px; align-items: center; margin-bottom: 13px; }
.section-title-row h2, .section-title-row p { margin-bottom: 0; }
.patient-documents { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.patient-document {
  display: flex;
  align-items: center;
  gap: 13px;
  min-height: 96px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}
.patient-document .document-icon { font-size: 1.55rem; }
.patient-document strong, .patient-document small { display: block; }
.patient-document small { color: var(--muted); }
.patient-document .open-arrow { margin-left: auto; color: var(--gold); font-weight: 900; }
.capability-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.capability-grid span { display: grid; gap: 2px; padding: 12px 14px; border-left: 2px solid var(--gold); border-radius: 0; background: rgba(232, 237, 242, 0.62); color: var(--indigo); font-size: 0.82rem; }
.capability-grid b { font-family: Georgia, serif; font-size: 0.96rem; }
.capability-grid small { color: var(--muted); }

.record-field { position: relative; }
.record-field textarea { padding-right: 57px; }
.microphone-button {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  padding: 0;
  border: 1px solid var(--gold-light);
  border-radius: 50%;
  background: #fff8e8;
  color: var(--bronze);
  cursor: pointer;
}
.microphone-button.large { width: 46px; height: 46px; font-size: 1.1rem; }
.microphone-button.recording { border-color: var(--danger); background: #f9dfdb; color: var(--danger); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); box-shadow: 0 0 0 7px rgba(159, 61, 46, 0.08); } }
.notes-list { display: grid; gap: 8px; margin-top: 14px; }
.note-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.note-item div { flex: 1; }
.note-item small { display: block; margin-top: 3px; color: var(--muted); }
.note-item button { border: 0; background: transparent; color: var(--muted); cursor: pointer; }

.reader {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  background: var(--ivory);
}
.reader-header { position: relative; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; gap: 9px; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--paper); }
.reader-title { display: flex; flex: 1; min-width: 170px; flex-direction: column; line-height: 1.2; }
.reader-title strong { color: var(--charcoal); }
.reader-title span { color: var(--muted); font-size: 0.75rem; }
.page-controls, .view-controls, .reader-accessibility { display: flex; align-items: center; gap: 5px; }
.page-controls span { min-width: 78px; color: var(--muted); font-size: 0.8rem; text-align: center; }
.reader-accessibility select { max-width: 185px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 0.78rem; }
.view-button { padding: 7px 9px; border: 1px solid var(--line); background: #fff; color: var(--muted); cursor: pointer; font-size: 0.77rem; }
.view-button:first-child { border-radius: 9px 0 0 9px; }
.view-button:last-child { border-radius: 0 9px 9px 0; }
.view-button + .view-button { margin-left: -6px; }
.view-button.active { position: relative; z-index: 1; border-color: var(--indigo); background: var(--indigo-soft); color: var(--indigo); font-weight: 800; }
.reader-progress { height: 3px; background: var(--parchment); }
.reader-progress span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 0.2s ease; }
.reader-scroll { flex: 1; overflow: auto; padding: 15px 12px 180px; }
.pdf-stage { text-align: center; }
#pdfCanvas { max-width: 100%; border-radius: 4px; background: #fff; box-shadow: 0 4px 20px rgba(50, 35, 15, 0.15); }
.reading-stage { width: min(830px, 100%); margin: 0 auto; font-size: var(--reader-font); }
.reading-paragraph { margin-bottom: 10px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; white-space: pre-wrap; transition: background 0.15s ease, border-color 0.15s ease; }
.bilingual-stage { width: min(1120px, 100%); margin: 0 auto; overflow-x: auto; }
.bilingual-head, .bilingual-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; min-width: 560px; }
.bilingual-head { position: sticky; top: -15px; z-index: 2; padding: 8px 0; background: var(--ivory); color: var(--bronze); font-size: 0.76rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.bilingual-row { margin-bottom: 10px; }
.bilingual-cell { min-height: 100%; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: #fff; font-size: var(--reader-font); white-space: pre-wrap; transition: background 0.15s ease, border-color 0.15s ease; }
.bilingual-cell.translation { background: var(--paper); }
.reading-active { border-color: var(--gold) !important; background: #f4e5b9 !important; box-shadow: 0 0 0 2px rgba(180, 135, 62, 0.12); }
.loading-card { padding: 30px; color: var(--muted); text-align: center; }

.reader-footer { position: fixed; right: 0; bottom: 0; left: 0; z-index: 106; border-top: 1px solid var(--line); background: rgba(255, 250, 240, 0.98); box-shadow: 0 -6px 22px rgba(50, 35, 15, 0.08); }
.speech-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 7px; padding: 8px 11px; border-bottom: 1px solid var(--line); }
.control-label { color: var(--muted); font-size: 0.72rem; font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase; }
.round-button { width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: #fff; color: var(--ink); cursor: pointer; }
.round-button.play { width: 42px; height: 42px; border-color: var(--indigo); background: var(--indigo); color: #fff; }
.audio-availability { flex-basis: 100%; min-height: 0; color: var(--muted); font-size: 0.74rem; text-align: center; }
.reader-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; width: min(650px, 100%); margin: 0 auto; padding: 7px 11px calc(7px + env(safe-area-inset-bottom)); }
.tool-button { min-height: 42px; border: 0; border-radius: 11px; font-weight: 900; cursor: pointer; }
.tool-button.translate { background: var(--parchment); color: #765717; }
.tool-button.explain { background: var(--sage); color: #4d543e; }
.tool-button.ask { background: var(--rose); color: #85502d; }

.assistant-panel {
  position: fixed;
  top: 11%;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 130;
  display: flex;
  flex-direction: column;
  width: min(860px, 100%);
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  background: #fff;
  box-shadow: 0 -8px 35px rgba(40, 30, 15, 0.24);
}
.assistant-panel > header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.assistant-panel header h2, .assistant-panel header p { margin-bottom: 0; }
.assistant-body { flex: 1; overflow: auto; padding: 18px; }
.assistant-question { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
.assistant-question .primary-button { width: 100%; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.answer-card { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.answer-card h3 { margin-bottom: 7px; font-size: 1rem; }
.answer-card ul { margin: 8px 0 0; padding-left: 20px; }
.evidence-list { display: grid; gap: 9px; margin-top: 16px; }
.evidence-item { padding: 11px 13px; border-left: 4px solid var(--gold); border-radius: 0 11px 11px 0; background: var(--parchment); }
.evidence-item blockquote { margin: 5px 0 8px; font-style: italic; }
.evidence-item button { border: 0; background: transparent; color: var(--bronze); cursor: pointer; font-weight: 800; padding: 0; }
.grounded-note { padding: 9px 12px; border-radius: 11px; background: #edf4e9; color: var(--success); font-size: 0.82rem; }
.unsupported-note { padding: 13px; border-radius: 12px; background: #f8e4df; color: #823629; }

.toast { position: fixed; right: 16px; bottom: 18px; z-index: 300; max-width: min(420px, calc(100% - 32px)); padding: 11px 15px; border-radius: 12px; background: var(--charcoal); color: #fff; box-shadow: var(--shadow); font-size: 0.84rem; }

@media (max-width: 760px) {
  .hero-brand { padding: 28px 18px 4px; }
  .hero-brand img { width: 132px; }
  .hero-content { padding: 8px 24px 38px; }
  .app-header { align-items: flex-start; flex-wrap: wrap; }
  .patient-controls { flex-basis: 100%; justify-content: flex-end; }
  .language-control { flex: 1; }
  .language-control select { flex: 1; max-width: none; }
  .role-grid, .form-grid, .upload-grid, .patient-documents { grid-template-columns: 1fr; }
  .section-heading, .section-title-row { align-items: flex-start; flex-direction: column; }
  .source-pill { align-self: flex-start; }
  .capability-grid { grid-template-columns: 1fr; }
  .reader-header { align-items: flex-start; }
  .reader-title { order: -1; flex-basis: calc(100% - 115px); }
  .reader-accessibility { flex: 1; justify-content: flex-end; }
  .view-controls { flex-basis: 100%; }
  .view-button { flex: 1; }
  .answer-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .chron { width: calc(100% - 20px); }
  .chron .brand small { display: none; }
  .chron .btn { padding: 0 10px; letter-spacing: .14em; }
  .shell { width: min(100% - 18px, 1040px); margin-top: 11px; }
  .app-header { width: 100%; border-radius: 0; }
  .brand-copy small { display: none; }
  .brand-copy strong { font-size: 1.12rem; }
  .brand-copy > span { font-size: 0.49rem; }
  .trial-badge { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hero, .form-section, .patient-section, .login-card { padding: 19px; }
  .role-card { min-height: 140px; }
  .bilingual-head, .bilingual-row { min-width: 510px; gap: 6px; }
  .bilingual-cell { padding: 10px; font-size: calc(var(--reader-font) * 0.83); }
  .speech-row { gap: 5px; }
  .speech-row select { max-width: 128px; padding-inline: 6px; }
  .control-label { display: none; }
  .reader-actions { gap: 5px; }
  .tool-button { font-size: 0.82rem; }
  .assistant-panel { top: 5%; }
}

@media print {
  body::before, .app-header, .reader, .assistant-panel, button, .record-status { display: none !important; }
  .shell { width: 100%; margin: 0; }
  .card { border: 0; box-shadow: none; }
  .view { display: none !important; }
  #patientView { display: block !important; }
  #patientView > section:not(:has(#notesList)) { display: none !important; }
}

/* Master copy additions */
.microphone-button svg.mic { width: 18px; height: 18px; fill: currentColor; display: block; margin: auto; }
.microphone-button.large svg.mic { width: 21px; height: 21px; }
.tool-button { font-weight: 600; letter-spacing: 0.02em; }
.document-icon { font-family: Georgia, serif; font-style: italic; letter-spacing: 0.12em; color: var(--gold-dark); }
.patient-document .document-icon { font-size: 1rem; }
@media (max-width: 760px) {
  .patient-controls, .language-control { min-width: 0; }
  .language-control select { min-width: 0; width: 100%; }
}

/* ===== Soft beige layer, Oct 2026: Chronicles beige, italic serif, no boxes, gentle fades ===== */
:root {
  --ivory: #ebdcce;          /* Chronicles beige ground */
  --paper: #f6eee6;          /* soft surface */
  --parchment: #efe3d6;
  --line: rgba(176, 141, 87, .28);
  --gold: #b08d57;
  --gold-dark: #8a6a3c;
  --bronze: #7a5c38;
  --charcoal: #5b4a3a;       /* warm, never black */
  --ink: #5f5043;
  --muted: #8d7b69;
  --indigo: #4f5b7a;
  --indigo-deep: #434e6b;
  --serif: "Cormorant Garamond", "Palatino Linotype", Palatino, Georgia, serif;
  --shadow: 0 18px 50px rgba(122, 92, 56, .08);
}
html, body { background: var(--ivory); }
body { font-family: var(--serif); font-size: 18px; color: var(--ink); }
body::before { display: none; }
h1, h2, h3 { font-family: var(--serif); font-weight: 400; color: var(--charcoal); letter-spacing: 0; }
h1 { font-size: clamp(1.7rem, 3.4vw, 2.3rem); font-weight: 300; }
h1 em, h2 em { font-style: italic; color: var(--gold-dark); }
h2 { font-size: clamp(1.25rem, 2.2vw, 1.5rem); font-style: italic; }
.eyebrow { font-family: var(--serif); font-weight: 500; font-size: .78rem; letter-spacing: .28em; color: var(--gold); }
label { font-weight: 400; font-size: .95rem; color: var(--ink); }
label b, .file-picker b { color: var(--gold-dark); font-weight: 400; }

/* fades */
@keyframes softIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.view:not(.hidden), .reader:not(.hidden), .assistant-panel:not(.hidden) { animation: softIn .8s cubic-bezier(.2,.7,.2,1) both; }
@media (prefers-reduced-motion: reduce) { .view, .reader, .assistant-panel { animation: none !important; } }

/* one logo: the card carries the mark on the opening page */
body[data-view="roleView"] .chron .brand { visibility: hidden; }
.app-header { background: rgba(243, 235, 227, .9); border-bottom: 1px solid var(--line); box-shadow: none; }
.brand-copy strong { font-family: var(--serif); font-weight: 400; font-style: italic; color: var(--gold-dark); font-size: 1.45rem; }
.brand-copy > span { font-family: var(--serif); font-style: italic; letter-spacing: .04em; text-transform: none; font-size: .82rem; color: var(--muted); }
body[data-view="roleView"] .app-header { display: none; }
.chron .btn { background: transparent; border-color: rgba(176,141,87,.4); font-family: var(--serif); font-weight: 500; }

/* no square boxes anywhere: soft, borderless surfaces */
.card { border: 0; border-radius: 28px; background: rgba(246, 238, 230, .72); box-shadow: var(--shadow); }
.hero { border: 0; background: transparent; box-shadow: none; }

/* opening page: the graphic card, fading into the words */
.hero-art { position: relative; margin: 0 auto; width: min(1000px, 100%); }
.hero-art img { display: block; width: 100%; height: auto; border-radius: 6px; animation: cardIn 1.6s ease both; }
.hero-art::after { content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 22%; background: linear-gradient(to bottom, rgba(235,220,206,0), var(--ivory)); pointer-events: none; }
@keyframes cardIn { from { opacity: 0; filter: blur(6px); } to { opacity: 1; filter: none; } }
.hero-content { text-align: center; padding: 6px 20px 10px; animation: softIn 1.2s .5s both; }
.hero-content h1 { margin-bottom: .5rem; }
.hero-content .lede { margin: 0 auto 26px; width: min(560px, 100%); font-style: italic; color: var(--muted); font-size: 1.12rem; }
.trust { width: min(620px, 100%); margin: 0 auto 30px; padding: 22px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.trust p { margin: 0 0 10px; color: var(--ink); font-size: 1.08rem; line-height: 1.6; }
.trust p:last-child { margin: 0; color: var(--muted); font-style: italic; }
.trust em { color: var(--gold-dark); }
.role-links { display: flex; justify-content: center; gap: clamp(24px, 6vw, 70px); flex-wrap: wrap; }
.role-link { background: none; border: 0; padding: 6px 4px 10px; cursor: pointer; font-family: var(--serif); color: var(--charcoal); text-align: center; position: relative; }
.role-link span { display: block; font-size: 1.35rem; font-style: italic; }
.role-link small { display: block; color: var(--muted); font-size: .9rem; margin-top: 2px; }
.role-link::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: 0; height: 1px; background: var(--gold); transform: scaleX(.3); opacity: .5; transition: transform .6s ease, opacity .6s ease; }
.role-link:hover::after, .role-link:focus-visible::after { transform: scaleX(1); opacity: 1; }
.quiet-centre { font-style: italic; color: var(--muted); font-size: .92rem; }

/* sign-in pages */
.login-card { text-align: center; padding: 34px 30px; }
.login-card form { text-align: left; }
.text-back { font-family: var(--serif); font-style: italic; color: var(--gold-dark); }

/* inputs and buttons: soft, rounded, light */
input, textarea, select { border: 1px solid var(--line) !important; border-radius: 14px !important; background: rgba(255,251,246,.75) !important; color: var(--ink); font-family: var(--serif); font-size: 1rem; }
input:focus, textarea:focus, select:focus { border-color: var(--gold) !important; }
.primary-button, .secondary-button { border-radius: 999px; font-family: var(--serif); font-weight: 500; letter-spacing: .06em; transition: background .4s, color .4s, border-color .4s; }
.primary-button { background: var(--gold-dark); border-color: var(--gold-dark); color: #fbf6ef; }
.primary-button:hover { background: var(--bronze); }
.secondary-button { background: transparent; border-color: var(--line); color: var(--bronze); }
.icon-button, .round-button { border-color: var(--line) !important; background: transparent !important; color: var(--bronze) !important; }
.round-button.play { background: var(--gold-dark) !important; color: #fbf6ef !important; border-color: var(--gold-dark) !important; }

/* coordinator: calm and balanced */
.section-heading { align-items: flex-end; margin-bottom: 18px; }
.section-heading h1 { font-size: clamp(1.45rem, 2.6vw, 1.85rem); margin-bottom: .3rem; }
.section-heading p { font-style: italic; font-size: .98rem; }
.form-section, .patient-section { padding: 26px clamp(20px, 4vw, 38px); margin-bottom: 18px; }
.step-title { gap: 12px; margin-bottom: 16px; }
.step-title > span { width: 30px; height: 30px; border: 1px solid var(--gold) !important; background: transparent !important; color: var(--gold-dark) !important; font-family: var(--serif); font-style: italic; font-weight: 400 !important; border-radius: 50% !important; }
.step-title h2 { font-size: 1.25rem; }
.form-grid { gap: 14px 26px; align-items: end; }
.upload-card { border: 0; border-radius: 22px; background: rgba(239,227,214,.6); padding: 18px 20px; }
.document-number { font-weight: 500; font-style: italic; letter-spacing: .12em; }
.file-picker { border-radius: 999px; border-style: solid; border-color: var(--line); text-align: center; color: var(--bronze); font-style: italic; }
.note-strip { background: transparent; border-top: 1px solid var(--line); border-radius: 0; padding: 12px 0 0; font-style: italic; color: var(--muted); }
.share-result { border: 0; background: rgba(239,227,214,.7); border-radius: 22px; }
.package-row { border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; background: transparent !important; }

/* patient pages */
.trial-badge, .source-pill { background: transparent; border: 1px solid var(--line); font-weight: 400; font-style: italic; color: var(--gold-dark); }
.patient-welcome h1 { font-style: italic; }
.coordinator-card { background: transparent; border-top: 1px solid var(--line); border-radius: 0; font-style: italic; }
.patient-document { border: 0 !important; border-radius: 22px !important; background: rgba(239,227,214,.65) !important; box-shadow: none !important; transition: background .5s, transform .5s; }
.patient-document:hover { background: rgba(232,214,194,.8) !important; transform: translateY(-2px); }
.capability-grid span { border-left: 0; background: transparent; border-top: 1px solid var(--line); border-radius: 0; }
.capability-grid b { font-family: var(--serif); font-style: italic; font-weight: 400; color: var(--gold-dark); }
.note-item { border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; background: transparent !important; }

/* reader */
.reader { background: var(--ivory) !important; }
.reader-header { background: rgba(243,235,227,.95) !important; border-bottom: 1px solid var(--line) !important; }
.reader-title strong { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 1.15rem; }
.view-button { border-color: var(--line) !important; background: transparent !important; color: var(--muted) !important; font-family: var(--serif); }
.view-button.active { background: var(--gold-dark) !important; border-color: var(--gold-dark) !important; color: #fbf6ef !important; }
.reading-paragraph, .bilingual-cell { border: 0 !important; border-radius: 16px !important; background: rgba(246,238,230,.75) !important; font-family: var(--serif); line-height: 1.7; transition: background .6s; }
.reading-active { background: rgba(222,198,160,.55) !important; box-shadow: none !important; }
.reader-footer { background: rgba(243,235,227,.96) !important; border-top: 1px solid var(--line) !important; backdrop-filter: blur(10px); }
.control-label { font-weight: 400; font-style: italic; letter-spacing: .06em; text-transform: none; font-size: .9rem; }
.reader-actions { grid-template-columns: repeat(5, 1fr); width: min(760px, 100%); }
.tool-button { border-radius: 999px !important; background: transparent !important; border: 1px solid var(--line) !important; color: var(--bronze) !important; font-family: var(--serif); font-style: italic; font-weight: 400 !important; font-size: 1.02rem; transition: background .4s, color .4s; }
.tool-button:hover { background: rgba(176,141,87,.14) !important; }
.tool-button.translate { color: var(--gold-dark) !important; border-color: var(--gold) !important; }
.assistant-panel { border: 0 !important; border-radius: 26px 26px 0 0 !important; background: var(--paper) !important; }
.answer-card, .evidence-item, .grounded-note { border: 0 !important; border-radius: 16px !important; background: rgba(239,227,214,.6) !important; color: var(--ink) !important; }
.toast { border-radius: 999px; background: var(--bronze); color: #fbf6ef; font-family: var(--serif); font-style: italic; }

@media (max-width: 760px) {
  body { font-size: 17px; }
  .reader-actions { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .tool-button { font-size: .88rem; padding: 0 4px; }
  .trust p { font-size: 1rem; }
}
/* refinements */
.hero-art { width: min(780px, 100%); }
label { display: block; }
label > input, label > select, label > textarea { display: block; width: 100%; margin-top: 7px; }
label > b { display: inline; margin-left: 2px; }
.step-title > span { display: inline-grid; place-items: center; font-size: 1rem; font-variant-numeric: lining-nums; line-height: 1; }
.app-header { background: transparent !important; border-bottom: 0 !important; backdrop-filter: none; padding-top: 2px; }
.shell { width: min(980px, calc(100% - 28px)); }
.section-heading .eyebrow { margin-bottom: .2rem; }
.form-section .primary-button { min-width: 220px; }
.upload-card { gap: 12px; }
body:not([data-view="patientView"]) .brand-button { visibility: hidden; }
.chron, .app-header { width: min(980px, calc(100% - 28px)); }

.hero-art::after { height: 7%; }
.hero-content { padding-top: 22px; }

/* ===== Madhu Kamath house style (matches madhukamath.com and the CGI pages) ===== */
:root { --ink: #3b2a1e; --charcoal: #3b2a1e; --deep: #5a2a18; --gold: #a8792e; --gold-dark: #a8792e; --muted: #7d6a58; --line: rgba(168,121,46,.38); --sc: "Cormorant SC", "Cormorant Garamond", Georgia, serif; }
body { font-size: 16px; color: var(--ink); }
h1 { font-size: clamp(1.45rem, 2.6vw, 1.9rem); font-weight: 300; color: var(--ink); }
h1 em { color: var(--gold); }
h2 { font-size: 1.15rem; font-weight: 400; color: var(--ink); }
.eyebrow { font-family: var(--sc); font-style: normal; font-size: 11px; letter-spacing: .34em; text-transform: uppercase; color: var(--gold); }

/* no panels, no shadows: hairlines only */
.card, .form-section, .patient-section, .login-card, .patient-welcome, .upload-card, .share-result, .patient-document, .answer-card, .evidence-item, .grounded-note, .reading-paragraph, .bilingual-cell {
  background: transparent !important; box-shadow: none !important; border: 0 !important; border-radius: 0 !important;
}
.form-section, .patient-section { padding: 26px 0 !important; margin: 0 !important; border-top: 1px solid var(--line) !important; }
.upload-card { padding: 0 !important; }
.patient-document { border-bottom: 1px solid var(--line) !important; padding: 14px 4px !important; }
.reading-paragraph, .bilingual-cell { padding: 6px 2px 10px !important; border-bottom: 1px solid rgba(168,121,46,.16) !important; }
.reading-active { background: rgba(168,121,46,.10) !important; }

/* buttons: hairline, square, small spaced capitals, never filled */
.primary-button, .secondary-button, .tool-button, .view-button, .file-picker, .chron .btn, .text-back {
  background: transparent !important; color: var(--deep) !important; border: 1px solid var(--line) !important; border-radius: 0 !important;
  font-family: var(--sc) !important; font-style: normal !important; font-weight: 500 !important; font-size: 11px !important;
  letter-spacing: .3em !important; text-transform: uppercase; min-height: 38px; padding: 0 20px !important; box-shadow: none !important;
  transition: border-color .5s, color .5s, background .5s;
}
.primary-button { border-color: rgba(168,121,46,.75) !important; }
.primary-button:hover, .secondary-button:hover, .tool-button:hover, .file-picker:hover, .chron .btn:hover { background: rgba(168,121,46,.08) !important; border-color: var(--gold) !important; color: var(--deep) !important; }
.view-button.active { background: transparent !important; color: var(--deep) !important; border-color: var(--gold) !important; }
.view-button + .view-button { margin-left: 0; }
.text-back { border: 0 !important; padding: 0 !important; min-height: 0; }
.form-section .primary-button { min-width: 0; }
.round-button, .icon-button { border-radius: 50% !important; border: 1px solid var(--line) !important; background: transparent !important; color: var(--deep) !important; }
.round-button.play { background: transparent !important; color: var(--deep) !important; border-color: var(--gold) !important; }
.step-title > span { display: none !important; }
.tool-button { min-height: 40px; }

/* inputs: a single underline, no boxes */
input, textarea, select { border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; background: transparent !important; padding: 8px 2px !important; font-size: 1rem; color: var(--ink); }
textarea { border: 1px solid var(--line) !important; padding: 10px !important; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold) !important; }
label { font-family: var(--sc); font-size: 11px; letter-spacing: .24em; text-transform: uppercase; color: var(--muted); }
label b { color: var(--gold); }
.document-number { font-family: var(--sc); font-style: normal; font-size: 11px; letter-spacing: .3em; color: var(--gold); }
.note-strip, .upload-status, .form-status, .quiet-centre { font-size: .9rem; }

/* header strip in her house style */
.chron .brand b { font-family: var(--sc); font-style: normal; font-weight: 500; font-size: 12px; letter-spacing: .42em; color: var(--deep); text-transform: uppercase; }
.chron .brand small { font-family: var(--sc); font-size: 9px; letter-spacing: .34em; color: var(--gold); }
.chron .brand img { height: 30px; }
.brand-copy strong { font-size: 1.15rem; color: var(--gold); }

/* opening page text sized down */
.hero-content .lede, .trust p { font-size: 1rem; }
.role-link span { font-family: var(--sc); font-style: normal; font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--deep); }
.role-link small { font-style: italic; font-size: .92rem; margin-top: 6px; }
.role-link { padding: 12px 22px; border: 1px solid var(--line); transition: border-color .5s, background .5s; }
.role-link::after { display: none; }
.role-link:hover { border-color: var(--gold); background: rgba(168,121,46,.06); }

/* reader */
.reader-footer, .reader-header { background: rgba(235,220,206,.96) !important; }
.reader-title strong { font-size: 1.05rem; }
.trial-badge, .source-pill { border-radius: 0; font-family: var(--sc); font-style: normal; font-size: 10px; letter-spacing: .26em; text-transform: uppercase; }
.toast { border-radius: 0; background: var(--ivory); color: var(--deep); border: 1px solid var(--gold); }
.assistant-panel { border-radius: 0 !important; background: var(--ivory) !important; border-top: 1px solid var(--gold) !important; }
@media (max-width: 760px) { .tool-button { letter-spacing: .12em !important; padding: 0 4px !important; font-size: 10px !important; } }

.demo-tick { display: flex; align-items: center; gap: 10px; margin: 0 0 16px; text-transform: none; letter-spacing: .02em; font-family: var(--serif); font-size: .95rem; font-style: italic; color: var(--muted); }
.demo-tick input { width: auto !important; margin: 0; accent-color: #a8792e; }

/* ===== Clear reading for older eyes: page one carries the reading help ===== */
:root { --page-zoom: 1; --reader-font: 20px; }
.shell { zoom: var(--page-zoom); }
body { font-size: 18px; }
.hero-content .lede, .trust p { font-size: 1.12rem; line-height: 1.65; }
.trust p:last-child { color: var(--ink); }
.quiet-centre { font-size: 1rem; color: var(--ink); }
label { font-size: 13px; letter-spacing: .16em; color: #6b5846; }
.eyebrow { font-size: 12px; }
.primary-button, .secondary-button, .tool-button, .view-button, .file-picker, .chron .btn { font-size: 13px !important; letter-spacing: .18em !important; min-height: 46px; }
.role-link span { font-size: 14px; letter-spacing: .2em; }
.role-link small { font-size: 1rem; color: var(--ink); }

.access-bar { position: sticky; top: 0; z-index: 70; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 22px;
  margin: 0 auto 18px; padding: 12px 10px; background: rgba(235,220,206,.97); border-bottom: 1px solid var(--line); zoom: calc(1 / var(--page-zoom)); }
.access-group { display: flex; align-items: center; gap: 10px; margin: 0; }
.access-label { font-family: var(--serif); font-style: italic; font-size: 1.05rem; color: var(--ink); letter-spacing: 0; text-transform: none; }
.access-btn { min-width: 54px; height: 54px; padding: 0 14px; border: 1px solid rgba(168,121,46,.7); background: rgba(246,238,230,.6); color: var(--deep);
  font-family: var(--serif); font-size: 1.35rem; cursor: pointer; transition: background .4s, border-color .4s; }
.access-btn.big { font-size: 1.7rem; }
.access-btn.wide { font-size: 1.15rem; padding: 0 22px; display: inline-flex; align-items: center; gap: 10px; }
.access-btn.wide span { font-size: .9rem; color: var(--gold); }
.access-btn:hover, .access-btn.on { background: rgba(168,121,46,.14); border-color: var(--gold); }
.access-group.lang select { height: 54px; min-width: 190px; font-size: 1.12rem !important; padding: 0 10px !important; border: 1px solid rgba(168,121,46,.7) !important; background: rgba(246,238,230,.6) !important; color: var(--deep); }

/* reader: large, clear controls */
.reader-header .icon-button, .page-controls .icon-button, .reader-accessibility .icon-button { width: 48px; height: 48px; font-size: 1.3rem; }
.page-controls span { font-size: 1rem; color: var(--ink); min-width: 110px; }
.reader-accessibility select, .speech-row select { font-size: 1.05rem !important; min-height: 46px; }
.reading-stage, .bilingual-stage { font-size: var(--reader-font); line-height: 1.75; color: var(--ink); }
.round-button { width: 50px !important; height: 50px !important; font-size: 1.1rem; }
.round-button.play { width: 58px !important; height: 58px !important; font-size: 1.3rem; }
.control-label { font-size: 1.05rem; color: var(--ink); display: inline !important; }
.tool-button { min-height: 52px !important; font-size: 14px !important; }
.reader-title strong { font-size: 1.25rem; }
.reader-title span { font-size: .9rem; }
.reader-scroll { padding-bottom: 210px; }

@media (max-width: 760px) {
  .access-bar { gap: 10px; }
  .access-btn.wide { flex: 1 1 100%; justify-content: center; }
  .access-group.lang { flex: 1 1 100%; justify-content: center; }
  .access-group.lang select { flex: 1; }
  .tool-button { font-size: 12px !important; letter-spacing: .06em !important; }
  .reader-actions { grid-template-columns: repeat(3, 1fr) !important; }
}
.file-picker { display: flex !important; align-items: center; justify-content: center; }

.access-label { white-space: nowrap; }

/* Language chooser: big, written in each language's own script */
.lang-btn b { font-weight: 500; color: var(--deep); }
.lang-btn span { font-size: 1.2rem !important; }
.language-picker { position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(59,42,30,.28); animation: softIn .4s ease both; }
.language-sheet { width: min(980px, 100%); max-height: min(86vh, 900px); display: flex; flex-direction: column; background: var(--ivory); border: 1px solid var(--gold); padding: 20px clamp(16px, 3vw, 30px) 24px; }
.language-sheet header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.language-sheet h2 { margin: 0; font-size: 1.6rem; font-style: italic; }
.language-sheet .icon-button { width: 52px; height: 52px; font-size: 1.6rem; }
#languageFilter { font-size: 1.2rem !important; padding: 12px 6px !important; margin-bottom: 14px; }
.language-grid { overflow: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; padding-bottom: 6px; }
.language-choice { min-height: 70px; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; padding: 10px 16px; text-align: left;
  border: 1px solid var(--line); background: rgba(246,238,230,.6); color: var(--ink); cursor: pointer; transition: background .3s, border-color .3s; }
.language-choice .native { font-size: 1.3rem; line-height: 1.25; font-family: var(--serif), "Noto Sans", system-ui, sans-serif; }
.language-choice small { font-size: .95rem; color: var(--muted); }
.language-choice:hover, .language-choice:focus-visible { background: rgba(168,121,46,.12); border-color: var(--gold); outline: none; }
.language-choice.chosen { border-color: var(--gold); background: rgba(168,121,46,.16); }
@media (max-width: 600px) { .language-grid { grid-template-columns: 1fr 1fr; } .language-choice .native { font-size: 1.15rem; } }

/* ===== Standardisation: one logo place, watermark everywhere, the card carried through ===== */
/* logo always in the same place, always visible, always back to Home */
body[data-view="roleView"] .chron .brand, .chron .brand { visibility: visible !important; }
.chron { position: relative; z-index: 80; height: 64px; }
.reader:not(.hidden) ~ * .chron { display: none; }

/* watermark: her gold mark, faint, fixed on every page */
body::before { display: block !important; content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url("/comprehend/brand/mark.webp") no-repeat center 55%; background-size: min(38vw, 360px); opacity: .055; }

/* the card's sunlit path drifts softly behind every page except the opening one */
body::after { content: ""; position: fixed; inset: -4%; z-index: 0; pointer-events: none;
  background: url("https://madhukamath.com/media/card-comprehend-lt-deckle.webp") no-repeat 78% 40% / cover;
  opacity: .16; filter: blur(1.5px) saturate(.85);
  -webkit-mask-image: radial-gradient(ellipse at 78% 45%, #000 0%, rgba(0,0,0,.55) 38%, transparent 72%);
  mask-image: radial-gradient(ellipse at 78% 45%, #000 0%, rgba(0,0,0,.55) 38%, transparent 72%);
  animation: drift 48s ease-in-out infinite alternate; transition: opacity 1.4s ease; }
body[data-view="roleView"]::after { opacity: 0; }
@keyframes drift { from { transform: scale(1.02) translate3d(0,0,0); } to { transform: scale(1.1) translate3d(-2%, -1.5%, 0); } }
@media (prefers-reduced-motion: reduce) { body::after { animation: none; } }
.shell, .app-header, .chron { position: relative; z-index: 2; }
.reader { background: rgba(235,220,206,.94) !important; }

/* page one: the card large, fading in */
.hero-art { width: min(1180px, 100%) !important; }
.hero-art img { border-radius: 4px; box-shadow: 0 30px 80px rgba(90,42,24,.12); }
.shell { width: min(1180px, calc(100% - 28px)); }
.view.narrow, #coordinatorView { width: min(980px, 100%); margin-inline: auto; }

/* gentle fade between pages */
.view:not(.hidden) { animation: softIn 1s cubic-bezier(.2,.7,.2,1) both; }
/* background: only the sunlit path, soft, low right; never the card's lettering */
body::after { inset: 0 !important; background-position: 100% 100% !important; background-size: 150vmax auto !important; opacity: .11 !important;
  -webkit-mask-image: radial-gradient(ellipse 55% 60% at 88% 92%, #000 0%, rgba(0,0,0,.4) 45%, transparent 75%) !important;
  mask-image: radial-gradient(ellipse 55% 60% at 88% 92%, #000 0%, rgba(0,0,0,.4) 45%, transparent 75%) !important; }
/* reader is a solid page of its own: nothing shows through, scrolling stays inside it */
.reader { background: var(--ivory) !important; }
.reader-scroll { overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.assistant-body, .language-grid { overscroll-behavior: contain; }
body:has(.reader:not(.hidden)) .shell, body:has(.reader:not(.hidden)) .chron { visibility: hidden; }

/* ===== Room to read: compact bars so the document always has most of the screen ===== */
.access-bar { background: var(--ivory) !important; }
.reader-header { gap: 8px !important; padding: 8px 12px !important; }
.reader-footer { padding: 6px 10px calc(6px + env(safe-area-inset-bottom)) !important; }
.speech-row { padding: 4px 0 !important; gap: 8px !important; }
.audio-availability:empty { display: none; }
.reader-actions { margin: 4px auto 0 !important; }
.tool-button { min-height: 44px !important; }
@media (min-width: 1100px) {
  .reader-footer { display: flex; align-items: center; justify-content: center; gap: 22px; }
  .speech-row { flex: 0 0 auto; flex-wrap: nowrap !important; }
  .reader-actions { margin: 0 !important; width: auto !important; grid-template-columns: repeat(5, minmax(110px, 1fr)) !important; }
}
@media (max-width: 760px) {
  /* page one: one slim row of reading help */
  .access-bar { flex-wrap: nowrap !important; gap: 8px !important; padding: 8px 6px !important; zoom: 1 !important; }
  .access-bar .access-label { display: none; }
  .access-btn { min-width: 48px; height: 48px; padding: 0 10px; }
  .access-btn.wide { flex: 1 1 auto !important; font-size: 1rem; padding: 0 10px; justify-content: center; }
  #pageReadAloud span[data-tr] { display: none; }
  #pageReadAloud::after { content: ""; }
  .lang-btn span[data-tr] { display: none; }
  /* reader top: one tidy block */
  .reader-header { display: grid !important; grid-template-columns: auto 1fr auto; align-items: center; row-gap: 6px; }
  .reader-title { order: 0 !important; grid-column: 2; flex-basis: auto !important; min-width: 0; }
  .reader-title strong { font-size: 1rem !important; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .reader-title span { display: none; }
  #closeReader { grid-column: 1; grid-row: 1; padding: 0 12px !important; min-height: 40px; }
  .page-controls { grid-column: 3; grid-row: 1; }
  .page-controls span { min-width: 64px !important; font-size: .9rem !important; }
  .page-controls .icon-button { width: 40px !important; height: 40px !important; }
  .reader-accessibility { display: none !important; }
  .view-controls { grid-column: 1 / -1; display: grid !important; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .view-button { min-height: 36px !important; padding: 0 4px !important; font-size: 11px !important; letter-spacing: .1em !important; }
  /* reader bottom: one row of controls, one row of tools */
  .control-label, #speechSpeed { display: none !important; }
  .speech-row select { max-width: 120px; min-height: 40px !important; }
  .round-button { width: 42px !important; height: 42px !important; }
  .round-button.play { width: 48px !important; height: 48px !important; }
  .reader-actions { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; gap: 4px !important; }
  .tool-button { min-height: 42px !important; font-size: 10.5px !important; letter-spacing: .06em !important; padding: 0 2px !important; }
  .reader-scroll { padding-bottom: 150px !important; }
}
@media (max-width: 760px) {
  .reader-accessibility { display: flex !important; grid-column: 3; grid-row: 2; gap: 4px; }
  .reader-accessibility select { display: none !important; }
  .reader-accessibility .icon-button { width: 40px !important; height: 40px !important; }
  .view-controls { grid-column: 1 / 3 !important; grid-row: 2; }
}
@media (max-width: 760px) {
  #pageReadAloud span[data-tr] { display: inline !important; font-size: .95rem; }
  .access-bar { flex-wrap: wrap !important; }
  #pageReadAloud { order: 3; flex: 1 1 100% !important; height: 46px; }
}
@media (max-width: 760px) { .lang-btn span[data-tr] { display: inline !important; } .lang-btn { font-size: .95rem !important; } }

/* ===== One reading-help bar, same place on every page ===== */
.access-bar { zoom: 1 !important; position: sticky; top: 0; z-index: 90; width: min(1180px, calc(100% - 28px)); margin: 0 auto 14px !important; }
.reader-lang { height: 46px !important; min-width: 0 !important; padding: 0 14px !important; font-size: 1.05rem !important; }
.reader-lang b { font-weight: 500; }
@media (max-width: 760px) { .reader-accessibility .reader-lang { height: 40px !important; padding: 0 8px !important; font-size: .95rem !important; } }

/* ===== Brand carried onto every page, including the reader ===== */
body::before { opacity: .09 !important; background-size: min(46vw, 440px) !important; }
body::after { opacity: .22 !important;
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 85% 88%, #000 0%, rgba(0,0,0,.5) 50%, transparent 80%) !important;
  mask-image: radial-gradient(ellipse 70% 75% at 85% 88%, #000 0%, rgba(0,0,0,.5) 50%, transparent 80%) !important; }
.inner-art { width: min(820px, 100%) !important; margin: 0 auto 10px !important; }
.inner-art::after { height: 14% !important; }

/* reader: logo top-left, watermark and the sunlit path behind the document */
.reader { isolation: isolate; }
.reader::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("/comprehend/brand/mark.webp") no-repeat center 55%; background-size: min(46vw, 440px); opacity: .09; }
.reader::after { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: url("https://madhukamath.com/media/card-comprehend-lt-deckle.webp") no-repeat 100% 100% / 150vmax auto; opacity: .22; filter: blur(1.5px) saturate(.85);
  -webkit-mask-image: radial-gradient(ellipse 70% 75% at 85% 88%, #000 0%, rgba(0,0,0,.5) 50%, transparent 80%);
  mask-image: radial-gradient(ellipse 70% 75% at 85% 88%, #000 0%, rgba(0,0,0,.5) 50%, transparent 80%);
  animation: drift 48s ease-in-out infinite alternate; }
.reader-header, .reader-progress, .reader-scroll, .reader-footer { position: relative; z-index: 1; }
.reader-footer { position: fixed !important; z-index: 106 !important; }
.reader-header { background: rgba(235,220,206,.92) !important; }
.reading-paragraph, .bilingual-cell { background: rgba(246,238,230,.55) !important; }
.reader-logo { display: inline-flex; align-items: center; flex: 0 0 auto; }
.reader-logo img { height: 34px; width: auto; }
@media (max-width: 760px) {
  .reader-logo { grid-column: 1; grid-row: 1; }
  #closeReader { grid-column: 2 !important; }
  .reader-title { grid-column: 3 !important; }
  .page-controls { grid-column: 4 !important; }
  .reader-header { grid-template-columns: auto auto 1fr auto !important; }
  .view-controls { grid-column: 1 / 4 !important; }
  .reader-accessibility { grid-column: 4 !important; }
  .reader-logo img { height: 28px; }
}
.reader-logo { padding: 0 6px 0 4px; margin-right: 4px; border-right: 1px solid var(--line); }
.reader-logo img { height: 42px !important; }
@media (max-width: 760px) { .reader-logo img { height: 32px !important; } .reader-logo { border-right: 0; padding: 0; } }

/* Speak a question */
.voice-ask { width: 100%; min-height: 64px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; gap: 12px;
  border: 1px solid var(--gold); background: rgba(168,121,46,.10); color: var(--deep); font-family: var(--serif); font-size: 1.25rem; font-style: italic; cursor: pointer; transition: background .4s; }
.voice-ask svg.mic { width: 26px; height: 26px; fill: var(--gold); }
.voice-ask:hover { background: rgba(168,121,46,.18); }
body:has(.microphone-button.recording) .voice-ask { background: rgba(168,121,46,.22); animation: pulse 1.6s ease-in-out infinite; }
.tool-button.speak { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.tool-button.speak svg.mic { width: 16px; height: 16px; fill: var(--gold); }
.reader-actions { grid-template-columns: repeat(6, minmax(0, 1fr)) !important; }
@media (min-width: 1100px) { .reader-actions { grid-template-columns: repeat(6, minmax(100px, 1fr)) !important; } }
@media (max-width: 760px) { .reader-actions { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; } .tool-button { min-height: 38px !important; } }

/* ===== Patient page kept clean ===== */
.capability-grid { display: none !important; }
.patient-welcome { padding: 18px 0 8px !important; }
.fold { padding: 0 !important; }
.fold > summary { list-style: none; cursor: pointer; padding: 18px 2px; display: flex; align-items: center; justify-content: space-between;
  font-family: var(--serif); font-style: italic; font-size: 1.15rem; color: var(--ink); }
.fold > summary::-webkit-details-marker { display: none; }
.fold > summary::after { content: "+"; font-style: normal; color: var(--gold); font-size: 1.4rem; transition: transform .4s; }
.fold[open] > summary::after { transform: rotate(45deg); }
.fold > .section-title-row { display: none; }
.fold[open] { padding-bottom: 20px !important; }

/* Laptops: fit each screen to the laptop's height instead of scrolling */
@media (min-width:900px) and (max-height:860px){ html{zoom:.9} }
@media (min-width:900px) and (max-height:780px){ html{zoom:.84} }
@media (min-width:900px) and (max-height:700px){ html{zoom:.78} }

/* Read aloud: the paragraph being read is clearly highlighted */
.reading-paragraph.reading-active, .bilingual-cell.reading-active { background: rgba(214,178,116,.38) !important; box-shadow: inset 3px 0 0 var(--gold) !important; }

/* ===== Reader: the whole menu on top, in two lines ===== */
.reader-header { display: flex !important; flex-wrap: wrap !important; align-items: center; gap: 8px 10px !important; padding: 8px 14px !important; }
.reader-tools { flex: 1 1 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; border-top: 1px solid var(--line); padding-top: 8px; }
.reader-tools .speech-row { padding: 0 !important; justify-content: flex-start; flex: 0 0 auto; }
.reader-tools .reader-actions { margin: 0 !important; width: auto !important; flex: 1 1 auto; display: grid; grid-template-columns: repeat(6, minmax(86px, 1fr)) !important; gap: 6px !important; max-width: 820px; }
.reader-tools .tool-button { min-height: 42px !important; }
.reader-tools .audio-availability { flex-basis: 100%; }
.reader-scroll { padding-bottom: 40px !important; }
.view-controls { margin-left: auto; }
@media (max-width: 760px) {
  .reader-header { display: grid !important; }
  .reader-tools { grid-column: 1 / -1; }
  .reader-tools .speech-row { flex: 1 1 100%; justify-content: center; }
  .reader-tools .reader-actions { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; max-width: none; }
  .reader-tools .tool-button { min-height: 36px !important; }
}

/* Coordinator page: demonstration banner and auto-fill */
.demo-banner { margin: 0 0 18px; padding: 16px 20px; border: 1px solid var(--gold); background: rgba(168,121,46,.08); }
.demo-banner p:last-child { margin: 0; font-size: 1.02rem; color: var(--ink); }
.autofill-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 16px; }
.autofill-row .form-status { margin: 0; }
input.filled { background: rgba(214,178,116,.18) !important; transition: background 1.2s; }
body.demo-mode #coordinatorLogout, body.demo-mode .demo-tick, body.demo-mode #coordinatorView > .card.form-section:last-child, body.demo-mode .file-picker { display: none !important; }

/* Read aloud follows the voice */
.speaking-now { background: rgba(214,178,116,.55); border-radius: 3px; box-shadow: 0 0 0 2px rgba(214,178,116,.55); transition: background .3s; }
.word-now { font-weight: inherit; background: rgba(168,121,46,.55); color: #2a1a10; border-radius: 3px; }

/* ===== Complete menu: speed, notes and the document tools ===== */
.speed-control { display: inline-flex; align-items: center; gap: 8px; margin: 0; text-transform: none; letter-spacing: 0; }
.speed-control > span { font-family: var(--serif); font-style: italic; font-size: 1rem; color: var(--ink); }
.speed-control select { min-height: 44px; min-width: 150px; font-size: 1.05rem !important; padding: 0 8px !important; border: 1px solid rgba(168,121,46,.7) !important; background: rgba(246,238,230,.6) !important; color: var(--deep); }
.reader-tools .speed-control select { min-height: 40px; min-width: 140px; }
.access-tools { display: none; flex-basis: 100%; justify-content: center; gap: 8px; flex-wrap: wrap; }
body.has-docs .access-tools { display: flex; }
.access-tools .access-btn { font-size: 1.05rem; padding: 0 18px; height: 46px; display: inline-flex; align-items: center; gap: 6px; }
.access-tools svg.mic { width: 18px; height: 18px; fill: var(--gold); }
.reader-tools .reader-actions { grid-template-columns: repeat(7, minmax(78px, 1fr)) !important; max-width: 900px; }
.assistant-notes { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
@media (max-width: 760px) {
  .access-bar .speed-control { flex: 1 1 100%; justify-content: center; }
  .access-bar .speed-control > span { display: inline !important; }
  .reader-tools .speed-control { display: inline-flex !important; }
  #speechSpeed { display: inline-block !important; }
  .reader-tools .reader-actions { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
  .access-tools .access-btn { flex: 1 1 28%; padding: 0 8px; font-size: .95rem; }
}

/* =====================================================================
   ONE MENU — the same masthead and reading rail on every page and in the reader.
   Line 1 (masthead): mark, Comprehend, where you are, and the way back.
   Line 2 (rail): reading help on the left, document tools on the right.
   Plain words, no boxes; hairlines only between groups.
   ===================================================================== */
:root { --rail-bg: rgba(235,220,206,.95); --rail-w: min(1180px, calc(100% - 32px)); }
.app-header, .chron, .access-bar, .reader-header, .reader-tools, .reader-logo { display: none !important; }

.mast { position: relative; z-index: 80; display: flex; align-items: center; width: var(--rail-w); min-height: 72px; margin: 0 auto; gap: 0; }
.mast-mark { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; color: inherit; text-decoration: none; }
.mast-mark img { height: 36px; width: auto; display: block; }
.mast-name { font-family: var(--sc); font-size: 13px; letter-spacing: .34em; line-height: 1; color: var(--deep); text-transform: uppercase; white-space: nowrap; }
.mast-name small { display: block; margin-top: 6px; font-size: 9.5px; letter-spacing: .36em; color: var(--gold); }
.mast-rule { flex: 0 0 1px; width: 1px; height: 30px; margin: 0 22px; background: var(--line); }
.mast-title { padding: 0; border: 0; background: none; cursor: pointer; font: italic 400 25px/1 var(--serif); color: var(--deep); white-space: nowrap; }
.mast-title .trial-badge { margin: 0 0 0 14px !important; padding: 0 0 0 14px !important; border: 0 !important; border-left: 1px solid var(--line) !important; background: none !important;
  font: 400 15px/1 var(--sc) !important; letter-spacing: .18em !important; color: var(--gold) !important; box-shadow: none !important; vertical-align: 3px; }
.mast-end { display: flex; align-items: center; gap: 28px; margin-left: auto; }
.mast-link { padding: 6px 0; border: 0; background: none; cursor: pointer; font: italic 400 19px/1 var(--serif); color: var(--ink); text-decoration: none; white-space: nowrap;
  text-underline-offset: 6px; text-decoration-thickness: 1px; }
.mast-link:hover { color: var(--deep); text-decoration: underline; text-decoration-color: var(--gold); }

.rail { position: sticky; top: 0; z-index: 90; margin: 0 0 18px; background: var(--rail-bg); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); zoom: 1 !important; }
.rail-in { display: flex; align-items: center; justify-content: space-between; gap: 6px 24px; width: var(--rail-w); min-height: 58px; margin: 0 auto; }
.rail-set { display: flex; align-items: center; flex-wrap: wrap; }
.rail-group { display: inline-flex; align-items: center; gap: 2px; padding: 0 18px; border-left: 1px solid var(--line); min-height: 34px; }
.rail-set > .rail-group:first-child { padding-left: 0; border-left: 0; }
.rail-label { margin: 0 6px 0 2px; font: italic 400 17px/1 var(--serif); color: var(--muted); white-space: nowrap; }
.rail-btn { display: inline-flex; align-items: center; gap: 8px; height: 44px; min-width: 40px; justify-content: center; padding: 0 10px; border: 0 !important; border-radius: 0 !important; background: none !important; box-shadow: none !important;
  cursor: pointer; font: 500 19px/1 var(--serif) !important; letter-spacing: 0 !important; text-transform: none !important; color: var(--deep) !important; white-space: nowrap;
  text-decoration: none; text-underline-offset: 7px; text-decoration-thickness: 1px; transition: color .3s; }
.rail-btn:hover { color: var(--gold) !important; text-decoration: underline; text-decoration-color: var(--gold); }
.rail-btn:focus-visible, .rail-select:focus-visible, .mast-link:focus-visible, .mast-title:focus-visible, .view-tab:focus-visible { outline: 1px solid var(--gold); outline-offset: 2px; }
.rail-btn.on, .rail-btn.recording { color: var(--gold) !important; text-decoration: underline; text-decoration-color: var(--gold); }
.rail-btn b { font-weight: 500; }
.rail-ico { color: var(--gold); font-size: .85em; }
.rail-btn svg.mic { width: 16px; height: 16px; fill: var(--gold); }
#pageFontUp, #readerFontUp { font-size: 23px !important; }
.rail-listen .rail-btn { min-width: 36px; padding: 0 6px; font-size: 17px !important; color: var(--gold) !important; }
.rail-listen .rail-play { font-size: 19px !important; }
.rail-select { -webkit-appearance: none; appearance: none; height: 34px; margin-left: 10px; padding: 0 22px 0 4px !important; min-width: 0 !important; min-height: 0 !important;
  border: 0 !important; border-bottom: 1px solid var(--line) !important; border-radius: 0 !important; box-shadow: none !important; cursor: pointer;
  background: transparent url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23a8792e'/%3E%3C/svg%3E") no-repeat right 4px center !important;
  font: italic 400 18px/1 var(--serif) !important; color: var(--ink) !important; }
.rail-select[hidden] { display: none !important; }
#accessTools { display: none; }
body.has-docs #accessTools { display: flex; }
.rail-tools { gap: 0 2px; }
.rail-tools .rail-btn { padding: 0 11px; }
.rail-note { width: var(--rail-w); margin: -4px auto 8px; font: italic 15px/1.3 var(--serif); color: var(--muted); }
.rail-note:empty { display: none; }

/* in the reader */
.reader-mast { position: relative; z-index: 2; flex: 0 0 auto; background: var(--rail-bg); }
.reader-mast .rail { position: relative; margin: 0; border-bottom: 1px solid var(--line); }
.reader-mast .mast { min-height: 68px; }
.mast-back { font-style: normal; color: var(--deep); }
.mast-doc { display: flex; flex-direction: column; min-width: 0; margin-left: 26px; line-height: 1.15; }
.mast-doc strong { font: italic 400 22px/1.15 var(--serif); color: var(--deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mast-doc span { margin-top: 3px; font: 400 15px/1.2 var(--serif); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mast-pages { display: inline-flex; align-items: center; }
.mast-pages #pageLabel { min-width: 92px; text-align: center; font: italic 400 18px/1 var(--serif); color: var(--ink); }
.mast-pages .rail-btn { font-size: 26px !important; color: var(--gold) !important; }
.mast-views { display: inline-flex; align-items: center; gap: 20px; padding-left: 26px; border-left: 1px solid var(--line); }
.view-tab { height: 44px; padding: 0; border: 0; background: none; cursor: pointer; font: 400 18px/1 var(--serif); color: var(--muted); white-space: nowrap;
  box-shadow: inset 0 -1px 0 transparent; transition: color .3s, box-shadow .3s; }
.view-tab:hover { color: var(--deep); }
.view-tab.active { color: var(--deep); box-shadow: inset 0 -1px 0 var(--gold); }

@media (max-width: 1180px) {
  .reader-mast .mast-name { display: none; }
  .reader-mast .mast-rule { margin: 0 14px; }
  .mast-views { gap: 14px; padding-left: 16px; }
  .mast-end { gap: 16px; }
}
@media (max-width: 980px) {
  .rail-in { flex-wrap: wrap; justify-content: flex-start; padding: 6px 0; }
  .rail-tools { width: 100%; border-top: 1px solid var(--line); padding-top: 4px; }
  .rail-tools .rail-btn:first-child { padding-left: 0; }
  .reader-mast .mast { flex-wrap: wrap; padding: 8px 0; }
  .reader-mast .mast-end { width: 100%; justify-content: space-between; margin: 4px 0 0; }
  .mast-views { border-left: 0; padding-left: 0; }
}
@media (max-width: 640px) {
  :root { --rail-w: calc(100% - 24px); }
  .mast { min-height: 60px; }
  .mast-name, .mast-rule { display: none; }
  .mast-mark { margin-right: 14px; }
  .mast-title { font-size: 22px; }
  .mast-title .trial-badge { display: none !important; }
  .mast-end { gap: 18px; }
  .mast-link { font-size: 17px; }
  .rail-group { padding: 0 10px; }
  .rail-label { display: none; }
  .rail-set { width: 100%; justify-content: space-between; }
  .rail-btn { font-size: 18px !important; padding: 0 7px; }
  .rail-tools { justify-content: space-between; }
  .rail-tools .rail-btn { padding: 0 4px; }
  .rail-select { margin-left: 4px; font-size: 16px !important; }
  #pageReadAloud span[data-tr] { display: inline !important; }
  .reader-mast .rail-listen .rail-label { display: none; }
  .mast-doc { margin-left: 4px; flex: 1; }
  .mast-doc strong { font-size: 19px; }
  .mast-doc span { display: none; }
  .view-tab { font-size: 16px; }
  .mast-pages #pageLabel { min-width: 70px; font-size: 16px; }
}
@media (max-width: 640px) {
  #pageReadAloud { order: 0 !important; flex: 0 0 auto !important; height: 44px; }
  .rail-set { flex-wrap: wrap; justify-content: space-between; }
  /* speed appears on its own line while reading aloud, so the rail stays one line at rest */
  #pageSpeed, #speechSpeed, #speechLanguage { display: none !important; }
  body:has(#pageReadAloud.on) #pageSpeed, .reader-mast:has(#playSpeech.on) #speechSpeed { display: inline-block !important; }
  .reader-mast:has(#playSpeech.on) #speechLanguage:not([hidden]) { display: inline-block !important; }
  .reader-mast .rail-tools #saveDocButton, .reader-mast .rail-tools #printDocButton { display: none; }
  .reader-mast .mast-end { gap: 8px; }
  .mast-views { gap: 14px; }
  .view-tab { font-size: 0 !important; }
  .view-tab::after { font-size: 16px; }
  .view-tab[data-reader-view="pdf"]::after { content: "PDF"; }
  .view-tab[data-reader-view="text"]::after { content: "Reading"; }
  .view-tab[data-reader-view="bilingual"]::after { content: "Side by side"; }
  .mast-pages .rail-btn { min-width: 32px; padding: 0 4px; }
}

/* =====================================================================
   SECTIONS IN BANDS — light and deeper beige alternate, full width,
   so each part of a page reads as its own place. Clearer, darker text.
   ===================================================================== */
:root { --band-light: rgba(246,238,229,.88); --band-deep: rgba(224,204,184,.93); --text: #2f2117; --text-soft: #4d3a2b; }
.band-light, .band-deep { position: relative; padding-top: 40px !important; padding-bottom: 40px !important; margin-top: 0 !important; margin-bottom: 0 !important;
  border: 0 !important; border-radius: 0 !important; clip-path: inset(0 -100vmax); }
.band-light { background: var(--band-light) !important; box-shadow: 0 0 0 100vmax var(--band-light) !important; }
.band-deep  { background: var(--band-deep) !important;  box-shadow: 0 0 0 100vmax var(--band-deep) !important; }

/* opening page */
#roleView .hero { padding: 0 !important; background: none !important; }
#roleView .hero-content > h1, #roleView .hero-content > .lede { position: relative; }
#roleView .hero-content { display: block; }
#roleView .trust { margin: 26px 0 0 !important; border: 0 !important; }
#roleView .trust, #roleView .role-links { max-width: none !important; }
#roleView .role-links { margin: 0 !important; justify-content: center; }
#roleView .quiet-centre { margin: 0 !important; padding: 26px 0 40px; }

/* coordinator page: the five steps alternate */
#packageForm > .form-section:nth-of-type(odd), #coordinatorView > .form-section { background: var(--band-light) !important; box-shadow: 0 0 0 100vmax var(--band-light) !important; }
#packageForm > .form-section:nth-of-type(even) { background: var(--band-deep) !important; box-shadow: 0 0 0 100vmax var(--band-deep) !important; }
#packageForm > .form-section, #coordinatorView > .form-section { clip-path: inset(0 -100vmax); padding: 36px 0 !important; margin: 0 !important; border: 0 !important; border-radius: 0 !important; }
#packageForm > .form-section + .form-section { border-top: 0 !important; }

/* patient page */
#patientView > .patient-welcome { background: var(--band-light) !important; box-shadow: 0 0 0 100vmax var(--band-light) !important; clip-path: inset(0 -100vmax); padding: 36px 0 32px !important; margin: 0 !important; }
#patientView > .patient-section:not(.fold) { background: var(--band-deep) !important; box-shadow: 0 0 0 100vmax var(--band-deep) !important; clip-path: inset(0 -100vmax); padding: 32px 0 !important; margin: 0 !important; border: 0 !important; }
#patientView > .fold { background: var(--band-light) !important; box-shadow: 0 0 0 100vmax var(--band-light) !important; clip-path: inset(0 -100vmax); margin: 0 !important; border: 0 !important; border-bottom: 1px solid var(--line) !important; }
#patientView > .fold + .fold { background: var(--band-deep) !important; box-shadow: 0 0 0 100vmax var(--band-deep) !important; }
.shell > .view { padding-bottom: 0 !important; }
.shell { margin-bottom: 0 !important; }

/* readability: larger, darker, steadier type */
.shell { color: var(--text); }
.shell p, .shell li, .shell label, .shell small, .shell .lede, .shell .trust p, .coordinator-card, .upload-status, .form-status, .quiet-centre { color: var(--text-soft) !important; }
.shell p, .shell li { font-size: 20px; line-height: 1.6; font-weight: 500; }
.shell .lede { font-size: 21px !important; font-style: normal !important; line-height: 1.55 !important; }
.shell .trust p { font-size: 21px !important; line-height: 1.6 !important; }
.shell h1 { color: var(--deep) !important; }
.shell h2 { font-size: 26px !important; color: var(--deep) !important; }
.shell .eyebrow { font-size: 14px !important; letter-spacing: .22em !important; color: #8a5f1f !important; }
.shell label { font-size: 15px !important; letter-spacing: .08em; color: var(--text) !important; }
.shell input, .shell textarea, .shell select { font-size: 20px !important; color: var(--text) !important; background-color: rgba(255,251,246,.75) !important; }
.coordinator-card, .coordinator-card * { font-size: 17px !important; font-style: normal !important; line-height: 1.5 !important; }
.upload-status, .form-status, .quiet-centre, .document-meta, .patient-documents small { font-size: 17px !important; }
.role-link small, .patient-documents span, .patient-documents small { color: var(--text-soft) !important; }
.role-link span { color: var(--deep) !important; }
.fold > summary { font-size: 22px !important; color: var(--deep) !important; font-weight: 500; }

/* reader text */
.reading-paragraph, .bilingual-cell { color: var(--text) !important; font-weight: 500; line-height: 1.7 !important; }
.reading-paragraph:nth-child(even), .bilingual-row:nth-child(even) .bilingual-cell { background: rgba(232,214,196,.6) !important; }

@media (max-width: 640px) {
  .shell p, .shell li { font-size: 19px; }
  .band-light, .band-deep, #packageForm > .form-section, #patientView > .patient-section, #patientView > .patient-welcome { padding-top: 28px !important; padding-bottom: 28px !important; }
}
.reading-stage .reading-paragraph.reading-active, .bilingual-stage .bilingual-cell.reading-active { background: rgba(214,178,116,.45) !important; box-shadow: inset 3px 0 0 var(--gold) !important; }
/* bands: run edge to edge and sit flush under the menu */
#roleView .hero, #roleView .hero-content, .shell, .shell > .view { overflow: visible !important; }
.rail { margin-bottom: 0 !important; }
.shell { margin-top: 0 !important; }
#roleView { padding-top: 44px !important; }
#coordinatorView { padding-top: 28px !important; }
#coordinatorView > .section-heading { padding-bottom: 24px; }
.view.narrow { padding-top: 44px !important; }
#coordinatorView > .form-section { background: var(--band-deep) !important; box-shadow: 0 0 0 100vmax var(--band-deep) !important; }
.source-pill { font-size: 13px !important; color: #8a5f1f !important; }
/* demonstration: hidden parts of contact details cannot be selected or copied */
input.demo-hidden { -webkit-user-select: none; user-select: none; cursor: default; }
