/* TriaLing · approved Pingo visual system. Existing clinical selectors are retained. */
:root {
  --ink: #29213f;
  --paper: #fff9f1;
  --bg: var(--paper);
  --surface: #fff;
  --coral: #f15f62;
  --purple: #7152cf;
  --mint: #d9f4dc;
  --amber: #765019;
  --amber-accent: #ffc85c;
  --amber-bg: #fff0c9;
  --green: #2c603c;
  --green-bg: var(--mint);
  --brick: #a2383a;
  --brick-bg: #ffebe6;
  --ink-soft: #625b72;
  --teal: var(--purple);
  --teal-dark: #5736b0;
  --border: #e7dff0;
  --control-border: #92849f;
  --radius: 24px;
  --shadow: 0 5px 20px #29213f05;
  --nav-height: 84px;
  color-scheme: light;
  font-synthesis: none;
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  -webkit-font-smoothing: antialiased;
}
html {
  scroll-padding-top: 112px;
}
body {
  min-width: 320px;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
textarea,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
a {
  touch-action: manipulation;
}
button {
  cursor: pointer;
  border: 0;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  min-height: 44px;
  line-height: 1.4;
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    transform 0.18s ease;
}
button:not(:disabled):active {
  transform: scale(0.98);
}
button:disabled {
  cursor: not-allowed;
  opacity: 1;
  color: #655d70;
  background: #eee9f1;
  border-color: #d5cbdc;
}
button:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid var(--purple);
  outline-offset: 4px;
}
button svg,
a svg {
  pointer-events: none;
}
button svg {
  flex-shrink: 0;
}
a {
  color: var(--teal-dark);
  text-underline-offset: 4px;
  overflow-wrap: anywhere;
}
h1,
h2,
h3 {
  font-family: inherit;
  color: var(--ink);
  font-weight: 800;
  margin: 0 0 12px;
  letter-spacing: -0.035em;
  line-height: 1.25;
  overflow-wrap: anywhere;
}
h1 {
  font-size: clamp(1.75rem, 3.5vw, 2.7rem);
}
h2 {
  font-size: clamp(1.4rem, 2.5vw, 1.9rem);
}
h3 {
  font-size: 1.15rem;
  letter-spacing: -0.02em;
}
p {
  line-height: 1.65;
  margin: 0 0 16px;
  color: var(--ink-soft);
  overflow-wrap: anywhere;
}
ul,
ol {
  padding-left: 24px;
  line-height: 1.65;
}
#app {
  max-width: 1440px;
  margin: 0 auto;
  min-height: 100dvh;
  padding-bottom: 24px;
  background: var(--paper);
}
.screen {
  max-width: 1080px;
  margin: 0 auto;
  padding: 34px 32px 44px;
}
.screen > h2 {
  margin-bottom: 16px;
}
.card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card > h2,
.card > h3 {
  margin-bottom: 14px;
}
.card .card {
  box-shadow: none;
  border-radius: 18px;
}
.muted {
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.65;
}
.danger-text {
  color: var(--brick) !important;
}
.block {
  display: block;
}
.full {
  width: 100%;
  text-align: left;
  font-weight: 400;
}
.compact {
  width: auto;
  white-space: normal;
}
.small {
  font-size: 0.875rem;
  padding: 10px 14px;
  width: auto;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Persistent product shell. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  background: #fff9f1f5;
  backdrop-filter: blur(16px);
  border-bottom: 1px solid #e9e1d8;
  color: var(--ink);
}
.topbar .brand {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
}
.topbar .brand .mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--purple);
  color: #fff;
  flex-shrink: 0;
  font-weight: 850;
}
.topbar h1,
.topbar-title {
  font-size: 1rem;
  font-weight: 750;
  margin: 0;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.topbar .sub,
.topbar-sub {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin-top: 3px;
  line-height: 1.4;
}
.topbar nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 7px;
}
.topbar button.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  color: var(--ink-soft);
  padding: 10px 12px;
  font-size: 0.8rem;
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 44px;
}
.topbar button.icon-btn:hover,
.topbar button.icon-btn[aria-current="page"],
.topbar button.icon-btn.active {
  color: var(--teal-dark);
  background: #eae2fa;
}
.brand-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 1.6rem;
  font-weight: 850;
  letter-spacing: -0.065em;
  white-space: nowrap;
  line-height: 1;
}
.brand-wordmark-accent {
  color: var(--purple);
}
.brand-flower {
  width: 35px;
  height: 35px;
  color: var(--coral);
  flex-shrink: 0;
}
.brand-icon {
  display: inline-block;
  width: 22px;
  height: 22px;
  vertical-align: middle;
  flex-shrink: 0;
}
.motion-button,
[data-motion-toggle] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.8rem;
  padding: 10px;
  min-height: 44px;
}
[data-motion-toggle] .brand-icon {
  width: 18px;
  height: 18px;
}
[data-motion-toggle]:disabled {
  color: var(--ink-soft);
  background: transparent;
}
.connection:empty {
  display: none;
}
.connection {
  padding: 10px 18px;
  font-size: 0.875rem;
  line-height: 1.5;
  text-align: center;
  background: var(--green-bg);
  color: var(--green);
}
.connection.offline {
  background: var(--amber-bg);
  color: var(--amber);
}
.bottom-nav {
  display: none;
}
.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 620px;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 12px 18px max(12px, env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
  z-index: 25;
}
.page-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  margin-bottom: 26px;
}
.page-heading h2 {
  font-size: clamp(1.75rem, 3vw, 2.2rem);
  margin-bottom: 8px;
}
.page-heading p {
  margin-bottom: 0;
}
.eyebrow,
.page-eyebrow {
  color: var(--teal-dark);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 800;
  margin-bottom: 10px;
}

