/*
  NutriClinic — visual
  Conceito: prontuário calmo e preciso (verde-folha) com um único acento quente (beterraba)
  para o que pede atenção agora: a próxima refeição, a próxima consulta, alertas.
  Profundidade por elevação suave; movimento só para orientar (entrar na tela, responder a um toque).
*/
:root {
  /* cor */
  --paper: #F3F5F1;
  --surface: #FFFFFF;
  --mist: #F7F9F6;
  --ink: #16231C;
  --ink-2: #2B3A32;
  --muted: #5B6A62;
  --line: #E0E6DE;
  --line-strong: #C3CEC6;
  --leaf: #2F6B4F;
  --leaf-dark: #214E39;
  --leaf-deep: #13281D;
  --leaf-soft: #E6F0E9;
  --leaf-glow: #8FC6A5;
  --beet: #A3324F;
  --beet-dark: #84263F;
  --beet-soft: #F7E6EB;
  --amber: #8A5A00;
  --amber-soft: #FBF1DC;
  --sky: #2E6A8A;
  --sky-soft: #E4F0F6;
  /* forma */
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 22px;
  --shadow-1: 0 1px 2px rgba(22, 35, 28, .06), 0 1px 1px rgba(22, 35, 28, .03);
  --shadow-2: 0 2px 4px rgba(22, 35, 28, .04), 0 10px 28px -12px rgba(22, 35, 28, .22);
  --shadow-3: 0 24px 64px -16px rgba(22, 35, 28, .35);
  /* tipo */
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  /* movimento */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.45, .64, 1);
  --fast: 140ms;
  --base: 240ms;
  --slow: 520ms;
  --focus: 0 0 0 3px var(--paper), 0 0 0 5px var(--leaf);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 var(--body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.12; margin: 0; letter-spacing: -0.015em; text-wrap: balance; }
h1 { font-size: clamp(1.6rem, 2.6vw, 2.05rem); }
h2 { font-size: 1.22rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--leaf); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
td.num, th.num, .num { font-variant-numeric: tabular-nums; }

/* ---------- ícones ---------- */
.ic { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.18em; }

