/* Identidade Bianca Bitencourt no app (família e nutricionista).
   Os tokens são os mesmos do site (public/site/css/base.css): mudar a marca lá e aqui muda as duas interfaces.
   As variáveis antigas do app (--green, --card, --line…) continuam existindo e apontam para os tokens. */
:root {
  color-scheme: light;
  /* paleta da marca (igual ao site) */
  --coral: #f27582; --coral-d: #d64a5e; --coral-ink: #b8364b;
  --purpleg: #b996c4; --purple-d: #7d5a8a; --purple-ink: #6b4a78;
  --leafg: #a1d296; --green-d: #5f9a55; --green-ink: #3f6e37;
  --orange: #f5b259; --orange-d: #c98320; --orange-ink: #8a5a10;
  --pink: #f6dce8; --blush: #fdf1f4; --cream: #fffdf0; --paper: #fff;
  --ink-2: #5d4767;

  /* tipografia */
  --f-script: "Playball", "Dancing Script", cursive;
  --f-body: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --f-head: "Quicksand", "Nunito", system-ui, sans-serif;
  --round: var(--f-head); --script: var(--f-script);
  --fs-xs: .78rem; --fs-sm: .875rem;
  --fs-h1: clamp(1.6rem, 1.15rem + 1.3vw, 2.15rem);

  /* espaço, forma e movimento */
  --gutter: clamp(16px, 4vw, 32px); --page: 1100px; --read: 760px; /* painéis e listas até 1100 px; formulários e leitura até 760 px, centralizados */
  --r-sm: 10px; --r-md: 16px; --r-lg: 24px; --r-xl: 32px;
  --sh-1: 0 1px 2px rgba(74, 50, 82, .05), 0 4px 16px rgba(74, 50, 82, .06);
  --sh-2: 0 2px 6px rgba(74, 50, 82, .05), 0 18px 44px rgba(74, 50, 82, .12);
  --ease: cubic-bezier(.2, .7, .2, 1);

  /* nomes usados pelo app */
  --bg: var(--cream); --card: var(--paper); --ink: #40294a; --muted: #75627e; --line: rgba(74, 50, 82, .11);
  --green: var(--coral-ink); --green-soft: var(--pink); --on-green: #fff;
  --sun: var(--orange); --sun-soft: #fdeed7;
  --purple: var(--purple-d); --purple-soft: #f3ebf6; --leaf: var(--green-d); --leaf-soft: #e8f3e3;
  --red: #b3261e; --red-soft: #fbe6e3;
  --radius: var(--r-lg); --shadow: var(--sh-1);
  /* cores de estado (prioridade): vermelho = precisa de você, âmbar = vence logo / esperando,
     verde = em dia / concluído, cinza = só informação. O rosa da marca fica só para ação e navegação. */
  --st-bad: #b3261e; --st-bad-soft: #fbe6e3;
  --st-warn: #8a5a10; --st-warn-soft: #fdeed7; --st-warn-line: #e3a13d;
  --st-ok: #2f6b2a; --st-ok-soft: #e3f1de;
  --st-info: #5d4767; --st-info-soft: rgba(74, 50, 82, .08);
}

html, body { font-family: var(--f-body); -webkit-font-smoothing: antialiased; }
body { background: var(--cream); }
h1, h2, h3, h4, .btn, label, th, .tabbar a, .chip, .top nav a { font-family: var(--f-head); }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; text-wrap: balance; color: var(--ink); }
h1 { font-size: var(--fs-h1); }
a { color: var(--coral-ink); text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
:focus-visible, input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--purple-d) 55%, transparent); outline-offset: 2px; }
input:focus, select:focus, textarea:focus { border-color: var(--purple-d); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: var(--r-sm); text-decoration: none; font-weight: 700; }
.skip:focus { top: 12px; }

