:root {
  color-scheme: light;
  --bg: #f4f7f5;
  --bg-warm: #fbf8f1;
  --surface: #ffffff;
  --surface-muted: #edf5f1;
  --surface-blue: #edf4fb;
  --text: #17231f;
  --muted: #62726d;
  --line: #dbe5df;
  --brand: #14776f;
  --brand-strong: #0b5e59;
  --brand-soft: #dff3ef;
  --blue: #2f67a8;
  --blue-soft: #e5effb;
  --green: #267a4d;
  --green-soft: #e5f5ea;
  --amber: #9f6216;
  --amber-soft: #fff1d7;
  --orange: #bb541c;
  --orange-soft: #ffe8dc;
  --red: #b42335;
  --red-soft: #ffe3e8;
  --purple: #6a5aa8;
  --purple-soft: #eeeafb;
  --shadow: 0 16px 36px rgba(21, 38, 34, 0.1);
  --soft-shadow: 0 8px 18px rgba(21, 38, 34, 0.06);
  --radius: 8px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  max-width: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background:
    linear-gradient(180deg, rgba(223, 243, 239, 0.55), rgba(244, 247, 245, 0) 260px),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button {
  cursor: pointer;
}

img,
svg,
canvas,
table {
  max-width: 100%;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(47, 103, 168, 0.28);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  background: rgba(255, 255, 255, 0.92);
  border-right: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #2d8f68);
  color: #ffffff;
  font-weight: 900;
}

.brand strong,
.brand small {
  display: block;
  line-height: 1.05;
}

.brand small {
  margin-top: 4px;
  color: var(--brand);
  font-weight: 800;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item,
.primary-action,
.secondary-action,
.text-button,
.icon-button,
.segment {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  text-align: left;
}

.nav-item span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(20, 119, 111, 0.1);
  color: var(--brand-strong);
  font-weight: 900;
}

.nav-item:hover,
.nav-item.is-active {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.nav-item.is-active {
  box-shadow: inset 3px 0 0 var(--brand);
}

.sidebar-note {
  margin-top: auto;
  padding: 15px;
  border: 1px solid #c9ded6;
  border-radius: var(--radius);
  background: linear-gradient(180deg, #f6fbf8, #edf5f1);
}

.sidebar-note p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.main-panel {
  min-width: 0;
  padding: 26px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.topbar h1,
.hero-copy h2,
.page-section-heading h2 {
  margin: 0;
}

.topbar h1 {
  font-size: clamp(1.55rem, 2vw, 2.1rem);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--brand-strong);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar-actions,
.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-select {
  min-width: 220px;
  gap: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.role-select select {
  min-height: 44px;
  text-transform: none;
  font-size: 0.94rem;
  font-weight: 800;
}

.role-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding: 16px 18px;
  border: 1px solid #cfe1db;
  border-radius: var(--radius);
  background: linear-gradient(100deg, #ffffff, #edf7f3);
  box-shadow: var(--soft-shadow);
}

.demo-warning {
  margin-bottom: 18px;
  padding: 13px 16px;
  border: 1px solid #f0d19a;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: #5e3a0a;
  line-height: 1.45;
}

.demo-warning strong {
  margin-right: 6px;
}

.role-banner h2,
.role-banner p {
  margin: 0;
}

.role-banner p:not(.eyebrow) {
  color: var(--muted);
  line-height: 1.45;
}

.is-role-hidden {
  display: none !important;
}

body[data-role="familiar"] #exportProfessionalHtml,
body[data-role="familiar"] #printProfessionalReport,
body[data-role="familiar"] #exportProfessionalJson {
  display: none;
}

.primary-action,
.secondary-action,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  font-weight: 850;
}

.primary-action {
  background: var(--brand);
  color: #ffffff;
}

.primary-action:hover {
  background: var(--brand-strong);
}

.secondary-action {
  border: 1px solid #bdd6ce;
  background: #ffffff;
  color: var(--brand-strong);
}

.secondary-action:hover,
.text-button:hover {
  background: var(--brand-soft);
}

.icon-button {
  width: 40px;
  display: grid;
  place-items: center;
  background: var(--red-soft);
  color: var(--red);
  font-weight: 950;
}

.text-button {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.hero-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 290px;
  align-items: stretch;
  gap: 20px;
  min-height: 248px;
  padding: 24px;
  border: 1px solid #cfe1db;
  border-radius: var(--radius);
  background:
    linear-gradient(110deg, #ffffff 0%, #eff8f4 58%, #fff7e7 100%);
  box-shadow: var(--shadow);
}

.hero-copy {
  display: grid;
  align-content: center;
  justify-items: start;
}

.hero-copy h2 {
  max-width: 760px;
  font-size: clamp(1.85rem, 3vw, 3.15rem);
  line-height: 1.03;
}

.hero-copy p {
  max-width: 690px;
  margin: 14px 0 18px;
  color: var(--muted);
  font-size: 1.04rem;
  line-height: 1.56;
}

.clinical-snapshot {
  display: grid;
  gap: 14px;
  align-content: space-between;
  justify-items: center;
  padding: 16px;
  border: 1px solid rgba(20, 119, 111, 0.18);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
}

.snapshot-row {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.snapshot-row strong {
  color: var(--text);
  text-align: right;
}

.plate {
  position: relative;
  width: min(178px, 50vw);
  aspect-ratio: 1;
  display: block;
  border: 16px solid #ffffff;
  border-radius: 50%;
  background: #f4efe6;
  box-shadow: inset 0 0 0 2px #e3dcca, 0 16px 30px rgba(63, 77, 73, 0.18);
}

.food {
  position: absolute;
  display: block;
  border-radius: 999px;
}

.food-protein {
  width: 39%;
  height: 34%;
  left: 18%;
  top: 22%;
  background: #d87955;
}

.food-greens {
  width: 34%;
  height: 42%;
  right: 18%;
  top: 18%;
  background: #56a56f;
}

.food-carbs {
  width: 48%;
  height: 28%;
  left: 26%;
  bottom: 18%;
  background: #f1c15d;
}

.food-water {
  width: 22%;
  height: 22%;
  right: 12%;
  bottom: 13%;
  background: #6ba9d7;
}

.metrics-grid,
.research-metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(140px, 1fr));
  gap: 14px;
  margin: 18px 0;
}

.metric-card,
.research-metric,
.panel,
.resident-card,
.training-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--soft-shadow);
}

.metric-card,
.research-metric {
  min-height: 136px;
  padding: 16px;
  display: grid;
  align-content: space-between;
  gap: 12px;
  border-top: 4px solid var(--brand);
}

.metric-card[data-tone="red"],
.research-metric[data-tone="red"] {
  border-top-color: var(--red);
}

.metric-card[data-tone="orange"],
.research-metric[data-tone="orange"] {
  border-top-color: var(--orange);
}

.metric-card[data-tone="blue"],
.research-metric[data-tone="blue"] {
  border-top-color: var(--blue);
}

.metric-card[data-tone="purple"],
.research-metric[data-tone="purple"] {
  border-top-color: var(--purple);
}

.metric-card p,
.research-metric p {
  margin: 0;
  color: var(--muted);
  font-weight: 750;
  line-height: 1.35;
}

.metric-card strong,
.research-metric strong {
  display: block;
  font-size: 1.85rem;
  line-height: 1;
}

.metric-card small,
.research-metric small {
  color: var(--muted);
  line-height: 1.35;
}

.metric-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 950;
}