/* Expressive artwork stays outside clinical questions. */
.brand-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(200px, 1fr);
  align-items: center;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: 300px;
  padding: 34px;
  margin: 8px 0 28px;
  background: var(--coral);
  color: var(--ink);
  border-radius: 30px;
}
.brand-hero::before {
  content: "";
  position: absolute;
  z-index: -1;
  width: 310px;
  height: 310px;
  background: #ffb69e;
  border-radius: 50%;
  right: -90px;
  top: -100px;
}
.brand-hero-copy {
  position: relative;
  z-index: 1;
  min-width: 0;
}
.brand-hero h2 {
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  line-height: 1.1;
  font-weight: 850;
  letter-spacing: -0.045em;
  max-width: 430px;
  margin-bottom: 16px;
}
.brand-hero p {
  font-size: 1rem;
  color: var(--ink);
  max-width: 390px;
  margin-bottom: 0;
  line-height: 1.6;
}
.brand-hero-art {
  min-width: 0;
  width: 100%;
  max-width: 360px;
  align-self: center;
  justify-self: end;
  pointer-events: none;
}
.brand-hero-art > svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}
.brand-hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 24px;
}
.brand-hero-actions .btn-primary,
.brand-hero-actions .btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  width: auto;
  background: var(--paper);
  color: var(--ink);
  border-color: transparent;
  border-radius: 50px;
}
.brand-hero-actions .btn-primary:hover,
.brand-hero-actions .btn-secondary:hover {
  background: #fff;
}
.brand-hero--familia,
.brand-hero--agenda {
  background: var(--mint);
}
.brand-hero--familia::before,
.brand-hero--agenda::before {
  background: #b8e9c0;
}
.brand-hero--prontuario,
.brand-hero--documento {
  background: #e7dff9;
}
.brand-hero--prontuario::before,
.brand-hero--documento::before {
  background: #d5c5f7;
}
.brand-hero--sincronia {
  background: #ffe6a8;
}
.brand-hero--sincronia::before {
  background: #ffd77e;
}
.brand-hero--compact {
  min-height: 220px;
  padding: 26px 30px;
  grid-template-columns: minmax(0, 1.5fr) minmax(160px, 0.8fr);
}
.brand-hero--compact h2 {
  font-size: 1.75rem;
}
.brand-hero--compact .brand-hero-art {
  max-width: 230px;
}
.brand-hero--compact p {
  font-size: 0.95rem;
}
.paused .brand-hero *,
.paused .brand-flower {
  animation-play-state: paused !important;
}
body[data-quiet="true"] .brand-hero *,
body[data-quiet="assessment"] .brand-hero * {
  animation-play-state: paused !important;
}

/* Real form controls: 16px prevents iOS auto-zoom. */
label.field-label,
.field-label {
  display: block;
  font-weight: 750;
  font-size: 1rem;
  margin-bottom: 9px;
  color: var(--ink);
  line-height: 1.5;
}
input[type="text"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
input[type="time"],
input[type="password"],
input[type="email"],
input[type="search"],
input[type="tel"],
input[type="url"],
textarea,
select {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--control-border);
  border-radius: 13px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: #fffdfa;
  margin-bottom: 20px;
}
input::placeholder,
textarea::placeholder {
  color: #756b81;
  opacity: 1;
}
textarea {
  min-height: 112px;
  resize: vertical;
}
input:focus,
textarea:focus,
select:focus {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
  border-color: var(--purple);
}
input[type="checkbox"],
input[type="radio"] {
  width: 20px;
  height: 20px;
  accent-color: var(--purple);
  flex-shrink: 0;
}
input:disabled,
textarea:disabled,
select:disabled {
  color: var(--ink);
  -webkit-text-fill-color: var(--ink);
  opacity: 1;
  background: #f4f1f7;
  border-color: #c8bdcf;
  cursor: default;
}
input[aria-invalid="true"],
textarea[aria-invalid="true"],
select[aria-invalid="true"] {
  border-color: var(--brick);
}
fieldset {
  border: 1px solid var(--border);
  border-radius: 18px;
  margin: 0 0 22px;
  padding: 20px;
  min-width: 0;
}
legend {
  font-weight: 750;
  padding: 0 7px;
  max-width: 100%;
  line-height: 1.55;
  font-size: 1rem;
  overflow-wrap: anywhere;
}
.field-block {
  border: 0;
  padding: 0;
  margin: 12px 0 28px;
}
.field-block legend {
  padding: 0;
  margin-bottom: 12px;
  font-size: 1rem;
}
.checkbox-group,
.radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.chk-option,
.radio-option {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  min-height: 50px;
  border: 1px solid var(--control-border);
  border-radius: 14px;
  background: #fffdfa;
  font-size: 1rem;
  line-height: 1.55;
  min-width: 0;
  cursor: pointer;
}
.chk-option + .chk-option,
.radio-option + .radio-option {
  margin-top: 8px;
}
.checkbox-group .chk-option + .chk-option,
.radio-group .radio-option + .radio-option {
  margin-top: 0;
}
.chk-option input,
.radio-option input {
  margin: 2px 0 0;
  width: 20px;
  height: 20px;
  accent-color: var(--purple);
  flex-shrink: 0;
}
.chk-option > span,
.radio-option > span {
  min-width: 0;
  overflow-wrap: anywhere;
}
.chk-option:has(input:checked),
.radio-option:has(input:checked) {
  background: #f0eafb;
  border-color: var(--purple);
}
.chk-option:has(input:focus-visible),
.radio-option:has(input:focus-visible) {
  outline: 3px solid var(--purple);
  outline-offset: 3px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 22px;
}
.form-grid > * {
  min-width: 0;
}
.form-grid label {
  display: block;
  font-size: 1rem;
  font-weight: 750;
  line-height: 1.5;
}
.form-grid input:not([type="checkbox"]),
.form-grid select {
  margin-top: 8px;
}
.form-grid input[type="checkbox"] {
  display: block;
  margin: 14px 0;
}
.readonly-fields {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}
.read-only {
  opacity: 1;
}
.readonly-fields:disabled label,
.readonly-fields:disabled legend {
  color: var(--ink);
  opacity: 1;
}
.readonly-fields:disabled button,
.read-only button:disabled {
  opacity: 1;
}
input[type="file"] {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 14px 0 24px;
  font-size: 16px;
  min-height: 44px;
}
input[type="file"]::file-selector-button {
  padding: 11px 14px;
  margin-right: 10px;
  background: #eee7fa;
  border: 0;
  border-radius: 10px;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

/* Actions and administrative feedback. */
.btn-primary,
.btn-secondary,
.btn-ghost,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 48px;
  text-align: center;
  line-height: 1.5;
  text-decoration: none;
  font-size: 1rem;
  font-weight: 750;
  padding: 12px 18px;
  border-radius: 15px;
}
.btn-primary {
  background: var(--purple);
  color: #fff;
  border: 1px solid var(--purple);
  width: 100%;
}
.btn-primary:not(:disabled):hover {
  background: var(--teal-dark);
  border-color: var(--teal-dark);
}
.btn-secondary,
.button-link {
  background: #faf7ff;
  color: var(--teal-dark);
  border: 1px solid #ac95d9;
  width: 100%;
}
.btn-secondary:not(:disabled):hover,
.button-link:hover {
  background: #eee5fc;
}
.btn-ghost {
  color: var(--ink-soft);
  background: transparent;
  padding: 11px 14px;
}
.btn-ghost:not(:disabled):hover {
  background: #eee8f4;
}
.btn-primary.compact,
.btn-secondary.compact,
.button-link.compact,
.btn-primary.small,
.btn-secondary.small {
  width: auto;
}
.btn-row {
  display: flex;
  gap: 10px;
  margin-top: 14px;
  flex-wrap: wrap;
}
.btn-row > * {
  flex: 1 1 150px;
  min-width: 0;
}
.notice {
  border: 1px solid #d6c5f0;
  border-left: 4px solid var(--purple);
  border-radius: 16px;
  background: #f2ecfd;
  padding: 17px 18px;
  margin: 14px 0 22px;
  color: var(--ink);
  font-size: 0.95rem;
  line-height: 1.65;
  overflow-wrap: anywhere;
}
.notice button {
  margin: 8px 6px 0 0;
  padding: 10px 13px;
  background: #fff;
  border: 1px solid var(--control-border);
}
.badge {
  display: inline-block;
  padding: 5px 11px;
  border-radius: 50px;
  font-size: 0.8rem;
  font-weight: 750;
  letter-spacing: 0.01em;
  margin-left: 8px;
  background: #ece6f5;
  color: var(--ink-soft);
  line-height: 1.5;
  vertical-align: middle;
}
.badge.normal {
  color: var(--green);
  background: var(--green-bg);
}
.badge.duvidoso {
  color: var(--amber);
  background: var(--amber-bg);
}
.badge.alterado {
  color: var(--brick);
  background: var(--brick-bg);
}
.empty {
  padding: 32px 24px;
  text-align: center;
  border: 1px dashed #cbbadd;
  border-radius: 24px;
  background: #fffdf9;
}
.empty .brand-hero {
  margin: 0;
  text-align: left;
}
#toast {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: min(640px, 92vw);
  background: var(--ink);
  color: #fff;
  padding: 14px 20px;
  border-radius: 17px;
  font-size: 0.95rem;
  line-height: 1.5;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#toast.show {
  opacity: 1;
}
#toast.error {
  background: var(--brick);
}