/* ---------- animações ---------- */
@keyframes enter { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { 0% { transform: scale(.6); opacity: 0; } 70% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes shimmer { from { background-position: -320px 0; } to { background-position: 320px 0; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(163, 50, 79, .35); } 60% { box-shadow: 0 0 0 9px rgba(163, 50, 79, 0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes rise-fill { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.enter { animation: enter var(--slow) var(--ease) both; }
.enter-2 { animation: enter var(--slow) var(--ease) 70ms both; }
.enter-3 { animation: enter var(--slow) var(--ease) 140ms both; }

/* ---------- botões e campos ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  min-height: 40px; padding: .45rem 1rem;
  border: 1px solid var(--leaf); border-radius: var(--radius-s);
  background: var(--leaf); color: #fff; font-weight: 700; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, var(--shadow-1);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), transform var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
.btn:hover { background: var(--leaf-dark); border-color: var(--leaf-dark); box-shadow: var(--shadow-2); }
.btn:active { transform: translateY(1px) scale(.985); box-shadow: none; }
.btn.ghost { background: var(--surface); color: var(--leaf); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn.ghost:hover { background: var(--leaf-soft); border-color: var(--leaf); }
.btn.danger { background: var(--surface); color: var(--beet); border-color: #E3B9C5; box-shadow: none; }
.btn.danger:hover { background: var(--beet-soft); border-color: var(--beet); }
.btn.link { background: none; border: 0; color: var(--leaf); padding: .25rem .4rem; min-height: 32px; text-decoration: underline; text-decoration-color: rgba(47,107,79,.35); text-underline-offset: 3px; font-weight: 400; box-shadow: none; }
.btn.link:hover { text-decoration-color: currentColor; background: none; }
.btn.small { min-height: 32px; padding: .25rem .7rem; font-size: .875rem; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.icon-btn { display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1px solid transparent; background: transparent; color: inherit; cursor: pointer; transition: background var(--fast) var(--ease), transform var(--fast) var(--ease); }
.icon-btn:hover { background: rgba(127, 140, 132, .14); }
.icon-btn:active { transform: scale(.94); }

.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: .9rem; min-width: 0; }
.field label { font-weight: 700; font-size: .875rem; color: var(--ink-2); }
.field .hint { font-size: .8rem; color: var(--muted); }
input, select, textarea {
  width: 100%; min-height: 42px; padding: .5rem .7rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-s); background: var(--surface);
  transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
input:hover, select:hover, textarea:hover { border-color: #A9B7AE; }
textarea { min-height: 90px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--leaf); box-shadow: 0 0 0 4px rgba(47, 107, 79, .14); }
.search-input { position: relative; flex: 1 1 280px; max-width: 380px; }
.search-input .ic { position: absolute; left: .75rem; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search-input input { padding-left: 2.3rem; }
.grid { display: grid; gap: 0 1rem; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.row { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.row.end { justify-content: flex-end; }
.spacer { flex: 1; }
.error-box { background: var(--beet-soft); color: var(--beet-dark); border: 1px solid #EBC4D0; border-radius: var(--radius-s); padding: .6rem .8rem; margin-bottom: 1rem; font-weight: 700; animation: enter var(--base) var(--ease); }

/* ---------- avatar ---------- */
.avatar {
  --h: 150; display: inline-grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: hsl(var(--h) 36% 90%); color: hsl(var(--h) 45% 26%);
  font-family: var(--display); font-weight: 700; font-size: .92rem; letter-spacing: .01em;
}
.avatar.lg { width: 64px; height: 64px; font-size: 1.45rem; }
.avatar.sm { width: 30px; height: 30px; font-size: .78rem; }
.person { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.person > div { min-width: 0; }

/* ---------- autenticação ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 480px); }
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 3rem;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem;
  background: radial-gradient(120% 90% at 0% 0%, #3E8462 0%, var(--leaf) 40%, var(--leaf-dark) 100%);
}
.auth-art::after { /* prato visto de cima, desenhado em linhas */
  content: ""; position: absolute; right: -14vw; bottom: -14vw; width: 46vw; height: 46vw; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.14); box-shadow: inset 0 0 0 4vw rgba(255,255,255,.04), 0 0 0 2.4vw rgba(255,255,255,.035);
  pointer-events: none;
}
.auth-art .brand { font-family: var(--display); font-size: 1.35rem; font-weight: 700; display: flex; align-items: center; gap: .55rem; position: relative; z-index: 1; }
.auth-art .brand img { width: 30px; height: 30px; }
.auth-art blockquote { font-family: var(--display); font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1.04; margin: 0; max-width: 13ch; font-weight: 500; letter-spacing: -0.025em; position: relative; z-index: 1; animation: enter 700ms var(--ease) both; }
.day-track { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 560px; }
.day-track::before { content: ""; position: absolute; left: 6px; right: 6px; top: 6px; height: 2px; background: rgba(255,255,255,.28); }
.day-track .fill { position: absolute; left: 6px; top: 6px; height: 2px; background: #fff; transform-origin: left; animation: grow 1.1s var(--ease) 250ms both; }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.day-track span { position: relative; padding-top: 1.35rem; font-size: .9rem; opacity: .9; }
.day-track span b { display: block; font-family: var(--display); font-size: 1.05rem; }
.day-track span::before { content: ""; position: absolute; top: 0; left: 0; width: 14px; height: 14px; border-radius: 50%; border: 2px solid #fff; background: var(--leaf); }
.day-track span.done::before { background: #fff; }
.day-track span.now::before { background: var(--beet); border-color: #fff; animation: pulse 2.2s ease-out infinite; }
.auth-form { padding: 3rem 2.75rem; display: flex; flex-direction: column; justify-content: center; background: var(--surface); }
.auth-form > * { animation: enter var(--slow) var(--ease) both; }
.auth-form h1 { margin-bottom: .4rem; }
.auth-form > p { color: var(--muted); margin-bottom: 1.6rem; }
.auth-form .btn[type=submit] { width: 100%; min-height: 46px; font-size: 1rem; }
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 1.5rem 16px 1.75rem; gap: 1.4rem; }
  .auth-art blockquote { font-size: 1.85rem; }
  .auth-art::after { width: 80vw; height: 80vw; right: -30vw; bottom: -40vw; }
  .auth-form { padding: 2rem 16px; }
}

/* ---------- casca da equipe ---------- */
.shell { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.side {
  background: linear-gradient(180deg, #17291F 0%, var(--leaf-deep) 100%); color: #DCE7E0;
  padding: 1.1rem .8rem; display: flex; flex-direction: column; gap: .25rem;
  position: sticky; top: 0; height: 100vh;
}
.side .brand { font-family: var(--display); font-weight: 700; font-size: 1.2rem; padding: .2rem .6rem 1.3rem; display: flex; align-items: center; gap: .6rem; color: #fff; }
.side .brand img { width: 28px; height: 28px; }
.side nav { display: flex; flex-direction: column; gap: .2rem; }
.side nav a {
  position: relative; display: flex; align-items: center; gap: .7rem;
  color: #BFD0C5; text-decoration: none; padding: .6rem .75rem; border-radius: 10px;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.side nav a .ic { opacity: .8; }
.side nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.side nav a[aria-current="page"] { background: rgba(143, 198, 165, .14); color: #fff; font-weight: 700; }
.side nav a[aria-current="page"] .ic { opacity: 1; color: var(--leaf-glow); }
.side nav a[aria-current="page"]::before { content: ""; position: absolute; left: -.8rem; top: 22%; bottom: 22%; width: 3px; border-radius: 0 3px 3px 0; background: var(--leaf-glow); animation: fade var(--base) var(--ease); }
.side .who { margin-top: auto; padding: .9rem .5rem .2rem; border-top: 1px solid rgba(255,255,255,.1); display: flex; align-items: center; gap: .6rem; }
.side .who .avatar { --h: 145; background: rgba(143,198,165,.2); color: #E7F3EB; }
.side .who .meta { min-width: 0; flex: 1; font-size: .875rem; line-height: 1.3; }
.side .who strong { display: block; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .who span { color: #93A89B; font-size: .8rem; }
.side .who .icon-btn { color: #BFD0C5; width: 34px; height: 34px; }
.side .who .icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.main { padding: 2rem clamp(16px, 3.2vw, 2.75rem) 4rem; max-width: 1200px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-head p { margin: .35rem 0 0; color: var(--muted); }
.crumb { display: inline-flex; align-items: center; gap: .3rem; font-size: .875rem; margin-bottom: .75rem; text-decoration: none; color: var(--muted); }
.crumb:hover { color: var(--leaf); }
.topbar { display: none; }
.menu-close { display: none; }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 40; transform: translateX(-102%); transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease); }
  .shell.menu-open .side { transform: none; box-shadow: 0 0 0 100vmax rgba(22,35,28,.45); }
  .topbar { display: flex; align-items: center; justify-content: space-between; padding: .55rem 12px .55rem 16px; background: var(--leaf-deep); color: #fff; position: sticky; top: 0; z-index: 30; }
  .topbar .brand { font-family: var(--display); font-weight: 700; display: flex; gap: .5rem; align-items: center; }
  .topbar .brand img { width: 24px; height: 24px; }
  .topbar .icon-btn { color: #fff; }
  .menu-close { display: inline-grid; margin-left: auto; color: #BFD0C5; }
  .main { padding-top: 1.25rem; }
}

/* ---------- blocos ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; margin-bottom: 1.25rem; box-shadow: var(--shadow-1); }
.panel > h2, .panel > .row > h2, .panel-head { margin-bottom: .9rem; }
.panel-head { display: flex; align-items: center; gap: .6rem; }
.panel-head h2 { margin: 0; }
.panel-head .ic-badge { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; background: var(--leaf-soft); color: var(--leaf); }
.panel-head .ic-badge.beet { background: var(--beet-soft); color: var(--beet); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.stat {
  position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 1rem 1.15rem 1.05rem; box-shadow: var(--shadow-1);
  transition: transform var(--base) var(--ease), box-shadow var(--base) var(--ease);
}
a.stat { color: inherit; text-decoration: none; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-2); }
.stat .ic-badge { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--leaf-soft); color: var(--leaf); margin-bottom: .75rem; }
.stat .ic-badge.beet { background: var(--beet-soft); color: var(--beet); }
.stat .ic-badge.sky { background: var(--sky-soft); color: var(--sky); }
.stat .ic-badge.amber { background: var(--amber-soft); color: var(--amber); }
.stat b { display: block; font-family: var(--display); font-size: 2.1rem; line-height: 1; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat span { color: var(--muted); font-size: .9rem; display: block; margin-top: .35rem; }
.two-col { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; }
@media (max-width: 960px) { .two-col { grid-template-columns: 1fr; } }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); box-shadow: var(--shadow-1); }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
th, td { text-align: left; padding: .75rem .95rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .8rem; color: var(--muted); font-weight: 700; background: var(--mist); letter-spacing: .01em; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background var(--fast) var(--ease); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover { background: #F4F8F5; }
td a { font-weight: 700; text-decoration: none; color: var(--ink); }
td a:hover { color: var(--leaf); text-decoration: underline; }
.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.empty .ic { width: 2rem; height: 2rem; color: var(--line-strong); display: block; margin: 0 auto .6rem; }
.empty .btn { margin-top: .9rem; }

.tag { display: inline-flex; align-items: center; gap: .3rem; font-size: .76rem; font-weight: 700; padding: .14rem .55rem; border-radius: 999px; background: var(--leaf-soft); color: var(--leaf-dark); white-space: nowrap; line-height: 1.5; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.tag.beet { background: var(--beet-soft); color: var(--beet-dark); }
.tag.amber { background: var(--amber-soft); color: var(--amber); }
.tag.grey { background: #ECEFEC; color: var(--muted); }
.tag.plain::before { display: none; }

.tabs { position: relative; display: flex; gap: .2rem; border-bottom: 1px solid var(--line); margin-bottom: 1.4rem; overflow-x: auto; scrollbar-width: none; }
.tabs a { position: relative; display: inline-flex; align-items: center; gap: .45rem; padding: .7rem .9rem; text-decoration: none; color: var(--muted); white-space: nowrap; font-weight: 700; transition: color var(--fast) var(--ease); }
.tabs a::after { content: ""; position: absolute; left: .6rem; right: .6rem; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--leaf); transform: scaleX(0); transition: transform var(--base) var(--ease); }
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); }
.tabs a[aria-current="page"]::after { transform: scaleX(1); }

.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem 1.25rem; margin: 0; }
.facts div { min-width: 0; }
.facts dt { font-size: .8rem; color: var(--muted); }
.facts dd { margin: .1rem 0 0; font-weight: 700; overflow-wrap: anywhere; white-space: pre-line; }

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: .7rem 0; border-bottom: 1px solid var(--line); display: flex; gap: .75rem; align-items: center; }
.list-plain li:last-child { border-bottom: 0; }
.list-plain .time { font-family: var(--display); font-weight: 700; min-width: 3.2rem; font-variant-numeric: tabular-nums; }

/* esqueleto de carregamento */
.skel { display: grid; gap: .8rem; }
.skel i { display: block; height: 18px; border-radius: 8px; background: linear-gradient(90deg, #E9EEEA 0, #F4F7F4 120px, #E9EEEA 240px) #E9EEEA; background-size: 640px 100%; animation: shimmer 1.3s linear infinite; }
.skel i.h { height: 34px; width: 40%; }
.skel i.card { height: 96px; border-radius: var(--radius-m); }
.skel .cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1rem; }
.loading { padding: 3rem; text-align: center; color: var(--muted); }

/* ---------- painel: agenda de hoje ---------- */
.hero-line { color: var(--muted); margin-top: .35rem; }
.hero-line b { color: var(--ink); }
.today-list { list-style: none; margin: 0; padding: 0; position: relative; }
.today-list li { display: grid; grid-template-columns: 3.4rem auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .65rem .2rem; border-bottom: 1px solid var(--line); }
.today-list li:last-child { border-bottom: 0; }
.today-list .time { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.today-list li.past { opacity: .62; }
.today-list li.now-mark { display: flex; align-items: center; gap: .5rem; padding: .2rem 0; border: 0; color: var(--beet); font-size: .75rem; font-weight: 700; }
.today-list li.now-mark::after { content: ""; flex: 1; height: 2px; background: var(--beet); border-radius: 2px; opacity: .5; }
.today-list li.now-mark::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--beet); animation: pulse 2.2s ease-out infinite; }
.today-list a { font-weight: 700; color: var(--ink); text-decoration: none; }
.today-list a:hover { color: var(--leaf); }

/* ---------- ficha do paciente ---------- */
.patient-head { display: flex; gap: 1.1rem; align-items: center; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.2rem 1.3rem; box-shadow: var(--shadow-1); margin-bottom: 1.2rem; }
.patient-head .who { flex: 1 1 280px; min-width: 0; }
.patient-head h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.patient-head .chips { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .5rem; }
.chip { display: inline-flex; align-items: center; gap: .35rem; font-size: .82rem; padding: .22rem .6rem; border-radius: 999px; background: var(--mist); border: 1px solid var(--line); color: var(--ink-2); }
.chip .ic { width: 1em; height: 1em; color: var(--muted); }
.kpis { display: flex; gap: 0; border: 1px solid var(--line); border-radius: var(--radius-m); overflow: hidden; background: var(--mist); }
.kpis div { padding: .55rem 1rem; border-right: 1px solid var(--line); min-width: 92px; }
.kpis div:last-child { border-right: 0; }
.kpis dt { font-size: .75rem; color: var(--muted); }
.kpis dd { margin: 0; font-family: var(--display); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.kpis dd small { font-family: var(--body); font-weight: 700; font-size: .75rem; }
.kpis .down { color: var(--leaf); }
.kpis .up { color: var(--beet); }
.patient-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
@media (max-width: 640px) { .kpis { width: 100%; } .kpis div { flex: 1; min-width: 0; padding: .5rem .6rem; } }

/* ---------- plano alimentar (editor) ---------- */
.meal-edit { border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1rem 1rem .9rem; margin-bottom: .9rem; background: var(--surface); box-shadow: var(--shadow-1); position: relative; }
.meal-edit::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--leaf); }
.meal-edit .meal-head { display: grid; grid-template-columns: minmax(0, 2fr) 120px auto; gap: .6rem; align-items: end; margin-bottom: .6rem; }
.meal-edit .meal-head .field { margin: 0; }
@media (max-width: 640px) { .meal-edit .meal-head { grid-template-columns: 1fr 1fr; } .meal-edit .meal-head .field:first-child { grid-column: 1 / -1; } .meal-edit .meal-head .row { grid-column: 1 / -1; } }
.plan-card { border: 1px solid var(--line); border-radius: var(--radius-m); background: var(--surface); margin-bottom: 1rem; box-shadow: var(--shadow-1); overflow: hidden; }
.plan-card header { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; padding: 1rem 1.15rem; border-bottom: 1px solid var(--line); background: var(--mist); }
.plan-card header h3 { margin-right: auto; }
.plan-card .body { padding: 1.1rem 1.15rem; }
.macros { display: flex; gap: .6rem 1.4rem; flex-wrap: wrap; margin-bottom: .8rem; font-size: .95rem; }
.macros b { font-family: var(--display); font-size: 1.12rem; font-variant-numeric: tabular-nums; }
.computed { color: var(--muted); margin-top: -.3rem; }
.computed b { color: var(--ink); }

/* ---------- linha do dia (cartão do plano) ---------- */
.dayline { list-style: none; margin: 0; padding: 0; position: relative; }
.dayline::before { content: ""; position: absolute; left: 4.6rem; top: .6rem; bottom: .6rem; width: 2px; background: var(--line); }
.dayline > li { display: grid; grid-template-columns: 4rem 1.2rem minmax(0, 1fr); gap: 0 .6rem; padding: .3rem 0 1.4rem; position: relative; }
.dayline .t { font-family: var(--display); font-weight: 700; font-size: 1.05rem; text-align: right; padding-top: .1rem; font-variant-numeric: tabular-nums; }
.dayline .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--paper); border: 3px solid var(--leaf); margin: .3rem 0 0 .07rem; z-index: 1; }
.dayline > li.past .dot { background: var(--leaf); }
.dayline > li.past .meal { opacity: .7; }
.dayline > li.next .dot { border-color: var(--beet); background: var(--beet); animation: pulse 2.2s ease-out infinite; }
.dayline .meal h3 { font-size: 1.08rem; display: flex; gap: .5rem; align-items: baseline; flex-wrap: wrap; }
.dayline .meal h3 .kcal { font-family: var(--body); font-size: .85rem; color: var(--muted); font-weight: 400; }
.dayline .meal ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.dayline .meal ul li { padding: 0 0 .15rem; }
.dayline .meal ul li::marker { color: var(--line-strong); }
.dayline > li.next .meal { background: var(--beet-soft); border-radius: var(--radius-m); padding: .7rem .9rem; margin: -.5rem 0 0 -.3rem; }
.dayline > li.next .meal h3::after { content: "Próxima refeição"; font-family: var(--body); font-size: .72rem; font-weight: 700; color: #fff; background: var(--beet); border-radius: 999px; padding: .1rem .55rem; }
.dayline .meal li.opt-print-title { display: none; }

/* ---------- gráfico ---------- */
.chart svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 4; }
.chart .axis { fill: var(--muted); font-size: 11px; font-family: var(--body); }
.chart .area { fill: url(#chartFill); opacity: 0; animation: fade 900ms var(--ease) 500ms forwards; }
.chart .series { fill: none; stroke: var(--leaf); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1.1s var(--ease) 120ms forwards; }
.chart .pt { fill: var(--surface); stroke: var(--leaf); stroke-width: 2; transform-box: fill-box; transform-origin: center; animation: pop 420ms var(--ease-spring) both; }
.chart .pt.last { fill: var(--leaf); }
.chart .lbl { fill: var(--ink); font-size: 12px; font-weight: 700; font-family: var(--body); }
.chart .lbl-bg { fill: var(--surface); }

/* ---------- agenda ---------- */
.week { display: grid; gap: 1.1rem; }
.day-block h3 { font-size: 1rem; margin-bottom: .5rem; display: flex; gap: .5rem; align-items: center; }
.day-block h3 .muted { font-family: var(--body); font-weight: 400; font-size: .875rem; }
.day-block.today h3 { color: var(--leaf); }
.day-block.today h3::after { content: "Hoje"; font-family: var(--body); font-size: .72rem; font-weight: 700; background: var(--leaf); color: #fff; padding: .08rem .5rem; border-radius: 999px; }
.day-free { font-size: .875rem; color: var(--muted); padding: .55rem .8rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-s); display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.appt {
  position: relative; display: grid; grid-template-columns: 5.4rem minmax(0, 1fr) auto; gap: .8rem; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: .7rem .85rem .7rem 1.05rem; margin-bottom: .5rem; box-shadow: var(--shadow-1);
  transition: box-shadow var(--base) var(--ease), transform var(--base) var(--ease);
}
.appt::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line-strong); }
.appt.confirmed::before, .appt.completed::before { background: var(--leaf); }
.appt.scheduled::before { background: var(--sky); }
.appt.cancelled::before { background: var(--beet); }
.appt.no_show::before { background: var(--amber); }
.appt:hover { box-shadow: var(--shadow-2); }
.appt .when { font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.appt .when small { display: block; font-family: var(--body); font-weight: 400; color: var(--muted); font-size: .78rem; }
.appt .who-line a { color: var(--ink); text-decoration: none; }
.appt .who-line a:hover { color: var(--leaf); }
.appt.cancelled, .appt.no_show { opacity: .65; }
.appt.cancelled .who-line strong { text-decoration: line-through; }
@media (max-width: 560px) { .appt { grid-template-columns: 4.5rem minmax(0, 1fr); } .appt .row { grid-column: 1 / -1; } }

/* ---------- modal e toast ---------- */
dialog { border: 0; border-radius: var(--radius-l); padding: 0; width: min(680px, calc(100vw - 24px)); max-height: calc(100vh - 32px); color: var(--ink); box-shadow: var(--shadow-3); background: var(--surface); }
dialog[open] { animation: dialog-in 260ms var(--ease); }
dialog.wide { width: min(940px, calc(100vw - 24px)); }
dialog::backdrop { background: rgba(19, 40, 29, .42); backdrop-filter: blur(3px); animation: fade 200ms var(--ease); }
dialog form { display: flex; flex-direction: column; max-height: calc(100vh - 32px); }
dialog .d-head { padding: 1.1rem 1.35rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
dialog .d-body { padding: 1.3rem 1.35rem; overflow-y: auto; }
dialog .d-foot { padding: .9rem 1.35rem; border-top: 1px solid var(--line); display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; background: var(--mist); }
.secret { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 1.2rem; background: var(--leaf-soft); padding: .7rem .9rem; border-radius: var(--radius-s); user-select: all; word-break: break-all; }

#toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom, 0px)); z-index: 100; max-width: calc(100vw - 32px);
  display: flex; align-items: center; gap: .55rem;
  background: var(--ink); color: #fff; padding: .7rem 1.05rem; border-radius: 12px; box-shadow: var(--shadow-3);
  transform: translate(-50%, 160%); opacity: 0; visibility: hidden;
  transition: transform 320ms var(--ease-spring), opacity 200ms var(--ease), visibility 0s linear 320ms;
}
#toast::before { content: ""; width: 18px; height: 18px; flex: none; border-radius: 50%; background: var(--leaf-glow) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2313281D' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 12.5l4 4 8-9'/%3E%3C/svg%3E") center/12px no-repeat; }
#toast.err { background: var(--beet-dark); }
#toast.err::before { background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2384263F' stroke-width='3.2' stroke-linecap='round'%3E%3Cpath d='M12 7v6M12 17h.01'/%3E%3C/svg%3E") center/12px no-repeat; }
#toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform 320ms var(--ease-spring), opacity 200ms var(--ease), visibility 0s; }

/* ---------- editor com cálculo ---------- */
.day-summary { position: sticky; top: -1.3rem; z-index: 5; background: rgba(255,255,255,.94); backdrop-filter: blur(6px); margin: -1.3rem -1.35rem 1rem; padding: .9rem 1.35rem; border-bottom: 1px solid var(--line); }
.meters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .9rem; }
.meter > span { display: block; font-size: .78rem; color: var(--muted); }
.meter b { font-family: var(--display); font-size: 1.25rem; margin-right: .3rem; font-variant-numeric: tabular-nums; }
.meter small { font-size: .76rem; color: var(--muted); }
.meter .bar { height: 6px; background: #E8EEE9; border-radius: 99px; margin-top: .35rem; overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--leaf); border-radius: 99px; transition: width var(--slow) var(--ease); }
.meter.off .bar i { background: var(--amber); }
.meter.off small { color: var(--amber); }
.item-row { display: grid; grid-template-columns: minmax(0, 1fr) 80px minmax(0, 190px) 70px auto; gap: .5rem; align-items: start; padding: .55rem 0; border-top: 1px solid var(--line); animation: enter var(--base) var(--ease); }
.item-row:first-child { border-top: 0; }
.item-row .item-desc { display: flex; flex-direction: column; gap: .15rem; min-width: 0; }
.item-row .item-desc .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-row .item-kcal { text-align: right; font-weight: 700; font-size: .9rem; padding-top: .6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.item-row .btn.link { color: var(--beet); margin-top: .3rem; }
.food-search { position: relative; margin-top: .5rem; }
.food-search .results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 10; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-m); box-shadow: var(--shadow-3); max-height: 330px; overflow-y: auto; animation: dialog-in 180ms var(--ease); }
.food-search .results button { display: flex; flex-direction: column; align-items: flex-start; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px solid var(--line); padding: .55rem .8rem; cursor: pointer; gap: .1rem; transition: background var(--fast) var(--ease); }
.food-search .results button:hover, .food-search .results button:focus-visible { background: var(--leaf-soft); box-shadow: none; border-radius: 0; }
.food-search .results button small { color: var(--muted); }
.food-search .results button.free { background: var(--mist); }
.meal-foot { display: flex; gap: .3rem 1rem; flex-wrap: wrap; align-items: center; margin-top: .75rem; padding-top: .65rem; border-top: 1px dashed var(--line); font-size: .9rem; color: var(--muted); }
.meal-foot b { color: var(--ink); }
.meal-foot .tag { margin-left: .2rem; }
th.num, td.num { text-align: right; white-space: nowrap; }
table.compact { border: 1px solid var(--line); border-radius: var(--radius-s); border-collapse: separate; border-spacing: 0; overflow: hidden; }
table.compact th, table.compact td { padding: .38rem .65rem; font-size: .9rem; }
table.compact th { background: none; color: var(--ink); font-weight: 400; }
@media (max-width: 640px) {
  .day-summary { padding: .6rem 16px; }
  .meters { gap: .5rem; }
  .meter > span { font-size: .7rem; }
  .meter b { display: block; font-size: 1rem; margin: 0; }
  .meter small { font-size: .7rem; }
  .meter .tgt { display: none; }
  .meter .bar { height: 4px; margin-top: .2rem; }
  .item-row { grid-template-columns: 64px minmax(0, 1fr) 60px; }
  .item-row .item-desc { grid-column: 1 / -1; }
  .item-row .btn.link { grid-column: 1 / -1; justify-self: start; margin: 0; }
  .item-row select { font-size: .9rem; padding-left: .4rem; padding-right: .2rem; }
}

/* ---------- opções por refeição ---------- */
.opt-bar { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .8rem; margin: .1rem 0 .5rem; }
.opt-tabs, .opt-switch { display: inline-flex; flex-wrap: wrap; gap: .25rem; padding: .22rem; background: var(--mist); border: 1px solid var(--line); border-radius: 999px; }
.opt-acts { display: flex; flex-wrap: wrap; gap: 0 .2rem; }
.opt-tabs button, .opt-switch button {
  display: inline-flex; align-items: baseline; gap: .35rem;
  border: 0; background: transparent; color: var(--ink-2);
  border-radius: 999px; padding: .32rem .85rem; min-height: 32px; font-weight: 700; font-size: .85rem; cursor: pointer;
  transition: background var(--base) var(--ease), color var(--base) var(--ease), box-shadow var(--base) var(--ease);
}
.opt-tabs button small, .opt-switch button small { font-weight: 400; font-size: .76rem; color: var(--muted); transition: color var(--base) var(--ease); }
.opt-tabs button:hover, .opt-switch button:hover { background: rgba(47,107,79,.08); }
.opt-tabs button[aria-selected="true"], .opt-switch button[aria-selected="true"] { background: var(--leaf); color: #fff; box-shadow: var(--shadow-1); }
.opt-tabs button[aria-selected="true"] small, .opt-switch button[aria-selected="true"] small { color: rgba(255,255,255,.85); }
.opt-switch { margin: .5rem 0 .2rem; }
[data-opt-list]:not([hidden]) { animation: enter var(--base) var(--ease); }
@media (max-width: 560px) {
  .opt-switch { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border-radius: 12px; }
  .opt-switch button { flex-direction: column; align-items: center; border-radius: 9px; padding: .3rem .3rem; gap: 0; white-space: nowrap; font-size: .8rem; }
}

/* ---------- micronutrientes ---------- */
details.more { border: 1px solid var(--line); border-radius: var(--radius-s); padding: .6rem .85rem; margin: .2rem 0 1rem; background: var(--surface); }
details.more > summary { cursor: pointer; font-weight: 700; color: var(--leaf-dark); list-style: none; display: flex; align-items: center; gap: .45rem; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: ""; width: 8px; height: 8px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform var(--base) var(--ease); margin-right: .1rem; }
details.more[open] > summary::before { transform: rotate(45deg); }
details.more[open] > summary { margin-bottom: .2rem; }
details.more[open] > :not(summary) { animation: enter var(--base) var(--ease); }
.micro-wrap { max-width: 100%; box-shadow: none; }
table.micro { font-size: .875rem; }
table.micro th, table.micro td { padding: .38rem .65rem; }
table.micro thead th { white-space: nowrap; }
table.micro tbody th[scope="row"] { font-weight: 400; color: var(--ink); background: none; white-space: nowrap; }
table.micro tr.grp th, table.compact tr.grp th { background: var(--mist); color: var(--muted); font-size: .76rem; font-weight: 700; padding-top: .5rem; }
table.micro td.tot, table.micro th.tot { font-weight: 700; background: var(--leaf-soft); }
table.micro sup { color: var(--amber); font-weight: 700; margin-left: 1px; }

/* ================================================================ portal do paciente */
.portal-app { min-height: 100vh; padding-bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
.p-hero {
  position: relative; overflow: hidden; color: #fff;
  background: radial-gradient(140% 120% at 100% 0%, #3E8462 0%, var(--leaf) 45%, var(--leaf-dark) 100%);
  padding: 1rem 16px 4.6rem;
}
.p-hero::after { content: ""; position: absolute; width: 420px; height: 420px; right: -170px; top: -190px; border-radius: 50%; border: 1px solid rgba(255,255,255,.12); box-shadow: inset 0 0 0 46px rgba(255,255,255,.035); pointer-events: none; }
.p-wrap { max-width: 760px; margin: 0 auto; position: relative; z-index: 1; }
.p-top { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.p-top .brand { font-family: var(--display); font-weight: 700; font-size: 1.1rem; display: flex; gap: .5rem; align-items: center; }
.p-top .brand img { width: 26px; height: 26px; border-radius: 7px; box-shadow: 0 0 0 1px rgba(255,255,255,.3); }
.p-top .icon-btn { color: #fff; }
.p-top .icon-btn:hover { background: rgba(255,255,255,.14); }
.p-greet { display: flex; align-items: center; gap: 1.2rem; margin-top: 1.6rem; }
.p-greet > div:first-child { flex: 1; min-width: 0; }
.p-greet h1 { font-size: clamp(1.75rem, 6.5vw, 2.5rem); letter-spacing: -.025em; }
.p-greet p { margin: .35rem 0 0; color: rgba(255,255,255,.82); }
.ring { position: relative; width: 92px; height: 92px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: rgba(255,255,255,.22); stroke-width: 3.4; }
.ring .val { fill: none; stroke: #fff; stroke-width: 3.4; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; transition: stroke-dashoffset 900ms var(--ease); }
.ring .lbl { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.05; }
.ring .lbl b { font-family: var(--display); font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.ring .lbl small { font-size: .68rem; opacity: .85; }

.p-main { max-width: 792px; margin: -3.4rem auto 0; padding: 0 16px; position: relative; z-index: 2; }
.p-view { animation: enter var(--slow) var(--ease) both; }
.p-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); padding: 1.15rem 1.2rem; box-shadow: var(--shadow-2); margin-bottom: 1rem; }
.p-card h2 { font-size: 1.12rem; display: flex; align-items: center; gap: .5rem; }
.p-card .sub { color: var(--muted); font-size: .9rem; margin: .2rem 0 0; }

/* próxima refeição */
.next-meal { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .9rem; align-items: center; }
.next-meal .ic-wrap { width: 52px; height: 52px; border-radius: 16px; background: var(--beet-soft); color: var(--beet); display: grid; place-items: center; }
.next-meal .ic-wrap .ic { width: 26px; height: 26px; }
.next-meal small { color: var(--beet-dark); font-weight: 700; font-size: .78rem; display: block; }
.next-meal h2 { font-size: 1.3rem; }
.next-meal .count { text-align: right; }
.next-meal .count b { font-family: var(--display); font-size: 1.35rem; display: block; line-height: 1.05; font-variant-numeric: tabular-nums; }
.next-meal .count span { font-size: .78rem; color: var(--muted); }
.next-meal.done .ic-wrap { background: var(--leaf-soft); color: var(--leaf); }
@media (max-width: 560px) {
  .next-meal { grid-template-columns: auto minmax(0, 1fr); }
  .next-meal .count { grid-column: 1 / -1; text-align: left; display: flex; align-items: baseline; gap: .5rem; background: var(--beet-soft); border-radius: 12px; padding: .5rem .75rem; }
  .next-meal .count b { display: inline; font-size: 1.15rem; color: var(--beet-dark); }
  .next-meal .count span { color: var(--beet-dark); }
  .next-meal.done .count { display: none; }
}

/* água */
.water { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }
.water .info { flex: 1 1 160px; }
.water .cups { display: flex; gap: .35rem; flex-wrap: wrap; }
.cup {
  position: relative; width: 30px; height: 40px; border: 2px solid #9CC3D6; border-top-width: 0; border-radius: 3px 3px 9px 9px;
  background: transparent; cursor: pointer; padding: 0; overflow: hidden; transition: transform var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.cup::before { content: ""; position: absolute; left: -3px; right: -3px; top: 0; height: 2px; background: #9CC3D6; }
.cup::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 78%; background: linear-gradient(180deg, #7FB8D3, #3F8CB1); transform-origin: bottom; transform: scaleY(0); transition: transform 420ms var(--ease-spring); }
.cup.full::after { transform: scaleY(1); }
.cup.full { border-color: #3F8CB1; }
.cup:hover { transform: translateY(-2px); }
.cup:active { transform: scale(.92); }

/* metas do dia */
.goals { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .6rem; margin-top: .8rem; }
.goal { text-align: center; padding: .7rem .3rem .6rem; border-radius: var(--radius-m); background: var(--mist); border: 1px solid var(--line); }
.goal .mini { width: 54px; height: 54px; margin: 0 auto .35rem; position: relative; }
.goal .mini svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.goal .mini .track { fill: none; stroke: #E3EAE5; stroke-width: 3.6; }
.goal .mini .val { fill: none; stroke-width: 3.6; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: ring-to 1s var(--ease) 200ms forwards; }
@keyframes ring-to { to { stroke-dashoffset: var(--to); } }
.goal b { display: block; font-family: var(--display); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.goal span { font-size: .75rem; color: var(--muted); }
.goal .mini .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: .72rem; font-weight: 700; color: var(--muted); }
@media (max-width: 420px) { .goals { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* refeições do dia */
.meals { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; }
.meal-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-l); box-shadow: var(--shadow-1);
  padding: 1rem 1.1rem; position: relative; transition: box-shadow var(--base) var(--ease), border-color var(--base) var(--ease), background var(--base) var(--ease);
}
.meal-card.is-next { border-color: #E5B3C2; box-shadow: 0 0 0 4px var(--beet-soft), var(--shadow-2); }
.meal-card.is-done { background: #FAFCFA; }
.meal-card.is-done .meal-body { opacity: .6; }
.meal-card .mc-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center; }
.meal-card .mc-time { font-family: var(--display); font-weight: 700; font-size: .95rem; color: var(--leaf-dark); background: var(--leaf-soft); border-radius: 10px; padding: .35rem .55rem; font-variant-numeric: tabular-nums; }
.meal-card.is-next .mc-time { background: var(--beet); color: #fff; }
.meal-card h3 { font-size: 1.1rem; }
.meal-card .mc-meta { font-size: .8rem; color: var(--muted); margin-top: .1rem; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.meal-card .mc-meta .now-pill { color: #fff; background: var(--beet); font-weight: 700; border-radius: 999px; padding: .02rem .5rem; }
.check {
  display: inline-flex; align-items: center; gap: .4rem; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  border-radius: 999px; padding: .35rem .75rem .35rem .4rem; font-weight: 700; font-size: .82rem; cursor: pointer; min-height: 36px;
  transition: background var(--base) var(--ease), border-color var(--base) var(--ease), color var(--base) var(--ease), transform var(--fast) var(--ease);
}
.check .box { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; transition: background var(--base) var(--ease), border-color var(--base) var(--ease); }
.check .box svg { width: 13px; height: 13px; stroke: #fff; stroke-width: 3.2; fill: none; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 300ms var(--ease) 80ms; }
.check:active { transform: scale(.95); }
.check[aria-pressed="true"] { background: var(--leaf-soft); border-color: var(--leaf); color: var(--leaf-dark); }
.check[aria-pressed="true"] .box { background: var(--leaf); border-color: var(--leaf); animation: pop 380ms var(--ease-spring); }
.check[aria-pressed="true"] .box svg { stroke-dashoffset: 0; }
.meal-body { margin-top: .7rem; transition: opacity var(--base) var(--ease); }
.meal-body ul { list-style: none; margin: .5rem 0 0; padding: 0; display: grid; gap: .1rem; }
.meal-body ul li { position: relative; padding: .38rem 0 .38rem 1.2rem; border-bottom: 1px dashed var(--line); }
.meal-body ul li:last-child { border-bottom: 0; }
.meal-body ul li::before { content: ""; position: absolute; left: .2rem; top: .95rem; width: 6px; height: 6px; border-radius: 50%; background: var(--leaf-glow); }
.meal-body li.opt-print-title { display: none; }

/* bloco de orientações */
.note-card { display: flex; gap: .8rem; align-items: flex-start; }
.note-card .ic-wrap { width: 38px; height: 38px; border-radius: 12px; background: var(--sky-soft); color: var(--sky); display: grid; place-items: center; flex: none; }
.note-card p { white-space: pre-line; margin: 0; }

/* evolução */
.p-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.p-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-m); padding: .8rem .9rem; box-shadow: var(--shadow-1); }
.p-stat span { font-size: .78rem; color: var(--muted); display: block; }
.p-stat b { font-family: var(--display); font-size: 1.45rem; font-variant-numeric: tabular-nums; }
.p-stat small { font-weight: 700; font-size: .78rem; }
.p-stat .down { color: var(--leaf); }
.p-stat .up { color: var(--beet); }
.hist { list-style: none; margin: 0; padding: 0; }
.hist li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: .8rem; padding: .65rem 0; border-bottom: 1px solid var(--line); align-items: center; font-variant-numeric: tabular-nums; }
.hist li:last-child { border-bottom: 0; }

/* consultas */
.appt-big { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 1rem; align-items: center; }
.cal { width: 68px; border-radius: 14px; overflow: hidden; text-align: center; box-shadow: var(--shadow-1); border: 1px solid var(--line); }
.cal small { display: block; background: var(--beet); color: #fff; font-size: .72rem; font-weight: 700; padding: .15rem 0; text-transform: lowercase; }
.cal b { display: block; font-family: var(--display); font-size: 1.8rem; padding: .2rem 0 .1rem; line-height: 1.15; }
.cal span { display: block; font-size: .7rem; color: var(--muted); padding-bottom: .3rem; }

/* navegação inferior */
.p-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: .45rem max(12px, env(safe-area-inset-right, 0px)) calc(.45rem + env(safe-area-inset-bottom, 0px)) max(12px, env(safe-area-inset-left, 0px));
  background: rgba(255,255,255,.92); backdrop-filter: blur(10px); border-top: 1px solid var(--line);
}
.p-nav .inner { max-width: 520px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.p-nav button { display: flex; flex-direction: column; align-items: center; gap: .15rem; background: none; border: 0; padding: .35rem .2rem; border-radius: 12px; cursor: pointer; color: var(--muted); font-size: .75rem; font-weight: 700; transition: color var(--base) var(--ease), background var(--base) var(--ease); }
.p-nav button .ic { width: 22px; height: 22px; transition: transform var(--base) var(--ease-spring); }
.p-nav button[aria-current="page"] { color: var(--leaf); background: var(--leaf-soft); }
.p-nav button[aria-current="page"] .ic { transform: translateY(-1px) scale(1.08); }
@media (min-width: 761px) {
  .portal-app { padding-bottom: 2rem; }
  .p-hero { padding-bottom: 3.4rem; }
  .p-nav { position: relative; z-index: 3; background: none; border: 0; backdrop-filter: none; padding: 0 16px; margin: -1.45rem auto 0; max-width: 792px; }
  .p-nav .inner { max-width: none; margin: 0; grid-template-columns: repeat(3, auto); justify-content: start; background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: .25rem; box-shadow: var(--shadow-2); width: max-content; }
  .p-nav button { flex-direction: row; gap: .45rem; padding: .5rem 1.05rem; border-radius: 999px; font-size: .9rem; }
  .p-nav button .ic { width: 18px; height: 18px; }
  .p-main { margin-top: 1.2rem; }
}

/* ---------- impressão ---------- */
@media print {
  body { background: #fff; }
  .side, .topbar, .no-print, #toast, .p-nav, .p-top, .check, .water-card, .next-card { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  .panel, .plan-card, .p-card, .meal-card { border: 0; padding: 0; box-shadow: none; }
  .p-hero { background: none; color: var(--ink); padding: 0; }
  .p-main { margin: 0; }
  .dayline > li, .meal-card { break-inside: avoid; }
  .dayline > li.next .meal { background: none; padding: 0; margin: 0; }
  .dayline > li.next .meal h3::after { display: none; }
  .opt-switch { display: none !important; }
  [data-opt-list][hidden] { display: block !important; }
  li.opt-print-title { display: block !important; list-style: none; font-weight: 700; margin-top: .4rem; }
  body.print-one .page-head, body.print-one .tabs, body.print-one .patient-head, body.print-one .crumb,
  body.print-one .plan-card:not(.print-target) { display: none !important; }
}

/* ---------- movimento reduzido ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.chart .lbl { paint-order: stroke; stroke: var(--surface); stroke-width: 5px; stroke-linejoin: round; }