.content-grid,
.profile-grid {
  display: grid;
  gap: 18px;
}

.two-columns {
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
}

.profile-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 18px;
}

.profile-wide {
  grid-column: span 3;
}

.panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.compact-heading {
  align-items: center;
}

.section-heading h2,
.section-heading h3,
.panel h3 {
  margin: 0;
}

.page-section-heading {
  margin: 4px 0 18px;
}

.badge,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.badge-soft {
  background: var(--surface-muted);
  color: var(--brand-strong);
}

.status-high,
.risk-high {
  background: var(--red-soft);
  color: var(--red);
}

.risk-medium,
.status-medium {
  background: var(--orange-soft);
  color: var(--orange);
}

.risk-attention {
  background: var(--amber-soft);
  color: var(--amber);
}

.risk-low,
.status-low {
  background: var(--green-soft);
  color: var(--green);
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  display: inline-block;
  border-radius: 50%;
}

.intake-dot {
  background: var(--brand);
}

.hydration-dot {
  background: var(--blue);
}

.weekly-chart,
.monthly-chart {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(52px, 1fr);
  align-items: end;
  gap: 12px;
  min-height: 248px;
  padding-top: 10px;
}

.chart-day {
  display: grid;
  grid-template-rows: 1fr auto;
  gap: 8px;
  min-width: 0;
}