/* Family lists, home and history. */
.patient-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 23px;
  background: var(--surface);
  margin-bottom: 13px;
  box-shadow: var(--shadow);
  text-align: left;
}
.patient-item:hover {
  border-color: #baa2e5;
  background: #fffdfb;
}
.patient-item > span {
  min-width: 0;
}
.patient-item .name,
.name {
  font-size: 1.1rem;
  line-height: 1.6;
  font-weight: 800;
  overflow-wrap: anywhere;
}
.patient-item .meta {
  font-size: 0.9rem;
  color: var(--ink-soft);
  line-height: 1.65;
}
.chevron {
  color: var(--purple);
  font-size: 1.7rem;
  flex-shrink: 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  margin-bottom: 20px;
}
.stat-card {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 22px 16px;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-card:nth-child(3n + 1) {
  background: #e9f8ea;
  border-color: #d3ead6;
}
.stat-card:nth-child(3n + 2) {
  background: #f0e9fc;
  border-color: #e2d8f3;
}
.stat-card:nth-child(3n + 3) {
  background: #fff0cd;
  border-color: #f2e3ba;
}
.stat-number,
.stat-card strong {
  font-family: inherit;
  font-size: 2rem;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.stat-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  line-height: 1.5;
  margin-top: 8px;
}
.stats-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}
.home-grid,
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}
.home-action,
.dashboard-action {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 146px;
  text-align: left;
  padding: 24px;
  border-radius: 24px;
  background: var(--mint);
  color: var(--ink);
  border: 0;
}
.home-action:nth-child(2),
.dashboard-action:nth-child(2) {
  background: #e7dff9;
}
.home-action:nth-child(3),
.dashboard-action:nth-child(3) {
  background: #ffe5a4;
}
.home-action:nth-child(4),
.dashboard-action:nth-child(4) {
  background: #ffdfd8;
}
.home-action strong,
.dashboard-action strong {
  font-size: 1.15rem;
}
.home-action small,
.dashboard-action small {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink-soft);
}
.home-action .brand-icon,
.dashboard-action .brand-icon {
  width: 30px;
  height: 30px;
}

/* Clinical workspace and chapter navigation. */
.workspace {
  display: grid;
  grid-template-columns: 275px minmax(0, 1fr);
  align-items: start;
  gap: 28px;
  padding: 28px 32px;
}
.section-nav {
  position: sticky;
  top: 112px;
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 14px;
  scrollbar-width: thin;
  scrollbar-color: #c8b6e0 transparent;
}
.section-link {
  display: block;
  width: 100%;
  text-align: left;
  padding: 13px;
  border-radius: 13px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.875rem;
  font-weight: 550;
  margin: 3px 0;
  line-height: 1.55;
  min-height: 46px;
}
.section-link:hover {
  background: #f4eefb;
  color: var(--ink);
}
.section-link.active,
.section-link[aria-current="page"] {
  background: var(--purple);
  color: #fff;
  font-weight: 750;
}
.assessment-content {
  min-width: 0;
  max-width: 1040px;
}
.assessment-content > div > h2 {
  font-size: 1.8rem;
  margin: 0 0 20px;
}
.assessment-content .card {
  padding: 26px;
}
.section-footer {
  display: flex;
  gap: 14px;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0;
}
.section-footer button {
  max-width: 260px;
}
.mobile-picker,
.chapter-toggle {
  display: none;
}
#chapter-dialog {
  width: min(680px, 94vw);
  max-height: 88dvh;
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 26px;
  overflow-y: auto;
  color: var(--ink);
  background: var(--paper);
  overscroll-behavior: contain;
}
#chapter-dialog::backdrop {
  background: #29213f80;
  backdrop-filter: blur(5px);
}
#chapter-dialog h2 {
  font-size: 1.6rem;
}
#chapter-dialog [data-close-chapters],
#chapter-dialog .chapter-close {
  float: right;
  padding: 10px 14px;
  background: #e7dff9;
  color: var(--ink);
}
.chapter-groups {
  display: grid;
  gap: 18px;
  clear: both;
}
.chapter-groups > section,
.chapter-group {
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 18px;
  background: #fff;
}
.chapter-groups h3 {
  font-size: 1rem;
  color: var(--teal-dark);
}
.chapter-list {
  display: grid;
  gap: 6px;
}
.chapter-list .section-link {
  border: 1px solid var(--border);
  margin: 0;
}
.progress-track {
  display: flex;
  gap: 5px;
  padding: 0 18px 10px;
  background: var(--paper);
}
.progress-seg {
  flex: 1;
  height: 5px;
  border-radius: 5px;
  background: #ded5e8;
}
.progress-seg.done {
  background: var(--purple);
}
.step-label {
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin-bottom: 7px;
}