/* ícones de traço (mesmo padrão do site) */
.i { width: 1.25em; height: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* contêiner: a largura acompanha a tela, com limite para não esticar demais */
.wrap { width: min(760px, 100% - var(--gutter) * 2); max-width: none; margin-inline: auto; padding: clamp(20px, 2.5vw, 36px) 0 112px; }
.wrap.wide { width: min(var(--page), 100% - var(--gutter) * 2); max-width: none; }
@media (min-width: 900px) { .wrap { padding-bottom: 56px; } }

/* cartões e botões (mesma linguagem do site) */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: clamp(16px, 1.6vw, 24px); box-shadow: var(--sh-1); margin-bottom: 16px; }
.btn { --b: var(--coral-ink); min-height: 46px; padding: 11px 22px; border-radius: 999px; border: 1.5px solid var(--b); background: var(--b); color: #fff; font: 700 .95rem/1.2 var(--f-head); text-align: center;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 6px 16px -6px color-mix(in srgb, var(--b) 70%, transparent);
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background-color .2s, filter .2s; }
.btn:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 1px 0 rgba(0, 0, 0, .04), 0 10px 22px -8px color-mix(in srgb, var(--b) 80%, transparent); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.ghost { background: transparent; color: var(--coral-ink); border-color: color-mix(in srgb, var(--coral-d) 45%, transparent); box-shadow: none; }
.btn.ghost:hover { background: var(--blush); filter: none; }
.btn.sun { --b: var(--orange); color: #3f2706; }
.btn.danger { --b: var(--red); }
.btn.sm { min-height: 40px; padding: 8px 18px; font-size: .875rem; }
.btn[disabled] { opacity: .6; cursor: progress; transform: none; }
.btn .i { width: 18px; height: 18px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=url], input[type=search], input[type=month], input[type=tel], input[type=time], select, textarea {
  width: 100%; padding: 11px 12px; min-height: 46px;
  border-radius: var(--r-md); background: var(--cream); border: 1.5px solid color-mix(in srgb, var(--ink) 16%, transparent); transition: border-color .2s, box-shadow .2s; }
input:not([type=checkbox]):not([type=radio]):not([type=file]):hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--ink) 28%, transparent); }
label { color: var(--ink); }
.chip, .chip.gray { background: var(--st-info-soft); color: var(--st-info); }
.chip.ok { background: var(--st-ok-soft); color: var(--st-ok); }
.chip.warn { background: var(--st-warn-soft); color: var(--st-warn); }
.chip.bad { background: var(--st-bad-soft); color: var(--st-bad); }
.badge { background: var(--st-bad); color: #fff; }
.badge.n { background: var(--st-info-soft); color: var(--st-info); }
/* faixa de prioridade na borda esquerda do cartão (reforça a cor da etiqueta) */
.card.pr-bad { box-shadow: inset 4px 0 0 var(--st-bad), var(--sh-1); }
.card.pr-warn { box-shadow: inset 4px 0 0 var(--st-warn-line), var(--sh-1); }
.dot { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.empty { border: 1.5px dashed color-mix(in srgb, var(--ink) 16%, transparent); border-radius: var(--r-lg); background: color-mix(in srgb, var(--paper) 60%, transparent); }

/* telas de entrada: fundo suave e logotipo */
body:has(.hero .brandbar) { background: radial-gradient(circle at 12% 8%, #f6dce8 0, transparent 40%), radial-gradient(circle at 92% 20%, #fdeed7 0, transparent 38%), #fffdf0; }
.brandbar img.bl { width: auto; height: 50px; border-radius: 0; }
.hero .brandbar img.bl { height: 96px; }
.hero { padding-top: 22px; }
.hero h1 { color: var(--coral-ink); }
.authback { text-align: center; padding-top: 14px; }

/* cabeçalho compartilhado (família e nutricionista): mesmo desenho do menu do site */
.fh { position: sticky; top: 0; z-index: 60; background: color-mix(in srgb, var(--cream) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(12px); -webkit-backdrop-filter: saturate(1.4) blur(12px);
  border-bottom: 1px solid var(--line); box-shadow: 0 8px 24px -18px rgba(74, 50, 82, .3); }
.fh .in { width: min(var(--page), 100% - var(--gutter) * 2); margin: 0 auto; min-height: 66px; padding: 6px 0; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.fh .brandbar img.bl { height: 42px; }
.fmenu { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.fmenu > li { position: relative; }
.fmenu a, .fmenu button.dd { font: 700 .9rem var(--f-head); color: var(--ink-2); text-decoration: none; padding: 8px 13px; border-radius: 999px; background: none; border: 0; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center; min-height: 40px; transition: background-color .2s, color .2s; }
.fmenu a:hover, .fmenu button.dd:hover, .fmenu a.on, .fmenu button.dd.on, .fmenu li.open > button.dd { background: var(--blush); color: var(--coral-ink); }
.fmenu a.on, .fmenu button.dd.on { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--coral-d) 22%, transparent); }
.fmenu .badge { margin-left: 2px; }
.fmenu .caret { width: 7px; height: 7px; border-right: 1.8px solid currentColor; border-bottom: 1.8px solid currentColor; transform: rotate(45deg) translateY(-2px); transition: transform .25s var(--ease); }
.fmenu li.open .caret { transform: rotate(225deg); }
.fsub { position: absolute; top: calc(100% + 10px); left: -8px; min-width: 240px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-2); padding: 8px; list-style: none; margin: 0;
  opacity: 0; visibility: hidden; transform: translateY(6px); transition: opacity .2s, transform .2s var(--ease), visibility .2s; z-index: 70; }
.fmenu li.open .fsub { opacity: 1; visibility: visible; transform: none; }
@media (hover: hover) and (min-width: 900px) { .fmenu li:hover .fsub { opacity: 1; visibility: visible; transform: none; } }
.fsub a { display: flex; width: 100%; border-radius: 12px; font-weight: 600; color: var(--ink); gap: 10px; }
.fsub a .i { color: var(--purple-d); }
.fsub a[aria-current=page] { background: var(--blush); color: var(--coral-ink); }
.fsub hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }
.fmenu .acct > button.dd { padding: 4px 12px 4px 4px; border: 1px solid var(--line); background: var(--paper); }
.fmenu .acct .fsub { left: auto; right: 0; }
.fmenu .av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--pink); color: var(--coral-ink); font: 700 .9rem var(--f-head); }
.fmenu .who { font-size: .8rem; color: var(--muted); padding: 0 8px; }
.fmenu a.out { color: var(--coral-ink); border: 1.5px solid color-mix(in srgb, var(--coral-d) 45%, transparent); padding: 6px 14px; margin-left: 4px; }
.fburger { display: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--blush); cursor: pointer; position: relative; flex: none; }
.fburger span, .fburger span::before, .fburger span::after { position: absolute; width: 20px; height: 2px; border-radius: 2px; background: var(--coral-ink); content: ""; transition: .25s var(--ease); }
.fburger span { left: 12px; top: 21px; } .fburger span::before { left: 0; top: -6px; } .fburger span::after { left: 0; top: 6px; }
body.menu-open .fburger span { background: transparent; } body.menu-open .fburger span::before { top: 0; transform: rotate(45deg); } body.menu-open .fburger span::after { top: 0; transform: rotate(-45deg); }