.chart-columns {
  position: relative;
  height: 200px;
  display: flex;
  align-items: end;
  justify-content: center;
  gap: 6px;
  padding: 10px 4px;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, transparent 0 24%, rgba(98, 114, 109, 0.08) 24% 25%, transparent 25% 49%, rgba(98, 114, 109, 0.08) 49% 50%, transparent 50% 74%, rgba(98, 114, 109, 0.08) 74% 75%, transparent 75%),
    #f8fbf9;
}

.bar {
  width: 15px;
  min-height: 8px;
  border-radius: 6px 6px 0 0;
}

.bar-intake {
  background: var(--brand);
}

.bar-hydration {
  background: var(--blue);
}

.chart-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-align: center;
}

.priority-list,
.alert-stack,
.meal-history,
.screening-steps,
.bar-list,
.region-list,
.event-timeline {
  display: grid;
  gap: 12px;
}

.priority-item,
.profile-alert,
.meal-row,
.screening-step,
.bar-row,
.region-row,
.event-item {
  display: grid;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.priority-item:last-child,
.profile-alert:last-child,
.meal-row:last-child,
.screening-step:last-child,
.bar-row:last-child,
.region-row:last-child,
.event-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.priority-item {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.priority-item strong,
.meal-row strong,
.profile-alert strong,
.event-item strong {
  display: block;
}

.priority-meta,
.resident-meta,
.alert-meta,
.event-meta {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.segmented-control {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.segment {
  padding: 0 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

.segment.is-active {
  background: var(--brand);
  color: #ffffff;
}

.resident-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 14px;
}

.resident-editor {
  margin-bottom: 18px;
}

.resident-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.form-wide {
  grid-column: 1 / -1;
}

.form-actions,
.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.danger-action {
  border-color: #f2c4b1;
  color: var(--red);
}

.settings-panel {
  display: grid;
  gap: 16px;
}

.settings-panel > label {
  max-width: 360px;
}

.import-control {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid #bdd6ce;
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--brand-strong);
  font-weight: 850;
  cursor: pointer;
}

.import-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.resident-card {
  display: grid;
  gap: 14px;
  min-height: 270px;
  padding: 16px;
  border-left: 5px solid var(--green);
}

.resident-card[data-risk="alto"] {
  border-left-color: var(--red);
}

.resident-card[data-risk="medio"] {
  border-left-color: var(--orange);
}

.resident-card[data-risk="atencao"] {
  border-left-color: var(--amber);
}

.resident-card.is-selected {
  border-color: rgba(20, 119, 111, 0.45);
  border-left-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(20, 119, 111, 0.12), var(--soft-shadow);
}

.resident-card h3 {
  margin: 0;
}

.resident-card dl,
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
}

.resident-card dt,
.summary-tile span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 850;
  text-transform: uppercase;
}

.resident-card dd,
.summary-tile strong {
  margin: 3px 0 0;
  font-weight: 850;
}

.resident-alert-reason {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #f8fbf9;
  color: var(--muted);
  line-height: 1.45;
}

.resident-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
}

.profile-overview {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
}

.avatar {
  width: 78px;
  height: 78px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand-strong);
  font-size: 1.35rem;
  font-weight: 950;
}

.profile-details p {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.45;
}