/* Clinical results and reference options preserve score semantics. */
.score-panel {
  text-align: center;
  padding: 22px;
  border-radius: 20px;
  border: 1px solid var(--border);
  margin-bottom: 18px;
  background: #faf7ff;
}
.score-panel .score-number {
  font-family: inherit;
  font-size: 2.5rem;
  font-weight: 850;
  letter-spacing: -0.045em;
}
.score-panel.normal {
  background: var(--green-bg);
}
.score-panel.duvidoso {
  background: var(--amber-bg);
}
.score-panel.alterado {
  background: var(--brick-bg);
}
.summary-scores {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 26px;
}
.summary-scores h3 {
  font-size: 1rem;
}
.summary-scores .score-panel {
  padding: 18px;
}
.summary-scores .score-number {
  font-size: 2rem;
}
.instrument-subtotals {
  font-size: 0.95rem;
  margin-top: 14px;
  line-height: 1.6;
}
.img-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.img-option {
  border: 1px solid var(--control-border);
  border-radius: 18px;
  padding: 14px;
  cursor: pointer;
  background: #fffdfa;
  min-width: 0;
}
.img-option.selected {
  border: 2px solid var(--purple);
  padding: 13px;
  background: #f0eafb;
}
.img-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  border-radius: 12px;
  background: repeating-linear-gradient(
    45deg,
    #f0eaf7,
    #f0eaf7 8px,
    #e6deef 8px,
    #e6deef 16px
  );
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  font-size: 0.875rem;
  text-align: center;
  padding: 10px;
  margin-bottom: 10px;
}
.img-option .opt-label {
  font-size: 1rem;
  font-weight: 750;
}
.img-option .opt-points {
  font-size: 0.875rem;
  color: var(--ink-soft);
}

/* Consent and signatures. */
.consent-block {
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  margin-bottom: 18px;
}
.consent-block h3 {
  margin-bottom: 12px;
}
.consent-row {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.consent-pill {
  flex: 1;
  min-width: 120px;
  min-height: 48px;
  text-align: center;
  padding: 12px 10px;
  border: 1px solid var(--control-border);
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--ink-soft);
  background: #fffdfa;
}
.consent-pill.active {
  border-color: var(--purple);
  color: var(--teal-dark);
  background: #f0eafb;
}
.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.permission-grid legend {
  font-family: inherit;
}
canvas,
canvas#signature-pad {
  touch-action: none;
  display: block;
  width: 100%;
  height: 150px;
  border: 1px dashed var(--control-border);
  border-radius: 14px;
  background: white;
  margin: 12px 0;
}
.term-content {
  margin: 16px 0 24px;
}
.term-content pre,
pre.term-content {
  white-space: pre-wrap;
  font: inherit;
  font-size: 0.95rem;
  line-height: 1.75;
  max-height: 460px;
  overflow: auto;
  padding: 20px;
  background: var(--bg);
  border-radius: 14px;
}
summary {
  cursor: pointer;
  font-weight: 750;
  padding: 15px 0;
  font-size: 1rem;
  line-height: 1.6;
}
.consent-history,
.document-item {
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
}
.consent-history:last-child,
.document-item:last-child {
  border: 0;
}

/* Photographs and documents. */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.photo-thumb {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  aspect-ratio: 1;
}
.photo-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.photo-card {
  margin: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
  min-width: 0;
}
.photo-card img {
  display: block;
  width: 100%;
  height: 190px;
  object-fit: cover;
}
.photo-card figcaption {
  padding: 14px;
  font-size: 0.9rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.upload-locked {
  border: 1px dashed var(--brick);
  background: var(--brick-bg);
  color: var(--brick);
  padding: 16px;
  border-radius: 14px;
  font-size: 0.95rem;
}
.doc-preview {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px;
  font-size: 1rem;
  line-height: 1.75;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.doc-group-title {
  font-weight: 800;
  margin-top: 20px;
  margin-bottom: 10px;
  font-size: 1rem;
}
.document-editor {
  min-height: 390px;
  font-size: 1rem;
  line-height: 1.7;
}
.document-item .btn-row {
  flex-wrap: wrap;
}
.document-item .btn-row > * {
  min-width: min(100%, 150px);
}
.document-item > .btn-secondary {
  margin-top: 12px;
}

/* Growth, maps, tables and voice controls. */
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9rem;
  margin: 20px 0;
  line-height: 1.6;
}
th,
td {
  border-bottom: 1px solid var(--border);
  padding: 13px;
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}
th {
  background: #f4effa;
  font-weight: 750;
  color: var(--ink);
}
.growth-module,
.milestones-module {
  margin: 28px 0;
  min-width: 0;
}
.growth-module > h3,
.milestones-module > h3 {
  margin-bottom: 18px;
}
.growth-module button,
.milestones-module button,
.body-map button {
  padding: 12px 15px;
  background: #eee7fa;
  color: var(--ink);
}
.growth-module .btn-primary {
  background: var(--purple);
  color: #fff;
}
.growth-chart-scroll {
  overflow-x: auto;
  overscroll-behavior-x: contain;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 16px;
  margin: 18px 0;
  background: #fff;
}
.growth-chart-scroll svg {
  display: block;
  min-width: 560px;
}
.body-map {
  min-width: 0;
}
.body-map svg {
  max-width: 100%;
  height: auto;
}
.tooth-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.tooth-row button {
  border: 1px solid var(--control-border);
  padding: 12px;
  min-width: 44px;
  background: #faf7ff;
  color: var(--ink);
}
.tooth-row button[aria-pressed="true"] {
  background: var(--purple);
  color: #fff;
}
.mic-field-wrap {
  position: relative;
}
.mic-field-wrap input,
.mic-field-wrap textarea {
  padding-right: 58px;
}
.mic-btn {
  position: absolute;
  top: 3px;
  right: 4px;
  width: 44px;
  height: 44px;
  min-height: 44px;
  border-radius: 50%;
  background: #eee7fa;
  border: 0;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.mic-btn.listening {
  background: var(--purple);
  color: #fff;
  animation: mic-pulse 1s infinite;
}
@keyframes mic-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 #7152cf44;
  }
  70% {
    box-shadow: 0 0 0 9px #7152cf00;
  }
}
.voice-button {
  display: block;
  font-size: 0.875rem;
  color: var(--teal-dark);
  background: #eee7fa;
  padding: 10px 14px;
  min-height: 44px;
  margin: -8px 0 22px auto;
}
.slider-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.slider-wrap input[type="range"] {
  flex: 1;
  min-width: 0;
  accent-color: var(--purple);
  height: 44px;
}
.slider-value {
  min-width: 52px;
  text-align: center;
  font-weight: 800;
  font-family: inherit;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px;
  font-size: 1rem;
}