@media (max-width: 899px) {
  .fburger { display: block; z-index: 40; }
  .fh .brandbar { position: relative; z-index: 40; }
  .fh { backdrop-filter: none; -webkit-backdrop-filter: none; background: var(--cream); }
  .fh .in { min-height: 60px; } .fh .brandbar img.bl { height: 38px; }
  .fmenu { position: fixed; inset: 0; flex-direction: column; align-items: stretch; gap: 4px; padding: 84px var(--gutter) 32px; background: var(--cream); overflow-y: auto;
    opacity: 0; visibility: hidden; transform: translateY(-12px); transition: opacity .25s, transform .25s var(--ease), visibility .25s; z-index: 35; }
  body.menu-open .fmenu { opacity: 1; visibility: visible; transform: none; }
  .fmenu a, .fmenu button.dd { width: 100%; font-size: 1.05rem; min-height: 52px; padding: 12px 16px; justify-content: space-between; border-radius: var(--r-md); }
  .fsub { position: static; opacity: 1; visibility: visible; transform: none; box-shadow: none; border: 0; background: transparent; padding: 0 0 0 8px; display: none; }
  .fmenu li.open .fsub { display: block; }
  .fsub a { justify-content: flex-start; }
  .fmenu .acct > button.dd { padding: 8px 16px 8px 8px; }
  .fmenu a.out { margin: 8px 0 0; justify-content: center; }
  .fmenu .who { padding: 8px 18px; }
}

