/* ============ Rastreio — sistema de design ============
   Inspirado em "Morrow" (Al Helal Hadi, Behance): papel quente, pastéis, ilustrações a traço de tinta,
   títulos em serifa, muito espaço negativo, uma ação principal por cartão. */

:root {
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;

  --bg: #f7f0ec; --card: #ffffff; --ink: #1e1512; --muted: #7b6b64; --line: #ecdfd8; --field: #fbf6f3;
  --accent: #a8142f; --on-accent: #ffffff;
  --dark: #1e1512; --on-dark: #f8efea;
  --track: rgba(30, 21, 18, .09);
  --shadow: 0 10px 30px rgba(86, 40, 30, .12);

  --peach: #ffdac5;  --peach-d: #e6a07c;
  --rose: #f9cfd2;   --rose-d: #d9707c;
  --butter: #fbe9b9; --butter-d: #d4a233;
  --sage: #dde8d4;   --sage-d: #7da36a;
  --mist: #d9e7f0;   --mist-d: #5f93b5;
  --lilac: #e6ddf3;  --lilac-d: #8f7cbf;

  --ok: #3f7a4f; --ok-bg: #dde8d4; --warn: #8a5a12; --warn-bg: #fbe9b9; --bad: #9b2335; --bad-bg: #f9cfd2;
  --red: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #181110; --card: #241a17; --ink: #f6ece7; --muted: #aa9a92; --line: #3a2b28; --field: #2b201d;
    --accent: #e5506b; --on-accent: #1e0d10;
    --dark: #f1e5df; --on-dark: #1e1512;
    --track: rgba(246, 236, 231, .12);
    --shadow: 0 10px 30px rgba(0, 0, 0, .45);
    --peach: #4b3027;  --peach-d: #e29a78;
    --rose: #4d2a30;   --rose-d: #e77f8b;
    --butter: #4a3f22; --butter-d: #e0b64a;
    --sage: #2e3d2b;   --sage-d: #94bb80;
    --mist: #263644;   --mist-d: #7db0d1;
    --lilac: #36304b;  --lilac-d: #a894d6;
    --ok: #a9d29a; --ok-bg: #2e3d2b; --warn: #f1d28a; --warn-bg: #4a3f22; --bad: #f2a3ad; --bad-bg: #4d2a30;
    --red: #f2a3ad;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 16px/1.45 var(--sans); min-height: 100vh; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
h1 { font: 500 38px/1.05 var(--serif); letter-spacing: -.02em; }
h2 { font: 500 21px/1.15 var(--serif); letter-spacing: -.01em; }
h3 { font: 500 18px/1.2 var(--serif); }
.muted { color: var(--muted); font-size: 14px; }
.small { font-size: 12px; }
.err { color: var(--red); font-size: 14px; min-height: 1.2em; }
.eyebrow { font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.ok { color: var(--ok); }
.low { color: var(--warn); }
@media (prefers-color-scheme: dark) { .low { color: var(--warn); } }

/* ---------- ilustrações ---------- */
.illo { display: grid; place-items: center; overflow: hidden; }
.illo img { width: 100%; height: 100%; object-fit: contain; mix-blend-mode: multiply; }
.illo-fb { width: 58%; height: 58%; color: var(--ink); opacity: .5; }
@media (prefers-color-scheme: dark) { .illo img { filter: invert(1); mix-blend-mode: screen; } }

/* tons pastel reutilizados por tiles, cartões e barras */
.tone-peach { --tone: var(--peach); --tone-d: var(--peach-d); }
.tone-rose { --tone: var(--rose); --tone-d: var(--rose-d); }
.tone-butter { --tone: var(--butter); --tone-d: var(--butter-d); }
.tone-sage { --tone: var(--sage); --tone-d: var(--sage-d); }
.tone-mist { --tone: var(--mist); --tone-d: var(--mist-d); }
.tone-lilac { --tone: var(--lilac); --tone-d: var(--lilac-d); }

/* ---------- login ---------- */
#login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--peach); }
#loginForm, #resetForm, #inviteForm { width: 100%; max-width: 340px; display: grid; gap: 14px; text-align: center; }
#loginArt, #resetArt { width: 220px; height: 170px; margin: 0 auto -6px; }
#loginArt .illo, #resetArt .illo { width: 100%; height: 100%; }
.lede { color: var(--muted); font-size: 15px; }
#login input { text-align: center; }
#login .muted { margin: 0; }

/* ---------- estrutura ---------- */
#app { padding-bottom: calc(168px + env(safe-area-inset-bottom)); }
#view { max-width: 560px; margin: 0 auto; padding: calc(14px + env(safe-area-inset-top)) 18px 24px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
#view > * { min-width: 0; }

#tabs {
  position: fixed; left: 16px; right: 16px; bottom: calc(12px + env(safe-area-inset-bottom)); max-width: 528px; margin: 0 auto;
  display: flex; gap: 4px; padding: 6px; background: var(--card); border-radius: 30px; box-shadow: var(--shadow); z-index: 6;
}
#tabs button {
  flex: 1; min-height: 54px; border: 0; border-radius: 24px; background: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font: 600 11px/1 var(--sans);
}
#tabs button b { font-weight: 600; }
#tabs button.on { background: var(--rose); color: var(--ink); }
#tabs button { position: relative; min-width: 0; }
#tabs button.dot::after { content: ''; position: absolute; top: 9px; left: calc(50% + 7px); width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--card); }