.profile-details p:last-child {
  margin-bottom: 0;
}

.profile-status {
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 180px;
}

.status-number {
  display: block;
  font-size: 1.75rem;
  font-weight: 950;
}

.summary-tile {
  min-height: 82px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  background: #f8fbf9;
}

.mini-timeline {
  display: grid;
  gap: 10px;
}

.timeline-row {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 68px;
  align-items: center;
  gap: 10px;
}

.timeline-track,
.progress-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2ef;
}

.timeline-fill,
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
}

.meal-row {
  grid-template-columns: minmax(0, 1fr);
}

.meal-row-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.action-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.meal-form {
  max-width: 1120px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

label,
fieldset {
  min-width: 0;
  margin: 0;
}

label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 850;
}

fieldset {
  border: 0;
  padding: 0;
}

legend {
  margin-bottom: 10px;
  font-weight: 900;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
}

.form-block {
  margin-top: 18px;
}

.choice-row,
.reason-grid,
.large-choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice-row label,
.reason-grid label {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
}

.choice-row input,
.reason-grid input,
.large-choice-row input {
  width: auto;
  min-height: auto;
  accent-color: var(--brand);
}

.choice-row label:has(input:checked),
.reason-grid label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.large-choice-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
}

.large-choice-row label {
  min-height: 112px;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  text-align: center;
}

.large-choice-row label:has(input:checked) {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
  box-shadow: inset 0 0 0 2px rgba(20, 119, 111, 0.12);
}

.large-choice-row span {
  display: block;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 950;
}

.large-choice-row small {
  color: inherit;
}

.input-hint {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.meal-feedback {
  flex: 1;
  min-height: 54px;
  display: grid;
  align-content: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  background: #f8fbf9;
  color: var(--muted);
  line-height: 1.45;
}

.meal-feedback.is-saved {
  border: 1px solid #bfdbc9;
  background: var(--green-soft);
  color: #1f5b3b;
  font-weight: 750;
}

.meal-feedback.is-warning {
  border: 1px solid #f2c4b1;
  background: var(--orange-soft);
  color: #82370f;
  font-weight: 750;
}

.notice {
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: #5e3a0a;
  font-weight: 750;
  line-height: 1.45;
}

.screening-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 315px;
  gap: 18px;
  align-items: start;
}

.screening-progress {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.progress-step {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #f8fbf9;
  color: var(--muted);
  font-weight: 850;
}

.progress-step.is-complete {
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.screening-step {
  gap: 12px;
}

.screening-step h3 {
  margin: 0;
  font-size: 1.02rem;
}

.screening-step p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.screening-note-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.screening-note {
  padding: 10px 12px;
  border-radius: var(--radius);
  background: #f8fbf9;
  color: var(--muted);
  line-height: 1.42;
}

.screening-note strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
}

.screening-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.screening-options button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--muted);
  font-weight: 850;
}

.screening-options button.is-selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand-strong);
}

.score-panel {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 12px;
}

.score-panel strong {
  font-size: 3rem;
  line-height: 1;
}

.score-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.score-panel h3 {
  font-size: 0.95rem;
}

.score-panel .badge {
  justify-content: center;
  white-space: normal;
  text-align: center;
}

.safe-note {
  padding: 10px 12px;
  border: 1px solid #f0d19a;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: #5e3a0a !important;
  font-weight: 800;
}

.factor-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.factor-pill {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius);
  background: #f8fbf9;
  color: var(--muted);
}

.factor-pill strong {
  color: var(--text);
  font-size: 0.9rem;
}

.factor-pill span {
  flex: 0 0 auto;
  font-weight: 900;
}

.factor-pill.is-medium {
  background: var(--orange-soft);
  color: var(--orange);
}

.factor-pill.is-high {
  background: var(--red-soft);
  color: var(--red);
}

.alerts-table {
  overflow: hidden;
  padding: 0;
}

.alert-row {
  display: grid;
  grid-template-columns: 1fr 1.2fr 0.8fr 1.45fr;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.alert-row:last-child {
  border-bottom: 0;
}

.alert-row strong {
  display: block;
}

.alert-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.training-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(245px, 1fr));
  gap: 14px;
}