/* barra de abas (celular e tablet) */
.tabbar { background: color-mix(in srgb, var(--paper) 94%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); border-top: 1px solid var(--line); box-shadow: 0 -8px 24px -18px rgba(74, 50, 82, .3); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 60px; padding: 7px 2px 8px; color: var(--muted); font-size: .74rem; font-weight: 700; transition: color .2s; }
.tabbar a .ic { display: grid; place-items: center; width: 52px; height: 30px; border-radius: 999px; transition: background-color .25s var(--ease); }
.tabbar a .ic .i { width: 22px; height: 22px; }
.tabbar a.on { color: var(--coral-ink); } .tabbar a.on .ic { background: var(--pink); }
.tabbar .badge { position: absolute; top: 4px; left: calc(50% + 6px); }
@media (min-width: 900px) { .tabbar { display: none; } }

/* aviso rápido: confirmação em verde-folha, erro em vermelho */
#toast { background: var(--ink); color: var(--cream); box-shadow: var(--sh-2); font-weight: 600; display: flex; gap: 8px; align-items: center; bottom: calc(84px + env(safe-area-inset-bottom)); }
#toast.ok { background: var(--green-ink); } #toast.err { background: var(--red); color: #fff; }
@media (min-width: 900px) { #toast { bottom: 28px; } }
.avatar { width: 112px; height: 112px; border-radius: 50%; object-fit: cover; border: 5px solid #fff; box-shadow: var(--sh-2); margin: 10px auto 0; display: block; }
.avatar.sm { width: 64px; height: 64px; border-width: 3px; margin: 0; flex: none; box-shadow: var(--sh-1); }

/* Plano da quinzena: barra de progresso e seções coloridas */
.pl-bar { height: 10px; background: color-mix(in srgb, var(--ink) 8%, transparent); border-radius: 99px; overflow: hidden; margin-top: 12px; }
.pl-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--leaf), var(--sun)); border-radius: 99px; transition: width .8s var(--ease); }
.pl-cols { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .pl-cols { grid-template-columns: repeat(3, 1fr); } }
.pl-sec { border-radius: var(--r-md); padding: 14px 16px; margin: 10px 0; }
.pl-cols .pl-sec { margin: 0; }
.pl-sec h3 { margin: 0 0 6px; font-size: .95rem; display: flex; gap: 8px; align-items: center; }
.pl-sec ul.tick { margin: 0; }
.pl-goals { background: var(--leaf-soft); } .pl-goals h3 .i { color: var(--green-ink); }
.pl-steps { background: var(--purple-soft); } .pl-steps h3 .i { color: var(--purple-d); }
.pl-meals { background: var(--sun-soft); } .pl-meals h3 .i { color: var(--orange-ink); }
.pl-notes { background: var(--blush); margin-top: 14px; } .pl-notes h3 .i { color: var(--coral-ink); }