#dock {
  position: fixed; left: 16px; right: 16px; bottom: calc(90px + env(safe-area-inset-bottom)); max-width: 528px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-radius: 22px; z-index: 5;
  background: var(--dark); color: var(--on-dark); box-shadow: var(--shadow); font-size: 13px;
}
#dock .dk { flex: 1; min-width: 0; display: grid; gap: 5px; }
#dock .dk span { display: flex; justify-content: space-between; gap: 8px; }
#dock b { font: 500 15px/1 var(--serif); }
#dock .mini { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .18); overflow: hidden; }
@media (prefers-color-scheme: dark) { #dock .mini { background: rgba(0, 0, 0, .15); } }
#dock .mini i { display: block; height: 100%; border-radius: 2px; background: var(--rose-d); }
#dock .dk.w .mini i { background: var(--mist-d); }
#dock .sep { width: 1px; align-self: stretch; background: currentColor; opacity: .18; }

.card { background: var(--card); border-radius: 24px; padding: 18px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; box-shadow: 0 1px 0 var(--line); }
.card.tone-peach, .card.tone-rose, .card.tone-butter, .card.tone-sage, .card.tone-mist, .card.tone-lilac { background: var(--tone); box-shadow: none; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-art { width: 56px; height: 56px; flex: none; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 6px 2px -4px; }

.daynav { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.daynav .title { flex: 1; font: 500 34px/1.05 var(--serif); letter-spacing: -.02em; }
.daynav .title::first-letter { text-transform: uppercase; }
.daynav .title small { display: block; font: 400 14px/1.3 var(--sans); letter-spacing: 0; color: var(--muted); margin-top: 4px; }
.daynav .nav-btns { display: flex; gap: 8px; }

/* ---------- botões ---------- */
.btn {
  min-height: 48px; padding: 0 20px; border-radius: 999px; border: 1px solid var(--line); background: var(--card);
  color: var(--ink); font: 600 15px/1 var(--sans); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.danger { color: var(--red); }
.btn.small { min-height: 44px; min-width: 44px; padding: 0 14px; font-size: 14px; }
.btn:disabled { opacity: .45; }
.round {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.round.dark { background: var(--dark); border-color: var(--dark); color: var(--on-dark); }
.round:disabled { opacity: .35; }

/* ---------- Hoje ---------- */
.badge { align-self: start; justify-self: start; font-size: 13px; font-weight: 600; background: var(--rose); color: var(--ink); border-radius: 999px; padding: 7px 14px; }

.hero { position: relative; min-height: 236px; padding: 20px; border-radius: 28px; background: var(--tone); display: grid; align-content: space-between; overflow: hidden; box-shadow: none; }
.hero .pill { justify-self: start; font-size: 12px; font-weight: 600; background: var(--card); border-radius: 999px; padding: 6px 12px; position: relative; z-index: 1; }
.hero p { font: 500 24px/1.18 var(--serif); letter-spacing: -.015em; max-width: 52%; position: relative; z-index: 1; }
/* a metade esquerda das cenas é em branco (some pelo multiply): a imagem ocupa o cartão todo e o texto fica por cima */
.hero .hero-art { position: absolute; right: 0; bottom: 0; width: 80%; height: 100%; }
.hero .hero-art img { object-position: right bottom; }

.next { gap: 14px; }
.next .next-row { display: flex; align-items: center; gap: 14px; }
.tile { width: 64px; height: 64px; flex: none; border-radius: 20px; background: var(--tone); display: grid; place-items: center; overflow: hidden; }
.tile .illo { width: 100%; height: 100%; }

.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.stat { position: relative; background: var(--tone); border-radius: 22px; padding: 16px; display: grid; gap: 6px; min-height: 118px; align-content: start; overflow: hidden; }
.stat.wide { grid-column: span 2; min-height: 96px; }
.stat .label { font-size: 13px; font-weight: 600; opacity: .75; }
.stat .val { font: 500 28px/1 var(--serif); letter-spacing: -.02em; position: relative; z-index: 1; display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; }
.stat .val small { font: 400 13px/1 var(--sans); opacity: .65; letter-spacing: 0; }
.stat .hint { font-size: 12px; opacity: .7; }
/* sem opacity aqui: ela isolaria o mix-blend-mode e deixaria um quadrado branco atrás do desenho */
.stat .stat-art { position: absolute; right: 4px; top: 4px; width: 54px; height: 54px; }
.bar { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--tone-d); border-radius: 3px; }
.bar.t-rose { --tone-d: var(--rose-d); } .bar.t-mist { --tone-d: var(--mist-d); } .bar.t-sage { --tone-d: var(--sage-d); }
.bar.t-butter { --tone-d: var(--butter-d); } .bar.t-peach { --tone-d: var(--peach-d); }

.slot { background: var(--card); border-radius: 24px; padding: 14px 16px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; box-shadow: 0 1px 0 var(--line); }
.slot.done { background: var(--card); }
.slot-head { display: flex; align-items: center; gap: 12px; }
.slot-head .tile { width: 56px; height: 56px; border-radius: 18px; }
.slot-head h3 { font-size: 18px; }
.slot-head .acts { display: flex; gap: 8px; flex: none; }
.meal { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; border: 0; background: var(--field); border-radius: 18px; padding: 8px 12px 8px 8px; color: inherit; font: inherit; cursor: pointer; min-height: 56px; }
.thumb { width: 44px; height: 44px; border-radius: 14px; background: var(--line); object-fit: cover; flex: none; }
.meal .d { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bottle { background: rgba(255, 255, 255, .55); border-radius: 18px; padding: 12px 14px; display: grid; gap: 10px; }
@media (prefers-color-scheme: dark) { .bottle { background: rgba(0, 0, 0, .18); } }
.item { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 48px; font-size: 15px; border-top: 1px solid rgba(0, 0, 0, .07); }
@media (prefers-color-scheme: dark) { .item { border-top-color: rgba(255, 255, 255, .08); } }
.item:first-of-type { border-top: 0; }
.item.check { cursor: pointer; }
.item.check input { width: 26px; height: 26px; accent-color: var(--accent); }

/* suplementos: nome abre o formulário; um checkbox (área de toque de 44 px) por dose */
.item.sup { align-items: center; padding: 4px 0; }
.sup-name { display: flex; align-items: center; width: 100%; min-height: 44px; border: 0; background: none; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
div.sup-name { cursor: default; }
.sup-tag { margin: 0 0 4px; font-weight: 500; }
.doses { display: flex; flex: none; }
.dose { display: grid; place-items: center; min-width: 44px; min-height: 44px; cursor: pointer; }
.dose input { width: 26px; height: 26px; accent-color: var(--accent); }
.suplink { display: flex; align-items: center; gap: 6px; margin-left: auto; min-height: 44px; padding: 0 4px; border: 0; background: none; color: var(--accent); font: 600 14px var(--sans); cursor: pointer; }
.sup-week { display: grid; gap: 2px; padding: 8px 0; }
.sub.off { opacity: .6; }

/* ---------- chips, avisos, análises ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: var(--track); }
.chip.conf-alta, .chip.st-ok { background: var(--ok-bg); color: var(--ok); }
.chip.conf-media, .chip.st-warn { background: var(--warn-bg); color: var(--warn); }
.chip.conf-baixa { background: var(--bad-bg); color: var(--bad); }
.chip.st-na { background: var(--track); color: var(--muted); }
.chip.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 14px; }
.chip.tag .x { border: 0; background: none; color: var(--muted); font-size: 18px; min-width: 28px; min-height: 28px; cursor: pointer; }
.notice { font-size: 14px; background: var(--warn-bg); color: var(--warn); border-radius: 14px; padding: 10px 12px; }
.question { display: grid; gap: 8px; background: var(--sage); border-radius: 16px; padding: 12px 14px; }
.question input { min-height: 46px; padding: 8px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--ink); font: inherit; font-size: 16px; }
.rv { display: grid; gap: 10px; }
.rv p { margin: 0; }
.rv-head { font: 500 19px/1.25 var(--serif); }
.doctor { background: var(--rose); color: var(--ink); border-radius: 16px; padding: 10px 14px; font-size: 14px; }
.bul { margin: 2px 0 0; padding-left: 20px; font-size: 15px; }
details.hist { border-top: 1px solid var(--line); padding: 8px 0; }
details > summary { cursor: pointer; min-height: 32px; }
.review { white-space: pre-wrap; font-size: 15px; }

.item-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); }
.item-row .d { white-space: normal; }
.portion { display: flex; align-items: center; gap: 4px; font-size: 14px; color: var(--muted); }
.portion input { width: 76px; min-height: 46px; padding: 6px 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--field); color: var(--ink); font: inherit; font-size: 16px; }

/* check-in */
.ck { display: grid; gap: 8px; }
.segs { display: flex; gap: 6px; }
.seg { flex: 1; min-height: 46px; border-radius: 16px; border: 0; background: rgba(255, 255, 255, .6); color: var(--ink); font: 600 15px var(--sans); cursor: pointer; }
.card:not([class*="tone-"]) .seg { background: var(--field); }
@media (prefers-color-scheme: dark) { .seg { background: rgba(0, 0, 0, .2); } }
.seg.on { background: var(--accent) !important; color: var(--on-accent); }

/* ---------- campos e folhas ---------- */
input[type=text], input[type=number], input[type=time], input[type=date], input[type=password], select, textarea { font-size: 16px; }
.field { display: grid; gap: 6px; font-size: 14px; color: var(--muted); font-weight: 500; }
.field input, .field textarea, .field select, #login input, .inp, .secbody input[type=text], .secbody input[type=number], .secbody input[type=time], .secbody select {
  width: 100%; min-height: 48px; padding: 8px 14px; border-radius: 16px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font: inherit; font-size: 16px;
}
#login input { background: var(--card); }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.preview { width: 100%; max-height: 220px; object-fit: cover; border-radius: 20px; }

#sheet { position: fixed; inset: 0; background: rgba(30, 15, 12, .45); z-index: 20; display: flex; align-items: flex-end; justify-content: center; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
#sheet .panel {
  position: relative; background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto;
  border-radius: 30px 30px 0 0; padding: 26px 20px calc(20px + env(safe-area-inset-bottom)); display: grid; gap: 14px;
}
#sheet .panel::before { content: ""; position: absolute; top: 9px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 2px; background: var(--line); }

#spinner { position: fixed; inset: 0; background: rgba(30, 15, 12, .55); z-index: 30; display: grid; place-content: center; justify-items: center; gap: 14px; color: #fff; -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.spin { width: 42px; height: 42px; border-radius: 50%; border: 4px solid rgba(255, 255, 255, .3); border-top-color: #fff; animation: r .8s linear infinite; }
@keyframes r { to { transform: rotate(360deg); } }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(160px + env(safe-area-inset-bottom)); background: var(--dark); color: var(--on-dark); padding: 12px 18px; border-radius: 18px; z-index: 40; font-size: 14px; max-width: 90vw; box-shadow: var(--shadow); }

/* ---------- Água (registro direto) e aviso com "Desfazer" ---------- */
.stepper { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.water-big { font: 500 52px/1 var(--serif); letter-spacing: -.02em; text-align: center; flex: 1; }
.water-big small { font: 400 16px/1 var(--sans); opacity: .7; letter-spacing: 0; }
.wlist { display: flex; flex-wrap: wrap; gap: 8px; }
.wlist .btn { font-weight: 500; }
.toast-undo { border: 0; background: none; color: inherit; font: 600 14px var(--sans); text-decoration: underline; min-height: 44px; min-width: 44px; padding: 0 4px 0 8px; margin: -12px -8px -12px 0; cursor: pointer; }

/* ---------- Sono ---------- */
/* .sleep-sum e .sleep-rate reaproveitam o painel .bottle; aqui só o que muda */
.sleep-sum { gap: 4px; width: 100%; text-align: left; border: 0; color: inherit; font: inherit; cursor: pointer; }
.sleep-big { font: 500 36px/1 var(--serif); letter-spacing: -.02em; }
.sleep-big small { font: 400 14px/1 var(--sans); opacity: .7; letter-spacing: 0; }
/* números do Painel (só dentro do cartão do sono, para não afetar outras grades) */
.card.tone-lilac .grid3 > div { display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.card.tone-lilac .grid3 .sleep-big { font-size: 26px; display: block; }
.card.tone-lilac .grid3 .muted { font-size: 12px; }
.stars { display: flex; gap: 0; }
.star { border: 0; background: none; font-size: 30px; line-height: 1; min-width: 44px; min-height: 44px; color: var(--muted); opacity: .4; cursor: pointer; padding: 0; }
.star.on { color: var(--butter-d); opacity: 1; }
.stars.ro .star { min-width: 26px; min-height: 26px; font-size: 20px; cursor: default; pointer-events: none; }
.sleep-rate { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 14px; padding-top: 6px; padding-bottom: 6px; }
.linkbtn { border: 0; background: none; color: var(--muted); font: 500 14px var(--sans); text-decoration: underline; min-height: 44px; cursor: pointer; padding: 0 4px; }

/* ---------- Painel ---------- */
.chart { display: grid; gap: 8px; }
.bars { position: relative; display: flex; align-items: flex-end; gap: 7px; height: 118px; }
.bars .col { flex: 1; display: grid; align-items: end; height: 100%; }
.bars .col i { display: block; background: var(--rose-d); border-radius: 8px 8px 3px 3px; min-height: 3px; }
.bars.blue .col i { background: var(--mist-d); }
.bars.amber .col i { background: var(--peach-d); }
.bars.lilac .col i { background: var(--lilac-d); }
.bars .goal { position: absolute; left: 0; right: 0; border-top: 2px dashed var(--muted); opacity: .6; pointer-events: none; }
.labels { display: flex; gap: 7px; font-size: 11px; color: var(--muted); text-align: center; }
.labels span { flex: 1; }

/* ---------- Ajustes ---------- */
.sec > summary { list-style: none; min-height: 44px; display: flex; align-items: center; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary h2::after { content: ' ▾'; color: var(--muted); font-size: 16px; }
.secbody { display: grid; gap: 12px; margin-top: 8px; }
.sub { display: grid; gap: 10px; border: 1px solid var(--line); border-radius: 20px; padding: 12px; }
.savebar { position: sticky; bottom: calc(92px + env(safe-area-inset-bottom)); display: flex; padding: 8px 0; z-index: 4; }
.savebar:has(button:disabled) { display: none; } /* só aparece quando há alterações para salvar */

/* ---------- relatório para a médica: sempre claro, imprimível em A4 ---------- */
#report { --bg: #fff; --card: #fff; --ink: #111; --muted: #555; --line: #ccc; --field: #fff; --accent: #15803d; --on-accent: #fff; --track: rgba(0,0,0,.1);
  --serif: ui-serif, Georgia, serif;
  position: fixed; inset: 0; z-index: 50; background: #fff; color: #111; overflow: auto; padding: calc(12px + env(safe-area-inset-top)) 16px 40px; }
.rp-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.rp-doc { max-width: 760px; margin: 0 auto; display: grid; gap: 14px; font-size: 14px; }
.rp-doc h2 { font-size: 20px; margin-bottom: 4px; }
.rp-doc h3 { font: 700 15px/1.2 var(--sans); border-bottom: 2px solid #111; padding-bottom: 2px; margin: 0 0 6px; }
.rp-sec { break-inside: avoid; }
.rp-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.rp-t th, .rp-t td { border: 1px solid #bbb; padding: 4px 6px; text-align: left; vertical-align: top; }
.rp-t th { background: #eee; }
.rp-alert { margin-top: 8px; border: 1px solid #c2410c; background: #fff7ed; padding: 6px 10px; border-radius: 6px; }
.rp-alert ul, .rp-ver ul { margin: 2px 0 0; padding-left: 18px; }
.rp-ver { margin-bottom: 6px; }
.rp-foot { font-size: 12px; color: #555; border-top: 1px solid #ccc; padding-top: 6px; }
.rp-doc .bars { height: 70px; margin-top: 6px; }
.rp-doc .bars .col i { background: #444; }
@media print {
  body > :not(#report) { display: none !important; }
  #report { position: static; overflow: visible; padding: 0; }
  .noprint { display: none !important; }
  @page { size: A4; margin: 14mm; }
}

/* aba Análises */
.rvline { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 44px; padding: 8px 14px; border: 0; border-radius: 22px; background: var(--card); color: var(--ink); font: 500 14px/1.25 var(--sans); text-align: left; cursor: pointer; box-shadow: var(--shadow); }
.rvline.alert { background: var(--rose); }
.chip.filter { border: 0; min-height: 44px; padding: 0 14px; font-size: 14px; cursor: pointer; color: inherit; }
.chip.filter.on { background: var(--accent); color: var(--on-accent); }
.sched { padding-top: 4px; }
details.hist summary { cursor: pointer; display: grid; gap: 2px; min-height: 44px; align-content: center; }
.grid { display: grid; gap: 10px; }
.card-head .nav-btns { display: flex; gap: 8px; }

/* onboarding e perfil */
.ob { display: grid; gap: 14px; }
.ob-dots { display: flex; gap: 6px; }
.ob-dots i { flex: 1; height: 5px; border-radius: 3px; background: var(--track); }
.ob-dots i.on { background: var(--accent); }
.ob-body { display: grid; gap: 14px; }
.opts { gap: 8px; }
.opts-col { display: grid; gap: 8px; }
.chip.filter.wide { justify-content: flex-start; text-align: left; border-radius: 16px; padding: 10px 14px; height: auto; }

#inviteForm { width: 100%; max-width: 340px; display: grid; gap: 14px; text-align: center; margin: 0 auto; }
.loginArt { width: 220px; height: 170px; margin: 0 auto -6px; }
.loginArt .illo { width: 100%; height: 100%; }
.consent { display: flex; gap: 10px; align-items: flex-start; text-align: left; font-size: 14px; line-height: 1.4; cursor: pointer; }
.consent input { flex: none; width: 26px; height: 26px; accent-color: var(--accent); }
.consent a { color: var(--accent); }
.item.adm { gap: 10px; flex-wrap: wrap; padding: 8px 0; }
.row.wrap { flex-wrap: wrap; }
#login .consent input, #inviteForm .consent input { width: 26px; min-height: 0; padding: 0; flex: none; }

/* ---------- Tratamento (GLP-1): cartão, mapa de aplicação ---------- */
.glp1-main { display: grid; gap: 6px; width: 100%; min-height: 56px; text-align: left; border: 0; border-radius: 18px; padding: 12px 14px; background: rgba(255, 255, 255, .55); color: inherit; font: inherit; cursor: pointer; }
@media (prefers-color-scheme: dark) { .glp1-main { background: rgba(0, 0, 0, .18); } }
.glp1-line { font: 500 20px/1.2 var(--serif); letter-spacing: -.01em; }
.glp1-line b { font-weight: 600; }
.glp1-alert { font-size: 14px; background: var(--warn-bg); color: var(--warn); border-radius: 12px; padding: 8px 10px; } /* alerta discreto, sem vermelho */
.gmap-box { display: grid; gap: 8px; }
.gmap { width: 100%; max-width: 420px; margin: 0 auto; display: block; touch-action: manipulation; }
/* o desenho de fundo se funde ao cartão (fundo branco some); no escuro inverte, como as outras ilustrações */
.gmap .art { mix-blend-mode: multiply; }
@media (prefers-color-scheme: dark) { .gmap .art { filter: invert(1); mix-blend-mode: screen; } }
#report .gmap .art { filter: none; mix-blend-mode: multiply; }
.gmap .ed { font: 700 16px var(--sans); fill: var(--muted); }
.gmap .navel { fill: var(--track); stroke: var(--muted); stroke-width: 2; stroke-dasharray: 4 4; }
.gmap > text.gt { font: 600 11px var(--sans); fill: var(--muted); pointer-events: none; }
.gz { cursor: pointer; outline: none; }
.gz .base { fill: rgba(255, 255, 255, .001); stroke: rgba(120, 84, 72, .42); stroke-width: 1.6; stroke-dasharray: 5 4; }
@media (prefers-color-scheme: dark) { .gz .base { stroke: rgba(240, 200, 190, .45); } }
.gz:hover .base { stroke: var(--accent); }
.gz .heat { fill: var(--rose-d); pointer-events: none; }
.gz.sel .base { fill: rgba(168, 20, 47, .12); stroke: var(--accent); stroke-width: 4; stroke-dasharray: none; }
.gz.last .base { stroke: var(--ink); stroke-width: 2.6; stroke-dasharray: 7 5; }
.gz.last.sel .base { stroke: var(--accent); stroke-width: 5; stroke-dasharray: none; }
.gz.sug:not(.sel) .base { stroke: var(--sage-d); stroke-width: 4; }
.gz:focus-visible .base { stroke: var(--accent); stroke-width: 5; }
.gz .gt { font: 600 10px var(--sans); fill: var(--ink); pointer-events: none; }
.gz .gt.big { font: 700 22px var(--serif); }
.rp-maps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.rp-maps .gmap { max-height: 200px; }

/* ---------- Tour de boas-vindas ---------- */
#tour { position: fixed; inset: 0; z-index: 60; background: var(--bg); display: flex; flex-direction: column; gap: 12px; padding: calc(12px + env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) calc(16px + env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left)); overflow: auto; }
.tour-top { display: flex; align-items: center; gap: 12px; max-width: 420px; width: 100%; margin: 0 auto; }
.tour-top .ob-dots { flex: 1; }
.tour-skip { min-width: 64px; font-weight: 600; color: var(--ink); text-decoration: none; }
.tour-stage { flex: 1; display: grid; align-content: center; justify-items: center; gap: 14px; text-align: center; max-width: 420px; width: 100%; margin: 0 auto; }
.tour-art { width: 100%; max-width: 340px; min-height: 190px; display: grid; align-content: center; pointer-events: none; text-align: left; }
.tour-art .tour-illo { width: 220px; height: 170px; margin: 0 auto; }
.tour-art .tour-map { max-height: 140px; }
.tour-art .glp1-main { cursor: default; }
.tour-title { font: 500 32px/1.1 var(--serif); letter-spacing: -.02em; }
.tour-text { font-size: 16px; line-height: 1.4; color: var(--ink); }
.tour-nav { max-width: 420px; width: 100%; margin: 0 auto; }

/* campos de data e hora no iPhone: o Safari dá largura própria a eles e estourava o cartão (e centralizava o texto) */
.field, .ob-body > *, .sub > *, #sheet .panel > * { min-width: 0; }
.field > input, .field > select { min-width: 0; max-width: 100%; }
input[type=time], input[type=date], input[type=datetime-local] { -webkit-appearance: none; appearance: none; display: block; width: 100%; min-width: 0; max-width: 100%; text-align: left; }
input[type=time]::-webkit-date-and-time-value, input[type=date]::-webkit-date-and-time-value, input[type=datetime-local]::-webkit-date-and-time-value { text-align: left; min-height: 1.3em; }