/* Authentication. */
.login-wrap {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background:
    radial-gradient(ellipse at 15% 15%, #f8dfdb, transparent 45%),
    radial-gradient(ellipse at 85% 80%, #e8def9, transparent 45%), var(--paper);
}
.login-card {
  width: 100%;
  max-width: 520px;
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 30px;
  background: #fffdf9;
  box-shadow: 0 14px 70px #29213f08;
}
.login-card > .brand-wordmark {
  margin-bottom: 24px;
}
.login-card > h1 {
  margin-bottom: 12px;
}
.login-card .brand-hero {
  margin: 18px 0 26px;
}
.login-mark {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  background: var(--purple);
  display: grid;
  place-items: center;
  color: #fff;
  font-family: inherit;
  font-weight: 850;
  font-size: 1.2rem;
  margin-bottom: 22px;
}
.login-note {
  margin-top: 24px;
}
.tab-row {
  display: flex;
  gap: 5px;
  margin-bottom: 26px;
  background: #eee8f5;
  padding: 5px;
  border-radius: 16px;
}
.tab-btn {
  flex: 1;
  padding: 12px;
  background: transparent;
  border-radius: 12px;
  color: var(--ink-soft);
  font-size: 1rem;
  min-height: 46px;
}
.tab-btn.active {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 6px #29213f0d;
}

@media (min-width: 1000px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .login-wrap:has(.brand-hero) .login-card {
    max-width: 920px;
  }
  .login-card:has(.brand-hero) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 0 32px;
    align-items: start;
  }
  .login-card:has(.brand-hero) > .brand-wordmark {
    grid-column: 1/-1;
  }
  .login-card:has(.brand-hero) > .brand-hero {
    grid-column: 1;
    grid-row: 2/6;
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }
  .login-card:has(.brand-hero) > form,
  .login-card:has(.brand-hero) > .tab-row {
    grid-column: 2;
  }
  .login-card:has(.brand-hero) > .brand-hero .brand-hero-art {
    margin-top: auto;
  }
}
@media (min-width: 640px) {
  .img-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 1000px) and (min-width: 761px) {
  .topbar {
    gap: 14px;
    padding: 16px 22px;
  }
  .topbar .brand {
    gap: 12px;
  }
  .topbar nav {
    gap: 3px;
  }
  .topbar button.icon-btn {
    padding: 9px 7px;
    font-size: 0.75rem;
  }
  .topbar button.icon-btn .brand-icon {
    width: 19px;
    height: 19px;
  }
  .workspace {
    grid-template-columns: 230px minmax(0, 1fr);
    gap: 20px;
    padding: 24px 20px;
  }
  .section-link {
    font-size: 0.825rem;
  }
  .brand-wordmark {
    font-size: 1.4rem;
  }
}
@media (max-width: 760px) {
  html {
    scroll-padding-top: 100px;
  }
  #app {
    padding-bottom: calc(var(--nav-height) + env(safe-area-inset-bottom));
  }
  #app[data-view="login"],
  #app[data-view="auth"] {
    padding-bottom: 0;
  }
  .topbar {
    padding: 15px 20px 12px;
    gap: 12px;
    align-items: center;
    border-radius: 0;
  }
  .topbar .brand {
    min-width: 0;
    gap: 10px;
    flex: 1;
  }
  .topbar .brand-wordmark {
    font-size: 1.45rem;
  }
  .topbar .brand-flower {
    width: 29px;
    height: 29px;
  }
  .topbar .brand > div:has(.topbar-title),
  .topbar .brand > div:has(h1) {
    min-width: 0;
  }
  .topbar-title,
  .topbar h1 {
    font-size: 0.9rem;
    line-height: 1.35;
  }
  .topbar .sub,
  .topbar-sub {
    font-size: 0.75rem;
    max-width: 180px;
    overflow-wrap: anywhere;
  }
  .topbar nav {
    gap: 2px;
    flex-wrap: nowrap;
  }
  .topbar nav button[data-route],
  .topbar nav [data-home],
  .topbar nav [data-agenda] {
    display: none;
  }
  .topbar nav button.icon-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
    border: 0;
  }
  .topbar nav button.icon-btn .nav-label,
  .topbar nav button.icon-btn > span {
    display: none;
  }
  .topbar nav [data-profile],
  .topbar nav [data-logout] {
    font-size: 0.7rem;
  }
  .topbar nav .motion-button span,
  .topbar [data-motion-toggle] span {
    display: none;
  }
  .topbar [data-motion-toggle] {
    min-width: 44px;
    padding: 10px;
  }
  .bottom-nav {
    display: flex;
    justify-content: space-around;
    align-items: stretch;
    gap: 2px;
    position: fixed;
    z-index: 40;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: var(--nav-height);
    padding: 9px 8px max(12px, env(safe-area-inset-bottom));
    border-top: 1px solid #e5dcd2;
    background: #fff9f1f7;
    backdrop-filter: blur(16px);
    box-shadow: 0 -8px 22px #29213f04;
  }
  .bottom-nav button {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    gap: 5px;
    flex: 1;
    min-width: 0;
    min-height: 56px;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 6px 2px;
    border-radius: 13px;
    color: #746a80;
    background: transparent;
    line-height: 1.3;
  }
  .bottom-nav .brand-icon,
  .bottom-nav svg {
    width: 23px;
    height: 23px;
  }
  .bottom-nav button.active,
  .bottom-nav button[aria-current="page"] {
    color: var(--teal-dark);
    background: #eee6fb;
  }
  .bottom-nav button.active::before,
  .bottom-nav button[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: -10px;
    width: 24px;
    height: 3px;
    background: var(--purple);
    border-radius: 0 0 4px 4px;
  }
  .screen {
    padding: 26px 20px 32px;
  }
  .card {
    padding: 21px;
    border-radius: 23px;
    margin-bottom: 18px;
  }
  .page-heading {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    align-items: center;
    margin-bottom: 22px;
  }
  .page-heading > div {
    flex: 1 1 200px;
    min-width: 0;
  }
  .page-heading h2 {
    font-size: 1.9rem;
    line-height: 1.15;
  }
  .page-heading .compact {
    margin: 0;
  }
  .page-heading p {
    font-size: 0.95rem;
  }
  .brand-hero {
    min-height: 310px;
    padding: 25px;
    display: block;
    margin: 8px 0 25px;
    border-radius: 28px;
  }
  .brand-hero-copy {
    max-width: 65%;
  }
  .brand-hero h2 {
    font-size: 1.8rem;
    line-height: 1.1;
  }
  .brand-hero p {
    font-size: 0.9rem;
    line-height: 1.55;
  }
  .brand-hero-art {
    position: absolute;
    width: 218px;
    max-width: 60%;
    right: -10px;
    bottom: -4px;
    z-index: 0;
  }
  .brand-hero-actions {
    margin-top: 20px;
  }
  .brand-hero-actions .btn-primary,
  .brand-hero-actions .btn-secondary {
    font-size: 0.875rem;
    padding: 11px 15px;
    min-height: 46px;
  }
  .brand-hero--compact {
    min-height: 240px;
    padding: 24px;
  }
  .brand-hero--compact h2 {
    font-size: 1.55rem;
  }
  .brand-hero--compact .brand-hero-copy {
    max-width: 63%;
  }
  .brand-hero--compact .brand-hero-art {
    width: 180px;
    right: -8px;
  }
  .brand-hero--compact p {
    font-size: 0.875rem;
  }
  .stats-grid {
    gap: 10px;
  }
  .stat-card {
    padding: 18px 12px;
    border-radius: 19px;
  }
  .stat-number,
  .stat-card strong {
    font-size: 1.8rem;
  }
  .stat-label {
    font-size: 0.8rem;
  }
  .home-grid,
  .dashboard-grid {
    gap: 11px;
  }
  .home-action,
  .dashboard-action {
    min-height: 156px;
    padding: 19px;
    border-radius: 23px;
  }
  .home-action strong,
  .dashboard-action strong {
    font-size: 1rem;
  }
  .home-action small,
  .dashboard-action small {
    font-size: 0.825rem;
  }
  .patient-item {
    padding: 19px;
    border-radius: 22px;
  }
  .patient-item .name {
    font-size: 1.1rem;
  }
  .patient-item .meta {
    font-size: 0.875rem;
  }
  .workspace {
    display: block;
    padding: 16px 16px 24px;
  }
  .section-nav {
    position: static;
    max-height: none;
    z-index: auto;
    margin-bottom: 20px;
    padding: 16px;
    border-radius: 21px;
    box-shadow: none;
    overflow: visible;
  }
  .section-nav nav {
    display: none;
  }
  .mobile-picker {
    display: block;
    margin: 0;
    padding: 12px;
    font-size: 16px;
    min-height: 48px;
    border-radius: 12px;
  }
  .chapter-toggle {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 12px;
    margin-top: 10px;
    min-height: 46px;
    background: #eee7fa;
    color: var(--teal-dark);
    font-size: 0.9rem;
    border-radius: 12px;
  }
  .assessment-content .card {
    padding: 21px;
  }
  .assessment-content > div > h2 {
    font-size: 1.6rem;
  }
  .form-grid,
  .permission-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 4px;
  }
  .summary-scores {
    gap: 12px;
  }
  .summary-scores .score-panel {
    padding: 15px 8px;
  }
  .score-panel .score-number {
    font-size: 1.9rem;
  }
  .summary-scores .score-number {
    font-size: 1.8rem;
  }
  .photo-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }
  .photo-card img {
    height: 150px;
  }
  .img-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .section-footer {
    gap: 10px;
  }
  .section-footer button {
    font-size: 0.95rem;
    padding: 12px 14px;
    flex: 1;
    max-width: none;
  }
  #chapter-dialog {
    border-radius: 24px 24px 0 0;
    width: 100%;
    max-width: 100%;
    max-height: 90dvh;
    margin: auto 0 0;
    padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
    border-bottom: 0;
  }
  #toast {
    bottom: calc(var(--nav-height) + env(safe-area-inset-bottom) + 12px);
    font-size: 0.9rem;
  }
  .login-wrap {
    padding: 20px;
    align-items: flex-start;
  }
  .login-card {
    padding: 24px 0;
    background: transparent;
    box-shadow: none;
    border: 0;
    border-radius: 0;
  }
  .login-card .brand-hero {
    min-height: 260px;
  }
  .login-card .brand-hero-copy {
    max-width: 64%;
  }
  .login-card .brand-hero h2 {
    font-size: 1.65rem;
  }
  .login-card .brand-hero-art {
    width: 185px;
  }
  table {
    font-size: 0.875rem;
  }
  th,
  td {
    padding: 10px;
  }
}
@media (max-width: 374px) {
  .screen {
    padding-left: 16px;
    padding-right: 16px;
  }
  .topbar {
    padding-left: 16px;
    padding-right: 12px;
  }
  .topbar .brand-wordmark {
    font-size: 1.3rem;
  }
  .topbar .brand-flower {
    width: 26px;
    height: 26px;
  }
  .topbar .brand {
    gap: 7px;
  }
  .brand-hero {
    padding: 22px;
    min-height: 320px;
  }
  .brand-hero-copy {
    max-width: 68%;
  }
  .brand-hero h2 {
    font-size: 1.65rem;
  }
  .brand-hero-art {
    width: 190px;
    right: -14px;
    max-width: 58%;
  }
  .brand-hero--compact {
    min-height: 260px;
  }
  .brand-hero--compact h2 {
    font-size: 1.5rem;
  }
  .brand-hero--compact .brand-hero-art {
    width: 155px;
  }
  .card,
  .assessment-content .card {
    padding: 18px;
  }
  .badge {
    margin-left: 4px;
  }
  .bottom-nav button {
    font-size: 0.65rem;
  }
}
/* Shell markup aliases and composed module cards. */
.wordmark-button {
  display: inline-flex;
  align-items: center;
  background: transparent;
  border: 0;
  padding: 0;
  min-height: 44px;
  width: auto;
  border-radius: 10px;
  flex-shrink: 0;
}
.app-context {
  min-width: 0;
  padding-left: 16px;
  border-left: 1px solid var(--border);
}
.home-greeting {
  margin: 0 0 24px;
}
.home-greeting h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
  margin-bottom: 9px;
}
.home-greeting p {
  margin-bottom: 0;
}
.home-greeting .eyebrow {
  margin-bottom: 10px;
}
.home-modules {
  margin: 30px 0 36px;
}
.home-modules .page-heading {
  margin-bottom: 16px;
}
.home-modules .page-heading h2 {
  font-size: 1.4rem;
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
}
.module-card {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  border-radius: 24px;
  text-align: left;
  min-width: 0;
}
.module-card .brand-hero {
  margin: 0;
  padding: 22px;
  min-height: 240px;
  display: block;
  border-radius: 24px;
  box-shadow: none;
  height: 100%;
}
.module-card .brand-hero-copy {
  max-width: 100%;
  padding-bottom: 112px;
}
.module-card .brand-hero h2 {
  font-size: 1.2rem;
  margin-bottom: 8px;
  letter-spacing: -0.025em;
}
.module-card .brand-hero p {
  font-size: 0.875rem;
  line-height: 1.5;
}
.module-card .brand-hero-art {
  position: absolute;
  right: -5px;
  bottom: -5px;
  width: 145px;
  max-width: 90%;
}
.module-card--familia .brand-hero {
  background: #ffdfd8;
}
.module-card--familia .brand-hero::before {
  background: #ffd1c6;
}
.module-card--agenda .brand-hero {
  background: var(--mint);
}
.module-card--prontuario .brand-hero {
  background: #ffe5a4;
}
.module-card--prontuario .brand-hero::before {
  background: #ffdc8d;
}
.document-heading {
  display: flex;
  gap: 15px;
  align-items: flex-start;
}
.document-heading > .brand-icon {
  color: var(--purple);
  width: 32px;
  height: 36px;
}
.document-heading h3 {
  margin-bottom: 5px;
}
.document-heading p {
  margin-bottom: 12px;
}
.visit-list {
  margin: 20px 0;
}
.account-exit {
  margin-top: 28px;
}
.account-exit button {
  color: var(--brick);
  border-color: #d5a8aa;
}
.login-welcome {
  flex: 1 1 420px;
  max-width: 560px;
}
.login-welcome .brand-hero {
  min-height: 560px;
  margin: 0;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: space-between;
}
.login-welcome .brand-hero h2 {
  font-size: clamp(2.5rem, 4vw, 3.7rem);
}
.login-welcome .brand-hero p {
  font-size: 1.1rem;
  max-width: 350px;
}
.login-welcome .brand-hero-art {
  max-width: 360px;
  align-self: center;
  margin-top: 22px;
}
.login-wrap {
  gap: clamp(28px, 5vw, 72px);
}
.login-card {
  flex: 1 1 440px;
}
.login-brand {
  margin-bottom: 22px;
}
.login-card .login-brand .brand-wordmark {
  font-size: 1.9rem;
}
@media (max-width: 1100px) and (min-width: 761px) {
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .login-wrap {
    padding: 24px;
    gap: 24px;
  }
  .login-welcome .brand-hero {
    padding: 28px;
    min-height: 520px;
  }
}
@media (max-width: 760px) {
  .topbar nav .desktop-nav {
    display: none !important;
  }
  .topbar .app-context {
    display: none;
  }
  body[data-quiet="true"] .topbar .app-context,
  body[data-quiet="assessment"] .topbar .app-context {
    display: block;
    padding-left: 0;
    border: 0;
  }
  body[data-quiet="true"] .topbar .brand-wordmark > span,
  body[data-quiet="assessment"] .topbar .brand-wordmark > span {
    display: none;
  }
  .home-greeting {
    margin-bottom: 22px;
  }
  .home-greeting h2 {
    font-size: 2rem;
  }
  .home-modules {
    margin: 25px 0 32px;
  }
  .home-modules .page-heading {
    flex-wrap: nowrap;
    gap: 8px;
  }
  .home-modules .page-heading h2 {
    font-size: 1.1rem;
    margin: 0;
  }
  .home-modules .eyebrow {
    font-size: 0.65rem;
    margin: 0;
  }
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
  }
  .module-card .brand-hero {
    min-height: 220px;
    padding: 18px;
  }
  .module-card .brand-hero-copy {
    max-width: 100%;
    padding-bottom: 100px;
  }
  .module-card .brand-hero h2 {
    font-size: 1.05rem;
  }
  .module-card .brand-hero p {
    font-size: 0.875rem;
  }
  .module-card .brand-hero-art {
    width: 120px;
    max-width: 90%;
    right: -5px;
    bottom: -5px;
  }
  .brand-hero-copy {
    max-width: 100%;
    padding-bottom: 145px;
  }
  .brand-hero-copy > h2 {
    max-width: 95%;
  }
  .brand-hero p {
    max-width: 95%;
  }
  .brand-hero-art {
    width: 195px;
    max-width: 58%;
  }
  .brand-hero-actions {
    position: absolute;
    bottom: 4px;
    left: 0;
    z-index: 2;
    max-width: 80%;
  }
  .brand-hero--compact .brand-hero-copy {
    max-width: 100%;
    padding-bottom: 110px;
  }
  .brand-hero--compact .brand-hero-art {
    width: 160px;
  }
  .login-wrap {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: 24px;
    padding: 20px;
  }
  .login-welcome {
    flex: none;
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
  }
  .login-welcome .brand-hero {
    padding: 24px;
    min-height: 300px;
    display: block;
  }
  .login-welcome .brand-hero h2 {
    font-size: 2.05rem;
    max-width: 100%;
  }
  .login-welcome .brand-hero p {
    font-size: 1rem;
    max-width: 100%;
  }
  .login-welcome .brand-hero-art {
    width: 195px;
    max-width: 58%;
    position: absolute;
    margin: 0;
    right: -5px;
    bottom: -6px;
  }
  .login-card {
    flex: none;
    padding: 8px 0 24px;
    margin: 0 auto;
  }
  .login-card > h1 {
    font-size: 1.7rem;
  }
  .document-heading > .brand-icon {
    width: 27px;
    height: 30px;
  }
  .document-heading h3 {
    font-size: 1.1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
@media print {
  :root {
    --bg: #fff;
  }
  .topbar,
  .bottom-nav,
  .bottom-bar,
  .section-nav,
  .section-footer,
  #toast,
  .voice-button,
  .motion-button,
  [data-motion-toggle],
  #chapter-dialog {
    display: none !important;
  }
  .workspace {
    display: block;
    padding: 0;
  }
  .screen {
    max-width: none;
    padding: 0;
  }
  .card {
    box-shadow: none;
    break-inside: avoid;
    border-radius: 0;
  }
  #app {
    max-width: none;
    padding: 0;
  }
  .brand-hero {
    min-height: 0;
    break-inside: avoid;
  }
  .brand-hero-art {
    max-width: 130px;
    position: static;
  }
  .brand-hero * {
    animation: none !important;
  }
}
/* User-entered names and clinical notes never impose a page-wide minimum width. */
.card,
.patient-item,
.visit-list,
.document-item,
.assessment-content {
  overflow-wrap: anywhere;
}
.patient-item strong,
.card strong,
.card .name {
  min-width: 0;
  overflow-wrap: anywhere;
}
.brand-hero p,
.module-card .brand-hero p {
  font-weight: 500;
}
@media (max-width: 760px) {
  #app[data-view="assessment"] .topbar .app-context,
  #app[data-view="evolution"] .topbar .app-context {
    display: block;
    padding-left: 0;
    border: 0;
  }
  #app[data-view="assessment"] .topbar .brand-wordmark > span,
  #app[data-view="evolution"] .topbar .brand-wordmark > span {
    display: none;
  }
}

