:root {
  --bg: #f5f7f6; --card: #ffffff; --text: #1f2a28; --muted: #5d6b68;
  --brand: #127a6b; --brand-soft: #e3f2ef; --border: #dde5e3;
  --ok: #1d8a4e; --ok-soft: #e4f5ea; --no: #b23b3b; --no-soft: #fbe9e9;
  --warn: #b07a10; --warn-soft: #fdf3dc; --orange: #f2762e;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
       background: var(--bg); color: var(--text); line-height: 1.5; padding-bottom: 56px; }
a { color: var(--brand); }
h1 { font-size: 1.5rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 20px 0 10px; }
.muted { color: var(--muted); }
.pequeno { font-size: .85rem; }
.oculto { display: none !important; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: #fff; color: var(--text); width: 100%; }
textarea { resize: vertical; }
label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 12px; }
label input, label select, label textarea { margin-top: 4px; font-weight: 400; }

.btn { display: inline-block; font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--brand);
  background: var(--brand); color: #fff; text-decoration: none; cursor: pointer; text-align: center; }
.btn.ghost { background: transparent; color: var(--brand); }
.btn.perigo { border-color: var(--no); color: var(--no); }
.btn.peq { padding: 5px 12px; font-size: .85rem; }
.btn.grande { display: block; padding: 14px; font-size: 1.05rem; margin-top: 16px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.icone { border: 1px solid var(--border); background: #fff; border-radius: 8px; width: 32px; height: 32px; cursor: pointer; font-size: 1rem; }
.icone.perigo { color: var(--no); }
.icone:disabled { opacity: .35; cursor: default; }
.acoes-linha { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.cartao { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 16px; margin-bottom: 16px; }
.grade2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grade3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.barra-titulo { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin: 8px 0 12px; }
.barra-titulo h1, .barra-titulo h2 { margin: 0; }
.selo { font-size: .78rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; white-space: nowrap; }
.selo.verde { background: var(--ok-soft); color: var(--ok); }
.selo.amarelo { background: var(--warn-soft); color: var(--warn); }
.selo.cinza { background: var(--border); color: var(--muted); }

/* início do protótipo */
.inicio { max-width: 760px; margin: 0 auto; padding: 32px 16px; }
.cartao-grande { display: flex; flex-direction: column; gap: 6px; background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 22px; text-decoration: none; color: var(--text); }
.cartao-grande:hover { border-color: var(--brand); }
.cartao-grande strong { font-size: 1.15rem; color: var(--brand); }
.emoji { font-size: 2rem; }
.roteiro li { margin-bottom: 6px; }

/* clínica */
.topo { display: flex; align-items: center; gap: 20px; background: var(--card); border-bottom: 1px solid var(--border);
  padding: 10px 20px; flex-wrap: wrap; }
.marca { display: flex; align-items: center; gap: 10px; }
.marca small { display: block; color: var(--muted); font-size: .78rem; }
.logo-ph { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 10px; border: 2px dashed #9bb8b2;
  color: #7a9a94; font-size: .62rem; font-weight: 700; letter-spacing: .05em; }
.logo-ph.peq { width: 30px; height: 30px; font-size: .5rem; border-width: 1.5px; }
.topo nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.topo nav a { padding: 7px 12px; border-radius: 8px; text-decoration: none; color: var(--text); font-weight: 500; }
.topo nav a.on { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.usuaria { color: var(--muted); font-size: .9rem; }
.conteudo { max-width: 1040px; margin: 0 auto; padding: 22px 20px; }
.numeros { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 8px; }
.numeros a { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px; text-decoration: none; color: var(--muted); }
.numeros strong { display: block; font-size: 1.8rem; color: var(--brand); }
.lista { list-style: none; padding: 0; margin: 0 0 16px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; }
.lista > li { border-bottom: 1px solid var(--border); }
.lista > li:last-child { border-bottom: 0; }
.lista > li > a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; text-decoration: none; color: var(--text); }
.lista > li > a:hover { background: var(--bg); }
.lista small { display: block; color: var(--muted); }
.lista .vazio, .lista > li.muted { padding: 14px 16px; }
.ficha-item { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
.nomes-ex { display: block; font-size: .82rem; color: var(--muted); }
.form-linha { display: grid; grid-template-columns: 1fr 1fr auto; gap: 12px; align-items: end; }
.form-linha label { margin: 0; }
.form-linha p { grid-column: 1 / -1; margin: 0; }
.filtros { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }

/* editor de ficha */
.editor { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.dias { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 8px; }
.dias > span { font-size: .9rem; font-weight: 600; margin-right: 6px; }
.dia { display: inline-flex; align-items: center; gap: 4px; margin: 0; padding: 5px 10px; border: 1px solid var(--border);
  border-radius: 99px; font-weight: 500; cursor: pointer; }
.dia input { width: auto; margin: 0; }
.dia:has(input:checked) { background: var(--brand-soft); border-color: var(--brand); color: var(--brand); }
.itens { list-style: none; padding: 0; margin: 0 0 14px; }
.itens > li { border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.item-topo { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.presc { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.presc label { margin: 0; font-weight: 500; font-size: .8rem; }
.picker { position: sticky; top: 12px; max-height: calc(100vh - 90px); overflow: auto; }
.picker h2 { margin-top: 0; }
.picker .filtros { grid-template-columns: 1fr; }
.lista-picker { list-style: none; padding: 0; margin: 0; }
.lista-picker button { width: 100%; text-align: left; font: inherit; background: none; border: 0; border-bottom: 1px solid var(--border);
  padding: 9px 4px; cursor: pointer; color: var(--text); }
.lista-picker button:hover { background: var(--brand-soft); }
.lista-picker strong { color: var(--brand); }
.lista-picker small { display: block; color: var(--muted); }

/* formulário de exercício */
.form-ex { max-width: 720px; }
fieldset { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin: 0 0 14px; }
legend { font-weight: 700; padding: 0 6px; }
.radio { display: flex; gap: 8px; align-items: center; font-weight: 500; margin-bottom: 6px; }
.radio input { width: auto; margin: 0; }
.sub { margin-left: 26px; }
.previa { max-width: 360px; margin-top: 8px; }
.erro { color: var(--no); font-weight: 600; min-height: 1em; }

/* mídia */
.midia { border-radius: 14px; overflow: hidden; background: var(--brand-soft); }
.midia svg { width: 100%; height: auto; display: block; }
.midia.video { aspect-ratio: 16 / 9; }
.midia.video iframe { width: 100%; height: 100%; border: 0; display: block; }
.video-ph { aspect-ratio: 16 / 9; display: grid; place-items: center; align-content: center; gap: 6px; text-align: center;
  background: linear-gradient(135deg, #2b3a3f, #18403a); color: #fff; }
.video-ph span { width: 58px; height: 40px; border-radius: 10px; background: #e53935; display: grid; place-items: center; font-size: 1.2rem; }
.video-ph small { opacity: .8; }

/* QR */
.qr-cartao { max-width: 320px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
#qr img, #qr canvas { margin: 0 auto; }

/* paciente: moldura de celular */
.celular-fundo { min-height: calc(100vh - 56px); display: grid; place-items: start center; padding: 24px 12px;
  background: radial-gradient(circle at 50% 0, #dfeeea, var(--bg)); }
.celular { width: 100%; max-width: 400px; min-height: 720px; background: var(--card); border: 10px solid #1f2a28; border-radius: 34px;
  overflow: hidden; display: flex; flex-direction: column; box-shadow: 0 20px 50px rgba(0, 0, 0, .18); }
.pac-topo { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--brand); color: #fff; }
.pac-topo .logo-ph { border-color: rgba(255, 255, 255, .6); color: #fff; }
.pac-corpo { flex: 1; padding: 16px; }
.pac-rodape { font-size: .72rem; color: var(--muted); text-align: center; padding: 10px 16px; border-top: 1px solid var(--border); }
.ola { margin: 4px 0 12px; font-size: 1.35rem; }
.rotulo { text-transform: uppercase; font-size: .72rem; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin: 16px 0 6px; }
.ficha-card { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border: 1px solid var(--border);
  border-radius: 14px; text-decoration: none; color: var(--text); margin-bottom: 8px; }
.ficha-card small { display: block; color: var(--muted); }
.ficha-card > span { font-size: 1.6rem; color: var(--brand); }
.ficha-card.hoje { background: var(--brand); color: #fff; border-color: var(--brand); }
.ficha-card.hoje small, .ficha-card.hoje > span { color: #e3f2ef; }
.busca-pac { margin-bottom: 6px; }
.lista-busca { list-style: none; padding: 0; margin: 0; }
.lista-busca li { padding: 8px 4px; border-bottom: 1px solid var(--border); }
.voltar { display: flex; justify-content: space-between; margin: 0 0 8px; font-size: .9rem; }
.voltar span { color: var(--muted); }
.prog { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 14px; }
.prog span { display: block; height: 100%; background: var(--brand); }
.nome-ex { margin: 0 0 10px; }
.presc-pac { font-size: 1.15rem; font-weight: 700; color: var(--brand); margin: 12px 0 6px; }
.passos { padding-left: 20px; margin: 6px 0; }
.passos li { margin-bottom: 4px; }
.cuidado { background: var(--warn-soft); border-radius: 10px; padding: 8px 12px; font-size: .92rem; }
.nav-ex { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; }
.nav-ex .btn { flex: 1; }
.bloqueio, .ativado { text-align: center; padding: 40px 8px; }
.bloqueio .emoji, .ativado .emoji { font-size: 3rem; }
.dica { background: var(--brand-soft); border-radius: 12px; padding: 12px; margin-top: 14px; font-size: .92rem; }

/* barra da simulação */
.demo-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center;
  background: #2b2f36; color: #e8ecef; padding: 9px 16px; font-size: .85rem; z-index: 10; }
.demo-bar a { color: #9ee6d8; }
.demo-bar button { font: inherit; background: #3d434c; color: #fff; border: 0; border-radius: 6px; padding: 4px 10px; cursor: pointer; }
.demo-bar-info { margin-left: auto; color: #ffd27a; }
.toast { position: fixed; left: 50%; bottom: 70px; transform: translateX(-50%); background: #1f2a28; color: #fff;
  padding: 10px 18px; border-radius: 10px; z-index: 20; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }

@media (max-width: 760px) {
  .editor, .grade2, .form-linha { grid-template-columns: 1fr; }
  .numeros { grid-template-columns: repeat(2, 1fr); }
  .filtros { grid-template-columns: 1fr; }
  .picker { position: static; max-height: none; }
  .celular { border: 0; border-radius: 0; min-height: 0; box-shadow: none; }
  .celular-fundo { padding: 0; }
  body { padding-bottom: 52px; }
  .topo { gap: 6px; padding: 8px 14px; }
  .topo nav { flex: 1 1 100%; flex-wrap: nowrap; overflow-x: auto; gap: 2px; margin: 0 -14px; padding: 0 14px 2px; scrollbar-width: none; }
  .topo nav a { white-space: nowrap; padding: 6px 10px; }
  .topo .usuaria { order: 2; margin-left: auto; }
  .topo nav { order: 3; }
  .demo-bar { flex-wrap: nowrap; overflow-x: auto; gap: 12px; padding: 8px 12px; font-size: .78rem; white-space: nowrap; scrollbar-width: none; }
  .demo-bar-info { margin-left: 0; }
}
@media print {
  body * { visibility: hidden; }
  .imprimir, .imprimir * { visibility: visible; }
  .imprimir { position: absolute; left: 0; top: 0; border: 0; }
}