.training-card {
  min-height: 250px;
  padding: 16px;
  display: grid;
  align-content: start;
  gap: 12px;
}

.training-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 1.1rem;
  font-weight: 950;
}

.training-card h3,
.training-card p {
  margin: 0;
}

.training-card p {
  color: var(--muted);
  line-height: 1.45;
}

.training-example {
  margin-top: auto;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: var(--surface-blue);
  color: #234d80;
  line-height: 1.4;
  font-size: 0.92rem;
}

.research-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.research-wide {
  grid-column: span 4;
}

.two-columns .research-wide {
  grid-column: 1 / -1;
}

.donut {
  width: 170px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 10px auto 12px;
  border-radius: 50%;
  background:
    conic-gradient(var(--red) 0 var(--high), var(--orange) var(--high) calc(var(--high) + var(--medium)), var(--green) 0);
}

.donut span {
  width: 92px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #ffffff;
  font-size: 1.6rem;
  font-weight: 950;
}

.research-grid p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.bar-row,
.region-row {
  grid-template-columns: 104px minmax(0, 1fr) 48px;
  align-items: center;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-cloud span {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 800;
  font-size: 0.86rem;
}

.tag-cloud .is-warning {
  background: var(--orange-soft);
  color: var(--orange);
}

.tag-cloud .is-positive {
  background: var(--green-soft);
  color: var(--green);
}

.compact-list {
  display: grid;
  gap: 8px;
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.4;
}

.screening-history {
  display: grid;
  gap: 10px;
}

.screening-history-row {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr) 120px 128px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fbf9;
}

.screening-history-row strong,
.screening-history-row span {
  display: block;
}

.screening-history-row span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.national-filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr)) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
}

.national-filters label {
  gap: 7px;
}

.hbar-list {
  display: grid;
  gap: 12px;
}

.hbar-row {
  display: grid;
  grid-template-columns: 138px minmax(0, 1fr) 72px;
  gap: 10px;
  align-items: center;
}

.hbar-row strong {
  min-width: 0;
}

.hbar-track {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2ef;
}

.hbar-fill {
  height: 100%;
  min-width: 3px;
  border-radius: 999px;
  background: var(--brand);
}

.hbar-fill.is-red {
  background: var(--red);
}

.hbar-fill.is-orange {
  background: var(--orange);
}

.hbar-fill.is-blue {
  background: var(--blue);
}

.hbar-fill.is-purple {
  background: var(--purple);
}

.national-lower-grid {
  margin-top: 18px;
}

.data-quality-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.quality-tile {
  min-height: 84px;
  display: grid;
  align-content: center;
  gap: 4px;
  padding: 12px;
  border-radius: var(--radius);
  background: #f8fbf9;
}

.quality-tile strong {
  font-size: 1.4rem;
}

.quality-tile span {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
  line-height: 1.35;
}