/* Check-in da quinzena: perguntas em pílulas, com ícones para o intestino (escala de Bristol) */
.qc-grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .qc-grid2 { grid-template-columns: 1fr 1fr; } }
.qc-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.qc-pill { margin: 0; }
.qc-pill input { position: absolute; opacity: 0; }
.qc-pill span { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; border: 1.5px solid color-mix(in srgb, var(--ink) 14%, transparent); border-radius: 14px; padding: 8px 12px; font-size: .88rem; font-weight: 700; cursor: pointer; background: var(--paper); color: var(--ink); transition: border-color .2s, background-color .2s; }
.qc-pill span:hover { border-color: var(--coral-d); }
.qc-pill span svg { width: 26px; height: 17px; display: block; color: var(--purple); }
.qc-pill input:checked + span { border-color: var(--coral-ink); background: var(--blush); color: var(--coral-ink); }
.qc-pill input:checked + span svg { color: var(--coral-ink); }
.qc-pill input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--purple-d) 55%, transparent); outline-offset: 2px; }
.moods span { border-color: color-mix(in srgb, var(--ink) 14%, transparent); min-height: 52px; transition: border-color .2s, background-color .2s, transform .2s var(--ease); }
.moods span:hover { transform: translateY(-1px); }
.moods input:checked + span { border-color: var(--coral-ink); background: var(--blush); }
.qc-hist { display: grid; gap: 14px; }
@media (min-width: 900px) { .qc-hist { grid-template-columns: 1fr 1fr; } }
@media (min-width: 1280px) { .qc-hist { grid-template-columns: repeat(3, 1fr); } }
.qc-card { margin-bottom: 0; }

/* Portal de módulos (tela inicial da área dos membros) */
.mods { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: clamp(14px, 2vw, 22px); align-items: start; }
.mod { --mc: var(--leafg); --md: var(--green-ink); display: flex; flex-direction: column; gap: 12px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 0 0 22px; overflow: hidden;
  color: var(--ink); text-decoration: none; box-shadow: var(--sh-1); transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s; }