/* Consultation launchpad: a compact overview before the 35 complete clinical sections. */
.consultation-progress {
  display: grid;
  gap: 12px;
  margin: 20px 0 24px;
  padding: 18px;
  border-radius: 17px;
  background: #f0eafb;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
}
.consultation-progress progress {
  display: block;
  appearance: none;
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 7px;
  accent-color: var(--purple);
  background: #dfd3f0;
}
.consultation-progress progress::-webkit-progress-bar {
  background: #dfd3f0;
  border-radius: 7px;
}
.consultation-progress progress::-webkit-progress-value {
  background: var(--purple);
  border-radius: 7px;
}
.consultation-progress progress::-moz-progress-bar {
  background: var(--purple);
  border-radius: 7px;
}
.consultation-domains {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
  margin: 20px 0 28px;
}
.domain-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  min-height: 190px;
  padding: 23px;
  border-radius: 23px;
  text-align: left;
  color: var(--ink);
  background: var(--mint);
  overflow-wrap: anywhere;
}
.domain-card:nth-child(2) {
  background: #ffddd5;
}
.domain-card:nth-child(3) {
  background: #e8dff8;
}
.domain-card:nth-child(4) {
  background: #ffe9b4;
}
.domain-card > .brand-icon:first-child {
  width: 31px;
  height: 31px;
  margin-bottom: 6px;
}
.domain-card > .brand-icon:last-child {
  position: absolute;
  right: 16px;
  bottom: 16px;
  width: 18px;
  height: 18px;
}
.domain-card strong {
  font-size: 1.15rem;
  line-height: 1.35;
  letter-spacing: -0.025em;
}
.domain-card > span {
  font-size: 0.875rem;
  line-height: 1.5;
  color: #585064;
  font-weight: 500;
  max-width: calc(100% - 12px);
}
.scope-details {
  border-top: 1px solid var(--border);
  margin-top: 14px;
}
.scope-details > summary {
  padding: 18px 0;
  color: var(--teal-dark);
}
.scope-details[open] > summary {
  margin-bottom: 7px;
}
.dialog-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.dialog-heading h2 {
  margin: 0;
}
.dialog-heading > .icon-btn {
  float: none !important;
  min-width: 44px;
  width: 44px;
  min-height: 44px;
  padding: 8px;
  flex-shrink: 0;
  font-size: 1.5rem;
  line-height: 1;
}
.chapter-groups > details {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 19px;
  padding: 18px;
}
.chapter-groups > details > summary {
  padding: 0;
  font-size: 1rem;
  color: var(--ink);
}
.chapter-groups > details > summary > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 24px;
  height: 24px;
  border-radius: 50px;
  margin-left: 5px;
  background: #eee7fa;
  color: var(--teal-dark);
  font-size: 0.75rem;
  padding: 0 7px;
}
.chapter-groups > details[open] > summary {
  margin-bottom: 16px;
}
.chapter-list .section-link {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  font-size: 0.9rem;
  padding: 13px;
}
.chapter-list .section-link > span:first-child {
  min-width: 0;
  overflow-wrap: anywhere;
}
.chapter-list .section-link > span:last-child {
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 90px;
  padding: 5px 7px;
  border-radius: 8px;
  background: #eee7fa;
  color: var(--teal-dark);
  font-size: 0.7rem;
  line-height: 1.4;
  text-align: center;
}
.chapter-list .section-link.active > span:last-child {
  background: #ffffff25;
  color: #fff;
}
.chapter-list .section-link > span:last-child .brand-icon {
  width: 18px;
  height: 18px;
}
@media (max-width: 760px) {
  .consultation-domains {
    gap: 11px;
  }
  .domain-card {
    padding: 18px;
    min-height: 205px;
    border-radius: 22px;
    gap: 8px;
  }
  .domain-card strong {
    font-size: 1rem;
  }
  .domain-card > span {
    font-size: 0.8rem;
  }
  .domain-card > .brand-icon:first-child {
    width: 28px;
    height: 28px;
  }
  .consultation-progress {
    padding: 15px;
    font-size: 0.875rem;
  }
  .chapter-groups {
    gap: 12px;
  }
  .chapter-groups > details {
    padding: 15px;
  }
  .chapter-list .section-link {
    gap: 9px;
    padding: 12px;
    font-size: 0.875rem;
  }
  .chapter-list .section-link > span:last-child {
    max-width: 75px;
  }
}