.panel-copy {
  margin: 0 0 14px;
  color: var(--muted);
  line-height: 1.45;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.export-status {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.report-controls {
  display: grid;
  grid-template-columns: minmax(170px, 1fr) minmax(150px, 0.8fr) repeat(4, auto);
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.export-reference {
  margin: 18px 0;
}

.export-comparison {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
}

.export-comparison div {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: var(--radius);
  background: #f8fbf9;
}

.export-comparison span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

.professional-report {
  display: grid;
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: var(--soft-shadow);
}

.report-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 2px solid var(--brand);
}

.report-header h2,
.report-section h3 {
  margin: 0;
}

.report-header p,
.report-section p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.report-section {
  display: grid;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.report-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.report-tile {
  padding: 12px;
  border-radius: var(--radius);
  background: #f8fbf9;
}

.report-tile span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.report-tile strong {
  display: block;
  margin-top: 4px;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
}

.report-table th,
.report-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.report-table th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.report-footer {
  padding: 12px;
  border-radius: var(--radius);
  background: var(--amber-soft);
  color: #5e3a0a;
  font-weight: 800;
  line-height: 1.45;
}

@media (max-width: 1280px) {
  .metrics-grid,
  .research-metrics {
    grid-template-columns: repeat(3, minmax(160px, 1fr));
  }

  .national-filters {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .report-controls,
  .resident-form,
  .export-comparison {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .research-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .research-wide {
    grid-column: span 2;
  }
}

@media (max-width: 1080px) {
  .two-columns,
  .screening-layout {
    grid-template-columns: 1fr;
  }

  .profile-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-wide {
    grid-column: span 2;
  }

  .score-panel {
    position: static;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 16px;
  }

  .nav-list {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .nav-item {
    justify-content: center;
    min-height: 52px;
    padding: 8px;
    text-align: center;
  }

  .nav-item span,
  .sidebar-note {
    display: none;
  }

  .main-panel {
    padding: 18px 14px;
  }

  .topbar,
  .role-banner,
  .profile-overview {
    align-items: flex-start;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .hero-band,
  .form-grid,
  .screening-note-grid {
    grid-template-columns: 1fr;
  }

  .clinical-snapshot {
    justify-items: start;
  }

  .profile-status {
    justify-items: start;
    min-width: 0;
  }

  .metrics-grid,
  .research-metrics,
  .profile-grid,
  .research-grid {
    grid-template-columns: 1fr;
  }

  .national-filters,
  .report-controls,
  .export-comparison,
  .report-grid,
  .report-header,
  .resident-form,
  .screening-history-row {
    grid-template-columns: 1fr;
  }

  .profile-wide,
  .research-wide {
    grid-column: span 1;
  }

  .alert-row {
    grid-template-columns: 1fr;
  }

  .large-choice-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .nav-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-actions,
  .hero-actions,
  .form-footer,
  .page-section-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .primary-action,
  .secondary-action,
  .icon-button,
  .text-button {
    width: 100%;
  }

  .role-select {
    width: 100%;
  }

  .segmented-control {
    width: 100%;
    overflow-x: auto;
  }

  .weekly-chart,
  .monthly-chart {
    grid-auto-columns: minmax(40px, 1fr);
    gap: 6px;
  }

  .chart-columns {
    height: 150px;
  }

  .bar {
    width: 12px;
  }

  .resident-card dl,
  .summary-grid,
  .data-quality-grid,
  .hbar-row,
  .bar-row,
  .region-row,
  .timeline-row {
    grid-template-columns: 1fr;
  }

  .large-choice-row {
    grid-template-columns: 1fr;
  }
}

@media (min-width: 481px) and (max-width: 768px) {
  .metrics-grid,
  .research-metrics,
  .data-quality-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .resident-grid,
  .training-grid,
  .research-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .large-choice-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  body {
    font-size: 0.96rem;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: auto;
    display: grid;
    gap: 10px;
    padding: 10px 12px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
  }

  .brand {
    gap: 9px;
    min-width: 0;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    font-size: 0.86rem;
  }

  .brand strong {
    font-size: 0.98rem;
  }

  .brand small {
    margin-top: 2px;
    font-size: 0.78rem;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 0 0 4px;
    scroll-snap-type: x proximity;
    -webkit-overflow-scrolling: touch;
  }

  .nav-item {
    width: auto;
    min-width: max-content;
    min-height: 44px;
    flex: 0 0 auto;
    justify-content: center;
    gap: 7px;
    padding: 8px 12px;
    font-size: 0.9rem;
    text-align: center;
    scroll-snap-align: start;
  }

  .nav-item span {
    width: 24px;
    height: 24px;
    display: grid;
  }

  .nav-item.is-active {
    box-shadow: inset 0 -3px 0 var(--brand);
  }

  .sidebar-note {
    display: none;
  }

  .main-panel {
    width: 100%;
    padding: 14px 12px 24px;
  }

  .topbar {
    align-items: stretch;
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar h1 {
    font-size: 1.45rem;
    line-height: 1.15;
  }

  .topbar-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: end;
  }

  .role-select {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-column: 1 / -1;
    gap: 6px;
    font-size: 0.72rem;
  }

  .icon-button {
    width: 48px;
  }

  .primary-action,
  .secondary-action,
  .text-button,
  .segment,
  .import-control {
    min-height: 46px;
  }

  .demo-warning,
  .role-banner,
  .notice {
    padding: 12px;
    line-height: 1.45;
  }

  .role-banner {
    align-items: flex-start;
  }

  .role-banner .badge {
    align-self: flex-start;
  }

  .hero-band {
    min-height: 0;
    padding: 16px;
    gap: 16px;
  }

  .hero-copy h2 {
    font-size: 1.55rem;
    line-height: 1.12;
  }

  .hero-copy p {
    margin: 10px 0 14px;
    font-size: 0.96rem;
    line-height: 1.45;
  }

  .clinical-snapshot {
    justify-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .plate {
    width: 132px;
    justify-self: center;
    border-width: 12px;
  }

  .metrics-grid,
  .research-metrics {
    gap: 10px;
    margin: 14px 0;
  }

  .metric-card,
  .research-metric {
    min-height: 116px;
    padding: 14px;
  }

  .metric-card strong,
  .research-metric strong {
    font-size: 1.55rem;
  }

  .content-grid,
  .profile-grid {
    gap: 14px;
  }

  .panel,
  .resident-card,
  .training-card {
    padding: 14px;
  }

  .section-heading {
    gap: 10px;
  }

  .page-section-heading,
  .compact-heading {
    align-items: stretch;
  }

  .segmented-control {
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    -webkit-overflow-scrolling: touch;
  }

  .segment {
    min-width: 76px;
    flex: 0 0 auto;
  }

  .resident-grid,
  .resident-form,
  .form-grid,
  .profile-grid,
  .national-filters,
  .report-controls,
  .export-comparison,
  .report-grid,
  .screening-note-grid,
  .screening-history-row {
    grid-template-columns: 1fr;
  }

  .resident-card {
    min-height: 0;
    gap: 12px;
  }

  .resident-card .section-heading {
    align-items: flex-start;
  }

  .resident-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
  }

  .resident-actions,
  .form-actions,
  .settings-actions,
  .export-actions {
    align-items: stretch;
  }

  .profile-overview {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .avatar {
    width: 62px;
    height: 62px;
    font-size: 1.08rem;
  }

  .profile-status {
    justify-items: start;
    min-width: 0;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .weekly-chart,
  .monthly-chart {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    grid-auto-columns: minmax(48px, 1fr);
    gap: 7px;
    min-height: 190px;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .chart-columns {
    height: 150px;
  }

  .meal-form {
    max-width: none;
  }

  .choice-row label,
  .reason-grid label,
  .screening-options button {
    min-height: 46px;
  }

  .large-choice-row {
    grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  }

  .large-choice-row label {
    min-height: 88px;
  }

  .form-footer {
    align-items: stretch;
  }

  .form-footer .primary-action {
    min-height: 50px;
  }

  .screening-layout {
    gap: 14px;
  }

  .screening-progress {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding-bottom: 4px;
    -webkit-overflow-scrolling: touch;
  }

  .progress-step {
    min-height: 44px;
    flex: 0 0 148px;
    padding: 0 10px;
    text-align: center;
  }

  .screening-step h3 {
    font-size: 1rem;
    line-height: 1.3;
  }

  .score-panel {
    position: static;
  }

  .score-panel strong {
    font-size: 2.35rem;
  }

  .alert-row {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 14px;
  }

  .research-grid,
  .research-wide {
    grid-template-columns: 1fr;
    grid-column: auto;
  }

  .hbar-row {
    grid-template-columns: 118px minmax(0, 1fr) 56px;
  }

  .national-filters button,
  .report-controls button,
  .export-actions button,
  .settings-actions button,
  .settings-actions .import-control {
    width: 100%;
  }

  .professional-report {
    gap: 14px;
    padding: 16px;
  }

  .report-header {
    display: grid;
    gap: 12px;
  }

  .report-table,
  .report-table tbody,
  .report-table tr,
  .report-table th,
  .report-table td {
    display: block;
    width: 100%;
  }

  .report-table tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
  }

  .report-table th,
  .report-table td {
    padding: 3px 0;
    border-bottom: 0;
  }
}

@media (max-width: 480px) {
  body {
    font-size: 0.94rem;
  }

  .sidebar {
    padding: 8px 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .nav-list {
    gap: 6px;
  }

  .nav-item {
    min-height: 44px;
    padding: 8px 10px;
    font-size: 0.84rem;
  }

  .nav-item span {
    width: 22px;
    height: 22px;
  }

  .main-panel {
    padding: 12px 10px 22px;
  }

  .topbar h1 {
    font-size: 1.28rem;
  }

  .topbar-actions,
  .hero-actions,
  .form-footer,
  .resident-actions,
  .form-actions,
  .settings-actions,
  .export-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .topbar-actions {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .topbar-actions .role-select {
    grid-column: 1 / -1;
  }

  .primary-action,
  .secondary-action,
  .text-button,
  .icon-button,
  .import-control {
    width: 100%;
    min-height: 48px;
    padding-inline: 12px;
  }

  .topbar-actions .icon-button {
    width: 48px;
  }

  .badge,
  .status-pill {
    max-width: 100%;
    white-space: normal;
    text-align: center;
  }

  .hero-band,
  .panel,
  .resident-card,
  .training-card,
  .professional-report {
    padding: 12px;
  }

  .hero-copy h2 {
    font-size: 1.34rem;
  }

  .clinical-snapshot {
    display: none;
  }

  .metrics-grid,
  .research-metrics,
  .summary-grid,
  .data-quality-grid,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .metric-card,
  .research-metric {
    min-height: 96px;
  }

  .metric-card small,
  .research-metric small {
    display: none;
  }

  .section-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .mobile-optional,
  .resident-mobile-secondary,
  .resident-mobile-detail,
  .resident-actions .resident-meta {
    display: none;
  }

  .resident-card dl {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .resident-alert-reason {
    padding: 9px 10px;
  }

  .choice-row,
  .reason-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .large-choice-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .large-choice-row label {
    min-height: 76px;
    padding: 10px 8px;
  }

  .large-choice-row label:last-child {
    grid-column: 1 / -1;
  }

  .large-choice-row span {
    font-size: 1.28rem;
  }

  .form-footer .primary-action {
    order: -1;
  }

  .screening-options {
    display: grid;
    grid-template-columns: 1fr;
  }

  .screening-note {
    padding: 9px 10px;
  }

  .factor-pill {
    display: grid;
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .score-panel strong {
    font-size: 2.05rem;
  }

  .hbar-row,
  .bar-row,
  .region-row,
  .timeline-row,
  .screening-history-row {
    grid-template-columns: 1fr;
  }

  .hbar-row {
    gap: 6px;
  }

  .hbar-track {
    width: 100%;
  }

  .weekly-chart,
  .monthly-chart {
    grid-auto-columns: 42px;
    min-height: 168px;
  }

  .chart-columns {
    height: 128px;
  }

  .bar {
    width: 10px;
  }

  .export-comparison {
    grid-template-columns: 1fr;
  }

  .report-header h2 {
    font-size: 1.18rem;
    line-height: 1.25;
  }

  .report-tile,
  .quality-tile,
  .summary-tile,
  .meal-feedback,
  .panel-copy,
  .safe-note {
    overflow-wrap: anywhere;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .sidebar,
  .topbar,
  .role-banner,
  .view:not(#relatorio),
  #relatorio .page-section-heading,
  #relatorio .report-controls,
  #relatorio .export-reference,
  #professionalExportStatus {
    display: none !important;
  }

  .app-shell,
  .main-panel,
  .view,
  #relatorio {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .professional-report {
    border: 0;
    box-shadow: none;
    padding: 0;
    font-size: 11pt;
  }

  .report-section {
    break-inside: avoid;
  }
}