a.mod:hover, a.mod:focus-visible { transform: translateY(-3px); box-shadow: var(--sh-2); border-color: color-mix(in srgb, var(--md) 35%, transparent); }
.mod .mt { background: linear-gradient(135deg, color-mix(in srgb, var(--mc) 70%, #fff), var(--cream)); padding: 24px 22px 18px; display: flex; align-items: center; gap: 14px; }
.mod .mi { width: 56px; height: 56px; border-radius: 18px; background: #fff; display: grid; place-items: center; font-size: 1.8rem; box-shadow: var(--sh-1); flex: none; }
.mod h3 { margin: 0; font-size: 1.2rem; color: var(--md); }
.mod .st { display: block; font: 700 var(--fs-xs) var(--f-head); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-top: 2px; }
.mod p { margin: 0 22px; font-size: .95rem; color: var(--ink-2); flex: 1; }
.mod .go { margin: 6px 22px 0; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; background: var(--md); color: #fff; border-radius: 999px; padding: 10px 20px; font: 700 .9rem var(--f-head); transition: gap .25s var(--ease); }
a.mod:hover .go { gap: 12px; }
.mod .go .i { width: 18px; height: 18px; }
.mod.soon { border-style: dashed; background: var(--cream); box-shadow: none; opacity: .85; }
.mod.soon .mt { background: #f6f0f8; }
.mod.soon .go { background: var(--purpleg); }
.backhub { display: inline-block; margin: 4px 0 8px; font-size: .85rem; }

/* campos: mesma altura para texto, data e lista (data e mês eram mais altos) */
input[type=text], input[type=email], input[type=password], input[type=date], input[type=datetime-local], input[type=number], input[type=url], input[type=search], input[type=month], input[type=tel], input[type=time], select { height: 46px; }
.hint { display: block; margin-top: 4px; font-size: .8rem; color: var(--muted); line-height: 1.35; }
.btn.ghost.danger { background: transparent; color: var(--st-bad); border-color: color-mix(in srgb, var(--st-bad) 40%, transparent); box-shadow: none; }
.btn.ghost.danger:hover { background: var(--st-bad-soft); }

/* pop-up (core/modal.js) */
dialog.modal { border: 0; padding: 0; border-radius: var(--r-xl); width: min(600px, calc(100% - 24px)); max-height: calc(100dvh - 32px); background: var(--paper); color: var(--ink); box-shadow: var(--sh-2); overflow: auto; overscroll-behavior: contain; }
dialog.modal.wide { width: min(880px, calc(100% - 24px)); }
dialog.modal::backdrop { background: rgba(64, 41, 74, .45); backdrop-filter: blur(2px); }
dialog.modal[open] { animation: modal-in .22s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
.modal-h { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 20px clamp(18px, 3vw, 28px) 12px; background: var(--paper); border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-size: 1.25rem; }
.modal-x { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: var(--blush); color: var(--coral-ink); display: grid; place-items: center; cursor: pointer; }
.modal-x:hover { background: var(--pink); }
.modal-b { padding: 18px clamp(18px, 3vw, 28px) 24px; }
.modal-acts { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; margin-top: 8px; }
fieldset.grp { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
fieldset.grp > legend { padding: 0; margin-bottom: 10px; font: 700 var(--fs-xs) var(--f-head); letter-spacing: .12em; text-transform: uppercase; color: var(--purple-d); }
details.grp { margin: 0 0 18px; }
details.grp > summary { cursor: pointer;  font: 700 var(--fs-xs) var(--f-head); letter-spacing: .12em; text-transform: uppercase; color: var(--purple-d); margin-bottom: 10px; }

/* resumo dos programas (Semeando Sabores, Sementinhas, Terra Fértil): atenção, 3 indicadores, números recolhidos */
.pg-sum { display: grid; gap: 16px; margin: 0 0 24px; }
.pg-sum .card { margin: 0; }
.pg-atts { display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); align-items: start; }
.pg-a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border-radius: 14px; background: var(--st-info-soft); color: var(--ink); text-decoration: none; font-weight: 600; transition: transform .2s var(--ease), box-shadow .2s; }
a.pg-a:hover { transform: translateY(-1px); box-shadow: var(--sh-1); }
.pg-a span { flex: 1; } .pg-a .i { width: 18px; height: 18px; color: var(--muted); }
.pg-a.bad { background: var(--st-bad-soft); box-shadow: inset 4px 0 0 var(--st-bad); }
.pg-a.warn { background: var(--st-warn-soft); box-shadow: inset 4px 0 0 var(--st-warn-line); }
.pg-ok { display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 14px; background: var(--st-ok-soft); color: var(--st-ok); font-weight: 700; }
.pg-ok .i { width: 20px; height: 20px; }
.pg-kpis { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 620px) { .pg-kpis { grid-template-columns: 1fr; } }
.pg-kpi { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-md); text-decoration: none; color: inherit; }
a.pg-kpi:hover { box-shadow: var(--sh-1); }
.pg-kpi b { font: 700 1.6rem/1.1 var(--f-head); font-variant-numeric: tabular-nums; }
.pg-kpi span { color: var(--ink-2); font-size: .9rem; } .pg-kpi small { color: var(--muted); font-size: .8rem; }
.pg-num > summary { cursor: pointer; font: 700 1rem var(--f-head); }
.pg-num[open] > summary { margin-bottom: 14px; }
.pg-num-g { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.pg-num-g .card { box-shadow: none; background: var(--cream); }
.pg-list { list-style: none; margin: 0; padding: 0; } .pg-list li { padding: 6px 0; border-bottom: 1px solid var(--line); } .pg-list li:last-child { border: 0; }
.pg-bar { display: grid; grid-template-columns: 140px 1fr 30px; gap: 8px; align-items: center; margin: 5px 0; }
.pg-bar i { display: block; height: 10px; border-radius: 99px; background: var(--st-info-soft); overflow: hidden; }
.pg-bar i b { display: block; height: 100%; border-radius: 99px; background: var(--purpleg); }
.pg-bar > span:last-child { text-align: right; }
/* tabela de pacientes por programa */
.pg-table { overflow-x: auto; padding: 0; }
.pg-table table { min-width: 720px; }
.pg-table th, .pg-table td { padding: 12px 14px; vertical-align: middle; }
.pg-table tbody tr:hover { background: var(--blush); }
.pg-table td:last-child { text-align: right; white-space: nowrap; }

/* chave liga/desliga (ex.: acompanhamento presencial) */
.sw { display:flex;gap:12px;align-items:flex-start;margin:0;cursor:pointer;font-weight:400 }
.sw input { position:absolute;opacity:0;width:1px;height:1px }

.sw-t { flex:none;position:relative;width:46px;height:28px;border-radius:999px;background:color-mix(in srgb,var(--ink) 22%,transparent);transition:background-color .2s }

.sw-t::after { content:"";position:absolute;top:3px;left:3px;width:22px;height:22px;border-radius:50%;background:#fff;box-shadow:0 1px 3px rgba(0,0,0,.25);transition:transform .2s var(--ease) }

.sw input:checked+.sw-t { background:var(--purple-d) }
.sw input:checked+.sw-t::after { transform:translateX(18px) }

.sw input:focus-visible+.sw-t { outline:3px solid color-mix(in srgb,var(--purple-d) 55%,transparent);outline-offset:2px }

.sw b { display:block;font-family:var(--f-head,inherit) }
.sw small { display:block;color:var(--muted);font-size:.84rem;line-height:1.35 }

/* ficha da criança (nutri): abas agrupadas e resumo */
.ch-tabs { display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 4px 0 18px; padding: 10px 14px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--r-lg); }
.ch-g { display: flex; flex-direction: column; gap: 6px; }
.ch-gl { font: 700 var(--fs-xs) var(--f-head); letter-spacing: .12em; text-transform: uppercase; color: var(--purple-d); padding-left: 4px; }
.ch-gt { display: flex; flex-wrap: wrap; gap: 4px; }
.ch-gt a { padding: 7px 14px; border-radius: 999px; font: 700 .9rem var(--f-head); color: var(--ink-2); text-decoration: none; transition: background-color .2s, color .2s; }
.ch-gt a:hover { background: var(--blush); color: var(--coral-ink); }
.ch-gt a.on { background: var(--ink); color: #fff; }
.ch-res { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr)); align-items: start; }
.ch-res .card { margin: 0; }
.ch-dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.ch-dl dt { color: var(--muted); font-size: .88rem; } .ch-dl dd { margin: 0; }
@media (max-width: 760px) {
  /* no celular a tabela vira uma lista de cartões (sem rolagem de lado) */
  .pg-table table { min-width: 0; }
  .pg-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .pg-table tr { display: block; padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .pg-table td { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border: 0; text-align: right; }
  .pg-table td:first-child { display: block; text-align: left; padding-bottom: 6px; }
  .pg-table td[data-l]::before { content: attr(data-l); color: var(--muted); font-size: .85rem; text-align: left; }
  .pg-table td:last-child { display: block; text-align: left; padding-top: 8px; }
}

/* menus "⋯" e grupos recolhíveis: sem a borda que o CSS base põe em todo <details> */
details.cs-more, details.tr-more, details.grp { border-top: 0; padding: 0; }

/* ================= responsivo: regras de base (valem para o app inteiro) ================= */
/* textos longos (e-mails, nomes de alimentos, títulos de materiais) quebram em vez de empurrar a tela */
p, li, dd, dt, h1, h2, h3, h4, label, legend, figcaption, .card b, .card strong, .chip, .btn { overflow-wrap: anywhere; }
.fi-id { min-width: 0; flex: 1 1 240px; }
/* imagens nunca maiores que o contêiner */
img { max-width: 100%; } img:not([height]) { height: auto; }
/* tabelas: rolagem própria, com sombra quando há mais conteúdo para o lado */
.tscroll { overflow-x: auto; max-width: 100%;
  background: linear-gradient(90deg, var(--paper, #fff) 30%, rgba(255, 255, 255, 0)) 0 0 / 40px 100% no-repeat local,
    linear-gradient(270deg, var(--paper, #fff) 30%, rgba(255, 255, 255, 0)) 100% 0 / 40px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(74, 50, 82, .2), transparent) 0 0 / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(74, 50, 82, .2), transparent) 100% 0 / 14px 100% no-repeat scroll; }
@media (max-width: 599px) {
  table.rt, table.rt tbody, table.rt tr, table.rt td { display: block; width: 100%; }
  table.rt thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.rt tr { padding: 10px 14px; margin: 0 0 10px; border: 1px solid var(--line); border-radius: var(--r-md, 14px); background: var(--paper); }
  table.rt td { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  table.rt td::before { content: attr(data-label); font-weight: 700; color: var(--muted); text-align: left; flex: none; max-width: 45%; }
  table.rt td[data-label=""]::before { content: none; }
  .tscroll { background: none; }
}
/* celular e tablet (telas de toque, até 1099 px): texto mínimo de 13 px e áreas de toque de 40 px */
@media (max-width: 1099px) {
  /* !important só aqui: o mínimo de leitura vale mesmo onde a regra do componente é mais específica */
  small, .small, .badge, .chip, .eyebrow, th, .tag, .fi-age, .fi-seal, .db-sub, .ci-chip, .jg-chip, .jg-tag, .ph, .fx-day,
  .fc-who, .fc-ev, .msg .t, .db-k .s, .mt-new, .mt-use, .mc-hint, .ev-heads span, .tt-leg span, .tt-lv { font-size: max(13px, .82em) !important; }
  .esc-lv { font-size: 13px !important; }
  .eyebrow, .ap-mod .tag { letter-spacing: .06em; }
  /* links de texto: área de toque maior sem mudar o desenho da linha */
  main a:not([class]), main a.small, .ap-sec a, .card-h a, a.pc-name, a.db-mod, .ap-recado a, .db-card h2 a, .fs-ctx a, .fs-side a:not([class]) { padding-block: 10px; }
  .db-card h2 a { padding-inline: 6px; }
  .fs-bar-me { width: 44px; height: 44px; display: grid; place-items: center; } .fs-bar-me .av, .fs-bar-me img { width: 40px; height: 40px; }
  .fx-step { width: 40px; height: 40px; }
}
@media (max-width: 767px) {
  /* formulários: botão principal na linha toda; grupos de opções quebram linha */
  form > .btn[type=submit], form .acts > .btn, .stack > .btn[type=submit] { width: 100%; justify-content: center; }
  .chips, .pick, .opts { flex-wrap: wrap; }
}

/* faixa "sem internet" (main.js) */
.offline-bar { position: fixed; left: 50%; bottom: calc(12px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; width: min(560px, calc(100vw - 24px));
  background: #3b2b3a; color: #fff; border-radius: 14px; padding: 10px 14px; font: 600 .875rem/1.35 var(--f-body); box-shadow: 0 6px 18px rgba(0, 0, 0, .25); text-align: center; }
.offline-bar[hidden] { display: none; }
@media print { .offline-bar { display: none !important; } }

/* R12: no celular, o formulário de entrar/criar conta aparece sem rolar (topo compacto: marca e frase; sem foto e parágrafo) */
@media (max-width: 640px) {
  .auth-entry .hero { padding: 10px 4px 6px; }
  .auth-entry .hero .brandbar img.bl { height: 64px; }
  .auth-entry .hero .avatar, .auth-entry .hero > p:not(.bc-name) { display: none; }
  .auth-entry .hero h1 { font-size: 1.5rem; margin-top: 6px !important; }
}