/* Issued PDF and editable message composer. */
.native-share-panel {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--paper);
  display: grid;
  gap: 12px;
  min-width: 0;
}
.native-share-panel h4,
.native-share-panel p,
.native-share-panel .field-label {
  margin: 0;
}
.native-share-panel textarea {
  min-height: 160px;
  resize: vertical;
  white-space: pre-wrap;
}
.native-share-panel .btn-row {
  margin: 0;
}
.copy-status:empty {
  display: none;
}

/* Bilateral evaluation stays aligned on mobile without horizontal overflow. */
.bilateral-grid { display:grid; grid-template-columns:minmax(64px,.8fr) minmax(0,1fr) minmax(0,1fr); gap:10px; align-items:start; margin:16px 0; }
.bilateral-grid > * { min-width:0; }
.bilateral-head { font-weight:700; color:#54416f; padding:8px 0; border-bottom:2px solid #dfd4e9; }
.bilateral-label { padding-top:16px; font-weight:600; overflow-wrap:anywhere; }
.bilateral-grid input:not([type=radio]):not([type=checkbox]), .bilateral-grid textarea { width:100%; min-width:0; box-sizing:border-box; }
.bilateral-grid .radio-group,.bilateral-grid .checkbox-group { display:grid; grid-template-columns:1fr; }
.bilateral-grid .field-label { font-size:.76rem; }
.bilateral-grid .radio-option,.bilateral-grid .chk-option { padding:8px; overflow-wrap:anywhere; }
.range-field output { display:block; font-weight:700; color:#7253a1; }
.range-field input[type=range] { accent-color:#7253a1; width:100%; min-height:44px; }
.range-ends { display:flex; justify-content:space-between; gap:4px; }
.instrument-reference { border-left:3px solid #b8a4cf; padding:8px 12px; font-size:.85rem; overflow-wrap:anywhere; }
.instrument-reference p { margin:4px 0; }

.bilateral-grid .field-label { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); white-space:nowrap; border:0; }

/* Colo360: only the supplied brand image, preserving the application palette. */
.brand-logo { display:block; width:192px; height:auto; object-fit:contain; }
@media(max-width:760px) { .topbar .brand-logo { width:120px; } }
