:root {
  --bg: #fbf6f1;
  --surface: #ffffff;
  --surface-2: #f6eee7;
  --ink: #2e2522;
  --muted: #8a7b73;
  --line: #efe5dc;
  --shadow: 0 1px 2px rgba(80, 50, 30, .05), 0 8px 24px rgba(80, 50, 30, .06);

  --left: #d9684f;
  --left-soft: #fce7e0;
  --right: #3f8a85;
  --right-soft: #dcefec;
  --xixi: #c48a0c;
  --xixi-soft: #fbf0d2;
  --coco: #8c5f42;
  --coco-soft: #f2e6db;
  --danger: #c2410c;

  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --display: "Fraunces", Georgia, serif;
  --body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171311;
    --surface: #221c19;
    --surface-2: #2b2420;
    --ink: #f5ede6;
    --muted: #a89a90;
    --line: #352c27;
    --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset;
    --left: #f08c74;
    --left-soft: #3f2620;
    --right: #6fb8b1;
    --right-soft: #1c3533;
    --xixi: #e8bc4a;
    --xixi-soft: #3a3016;
    --coco: #c99a78;
    --coco-soft: #34271d;
    --danger: #f97350;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; max-width: 100%; overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
body {
  background: var(--bg);
  color: var(--ink);
  font: 500 16px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  padding: env(safe-area-inset-top) 0 calc(env(safe-area-inset-bottom) + 24px);
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; padding: 0; }
input {
  font: inherit; font-weight: 600; width: 100%; margin-top: 8px; padding: 15px 16px;
  border-radius: var(--r-sm); border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink);
  outline: none; transition: border-color .15s;
}
input:focus { border-color: var(--ink); }
input::placeholder { color: var(--muted); font-weight: 500; }
label { display: block; font-weight: 700; font-size: .9rem; margin-bottom: 16px; }
h1, h2, h3 { margin: 0; }
.muted { color: var(--muted); }
body.busy .side, body.busy .diaper, body.busy .btn-stop { opacity: .55; pointer-events: none; }

.screen { max-width: 520px; margin: 0 auto; padding: 12px 16px 0; }
#main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------- botões ---------- */
.btn {
  display: block; width: 100%; padding: 16px; border-radius: var(--r-sm);
  font-weight: 800; font-size: 1rem; margin-top: 10px; transition: transform .08s;
}
.btn:active { transform: scale(.98); }
.btn-primary { background: var(--ink); color: var(--bg); }
.btn-ghost { background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--danger); border: 1.5px solid currentColor; }
.btn-link { display: block; margin: 10px auto 0; padding: 8px 12px; font-weight: 700; color: var(--ink); }
.btn-link.muted { color: var(--muted); font-weight: 600; }

/* ---------- boas-vindas ---------- */
.setup { min-height: calc(100dvh - 60px); display: flex; flex-direction: column; justify-content: center; gap: 18px; padding: 24px 16px; }
.brand { text-align: center; }
.brand-icon { width: 76px; height: 76px; border-radius: 22px; box-shadow: var(--shadow); }
.brand-name { font-family: var(--display); font-weight: 600; font-size: 2.4rem; line-height: 1.1; letter-spacing: -.02em; margin-top: 10px; }
.brand-tag { color: var(--muted); margin: 4px 0 0; font-size: 1.05rem; }
.sheet { background: var(--surface); border-radius: var(--r-lg); padding: 24px 20px 18px; box-shadow: var(--shadow); }
.invite { margin: 0 0 18px; font-size: 1.05rem; text-align: center; }
.invite strong { font-family: var(--display); font-weight: 600; font-size: 1.4rem; display: block; margin-top: 2px; }
.hint { color: var(--muted); font-size: .85rem; text-align: center; margin: 14px 0 0; }

/* ---------- topo ---------- */
.top { display: flex; justify-content: space-between; align-items: center; padding: 8px 2px 18px; }
.eyebrow { font-size: .78rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
#family-name { font-family: var(--display); font-weight: 600; font-size: 1.85rem; letter-spacing: -.02em; line-height: 1.15; }
.avatar {
  width: 46px; height: 46px; border-radius: 50%; background: var(--surface); box-shadow: var(--shadow);
  font-weight: 800; font-size: 1.05rem; display: grid; place-items: center; flex-shrink: 0;
}
.banner { background: var(--xixi-soft); color: var(--ink); border-radius: var(--r-sm); padding: 10px 14px; font-size: .85rem; margin-bottom: 14px; }

/* ---------- resumo ---------- */
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.stat { text-align: left; display: block; width: 100%; background: var(--surface); border-radius: var(--r-md); padding: 14px 16px; box-shadow: var(--shadow); min-width: 0; }
.stat-label { font-size: .78rem; font-weight: 700; color: var(--muted); }
.stat-value { font-family: var(--display); font-weight: 600; font-size: 1.45rem; letter-spacing: -.01em; margin-top: 2px; }
.stat-sub { font-size: .85rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- cartões ---------- */
.card { background: var(--surface); border-radius: var(--r-lg); padding: 18px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; min-height: 28px; }
.card-head h2 { font-family: var(--display); font-weight: 600; font-size: 1.3rem; }
.chip { font-size: .8rem; font-weight: 800; padding: 5px 11px; border-radius: 99px; background: var(--surface-2); }
.chip-E { background: var(--left-soft); color: var(--left); }
.chip-D { background: var(--right-soft); color: var(--right); }
.chip-soft { color: var(--muted); font-weight: 700; }

/* peitos */
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.side {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 26px 8px 22px; border-radius: var(--r-md); transition: transform .08s; position: relative;
}
.side:active { transform: scale(.96); }
.side-E { background: var(--left-soft); color: var(--left); }
.side-D { background: var(--right-soft); color: var(--right); }
.side-ring {
  width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--display); font-weight: 600; font-size: 2.4rem;
  background: var(--surface); box-shadow: 0 0 0 6px color-mix(in srgb, currentColor 14%, transparent);
}
.side-name { font-weight: 800; font-size: 1.05rem; }
.side.suggested::after {
  content: "próximo"; position: absolute; top: 10px; right: 10px;
  font-size: .68rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 99px; background: currentColor; color: var(--surface);
}
.side.suggested::after { color: var(--surface); background: var(--side-color); }
.side-E { --side-color: var(--left); }
.side-D { --side-color: var(--right); }

/* mamada em andamento */
.running { text-align: center; padding: 4px 0 0; --c: var(--left); --soft: var(--left-soft); }
.running[data-side="D"] { --c: var(--right); --soft: var(--right-soft); }
.running-side { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; color: var(--c); background: var(--soft); padding: 6px 14px; border-radius: 99px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: currentColor; animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.timer { font-weight: 800; font-size: 4.4rem; letter-spacing: -.03em; line-height: 1.05; margin-top: 14px; font-variant-numeric: tabular-nums; }
.running-meta { color: var(--muted); font-weight: 600; margin-top: 4px; }
.btn-stop { background: var(--c); color: #fff; font-size: 1.2rem; padding: 20px; margin-top: 20px; border-radius: var(--r-md); }
@media (prefers-color-scheme: dark) { .btn-stop { color: #171311; } }
.running-actions { display: flex; justify-content: space-between; margin-top: 4px; }
.running-actions .btn-link { margin: 6px 0 0; font-size: .92rem; }

/* fraldas */
.diapers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.diaper {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 4px;
  border-radius: var(--r-md); font-weight: 800; background: var(--surface-2); transition: transform .08s;
}
.diaper:active { transform: scale(.95); }
.diaper[data-kind="xixi"] { background: var(--xixi-soft); color: var(--xixi); }
.diaper[data-kind="coco"] { background: var(--coco-soft); color: var(--coco); }
.diaper[data-kind="ambos"] { background: linear-gradient(135deg, var(--xixi-soft) 50%, var(--coco-soft) 50%); color: var(--ink); }
.diaper-ico { font-size: 1.6rem; line-height: 1; height: 1.8rem; display: grid; place-items: center; }
.amount { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--line); animation: rise .2s ease-out; }
.amount-label { font-weight: 700; font-size: .9rem; margin-bottom: 8px; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--surface-2); padding: 4px; border-radius: var(--r-sm); }
.segmented button { padding: 11px 4px; border-radius: 10px; font-weight: 700; color: var(--muted); }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
@media (prefers-color-scheme: dark) { .segmented button.on { background: var(--line); } }

/* linha do tempo */
.timeline { margin-top: 26px; }
.section-title { font-family: var(--display); font-weight: 600; font-size: 1.3rem; margin: 26px 4px 12px; }
.day { margin-bottom: 18px; }
.day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 0 4px 8px; }
.day-name { font-weight: 800; }
.day-name::first-letter { text-transform: uppercase; }
.day-sum { font-size: .82rem; color: var(--muted); font-weight: 700; text-align: right; }
.day ul { list-style: none; margin: 0; padding: 4px 0; background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow); }
.item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; text-align: left; }
.day li + li .item { border-top: 1px solid var(--line); }
.ico { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; font-weight: 800; font-size: 1rem; }
.ico-E { background: var(--left-soft); color: var(--left); font-family: var(--display); font-size: 1.15rem; }
.ico-D { background: var(--right-soft); color: var(--right); font-family: var(--display); font-size: 1.15rem; }
.ico-xixi { background: var(--xixi-soft); }
.ico-coco { background: var(--coco-soft); }
.ico-ambos { background: linear-gradient(135deg, var(--xixi-soft) 50%, var(--coco-soft) 50%); font-size: .8rem; letter-spacing: -2px; }
.item-main { flex: 1; min-width: 0; }
.item-title { font-weight: 700; display: block; }
.item-sub { display: block; font-size: .83rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-end { font-weight: 800; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.item-end.soft { color: var(--muted); font-weight: 700; font-size: .9rem; }
.empty { text-align: center; color: var(--muted); padding: 28px 12px; background: var(--surface); border-radius: var(--r-md); }

/* diálogos (folha que sobe de baixo) */
.dialog {
  border: 0; padding: 10px 20px calc(18px + env(safe-area-inset-bottom)); background: var(--surface); color: var(--ink);
  width: 100%; max-width: 520px; margin: auto auto 0; border-radius: var(--r-lg) var(--r-lg) 0 0;
  animation: sheet .22s ease-out;
}
@media (min-width: 560px) { .dialog { margin: auto; border-radius: var(--r-lg); } }
@keyframes sheet { from { transform: translateY(40px); opacity: 0; } }
.dialog::backdrop { background: rgba(20, 12, 8, .45); }
.dialog-handle { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 16px; }
.dialog h3 { font-family: var(--display); font-weight: 600; font-size: 1.4rem; }
.dialog p { margin: 4px 0 14px; }
.dialog .segmented { margin-bottom: 4px; }
#prompt-input { margin: 14px 0 4px; }

#toast {
  position: fixed; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 12px 20px; border-radius: 99px; font-weight: 700;
  max-width: calc(100vw - 32px); text-align: center; z-index: 10; box-shadow: 0 8px 24px rgba(0,0,0,.2);
}

/* edição e código */
.field-label { font-weight: 700; font-size: .9rem; margin: 14px 0 8px; }
.seg-2 { grid-template-columns: 1fr 1fr; }
.row-2 { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 0; }
.row-2 label { margin-bottom: 0; }
.dialog label { margin: 14px 0 4px; }
input[type="datetime-local"] { font-size: 16px; padding: 12px 10px; min-height: 48px; -webkit-appearance: none; appearance: none; }
#entry-form .btn-primary { margin-top: 20px; }
.code-box { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--r-sm); }
.code-box .field-label { margin: 0 0 2px; }
.code-box code { font: 700 1rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .04em; word-break: break-all; }
.code-box .chip { flex-shrink: 0; background: var(--surface); }
.hint.left { text-align: left; margin: 8px 2px 4px; }

/* ---------- v4: contas, abas ---------- */
.boot { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 20; }
.boot img { width: 72px; height: 72px; border-radius: 20px; animation: pulse 1.4s infinite; }
.sheet-title { font-family: var(--display); font-weight: 600; font-size: 1.35rem; margin: 0 0 14px; }
.sheet + .sheet { margin-top: 0; }
.sheet p.muted { margin: -6px 0 14px; font-size: .92rem; }
.brand-name.small { font-size: 2rem; }
.details summary { font-weight: 700; cursor: pointer; list-style: none; color: var(--muted); }
.details summary::-webkit-details-marker { display: none; }
.details summary::after { content: " ›"; }
.details[open] summary { margin-bottom: 14px; color: var(--ink); }
.details { padding: 16px 20px; }

.view { animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.card-prompt { margin: 0 0 14px; font-weight: 800; font-size: 1.05rem; text-align: center; }

.quick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.quick-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 16px 10px; border-radius: var(--r-md); font-weight: 800; transition: transform .08s; }
.quick-btn:active { transform: scale(.97); }
.quick-feed { background: var(--left-soft); color: var(--left); }
.quick-diaper { background: var(--xixi-soft); color: var(--xixi); }
.quick-ico { font-size: 1.2rem; }

.members { list-style: none; margin: 0; padding: 0; }
.members li { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.members li + li { border-top: 1px solid var(--line); }
.members .avatar { width: 38px; height: 38px; font-size: .95rem; box-shadow: none; background: var(--surface-2); }
.members .you { margin-left: auto; font-size: .8rem; font-weight: 800; color: var(--muted); }
.card-head .chip { font-weight: 700; }
.small-p { font-size: .9rem; margin: -6px 0 12px; }
.invite-code {
  font: 800 1.9rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; text-align: center;
  padding: 16px 8px; border-radius: var(--r-sm); background: var(--surface-2); border: 1.5px dashed var(--line);
}
.me-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.me-row strong { text-align: right; word-break: break-all; }

.families-item { display: flex; justify-content: space-between; align-items: center; width: 100%; padding: 14px 4px; border-top: 1px solid var(--line); font-weight: 700; text-align: left; }
.families-item.on::after { content: "✓"; color: var(--right); font-weight: 800; }

/* barra de navegação */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: repeat(6, 1fr);
  padding: 8px max(8px, calc((100vw - 520px) / 2)) calc(8px + env(safe-area-inset-bottom));
  background: var(--surface);
  border-top: 1px solid var(--line);
}
.tabbar button { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0 4px; font-size: .74rem; font-weight: 800; color: var(--muted); border-radius: 14px; }
.tabbar svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button.on { color: var(--ink); }
.tabbar button.on svg { stroke-width: 2.3; }
.tabbar button[data-tab="mamada"].on { color: var(--left); }
.tabbar button[data-tab="fralda"].on { color: var(--xixi); }
.tabbar button[data-tab="familia"].on { color: var(--right); }

/* mamada em andamento, fora da aba */
.mini {
  position: fixed; left: 50%; transform: translateX(-50%); z-index: 6;
  bottom: calc(78px + env(safe-area-inset-bottom)); width: min(488px, calc(100vw - 32px));
  display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 99px;
  background: var(--left); color: #fff; font-weight: 800; box-shadow: 0 8px 24px rgba(0,0,0,.18);
}
.mini.side-D { background: var(--right); }
@media (prefers-color-scheme: dark) { .mini { color: #171311; } }
.mini .dot { background: currentColor; }
.mini-timer { margin-left: auto; font-variant-numeric: tabular-nums; }
#toast { bottom: calc(146px + env(safe-area-inset-bottom)); }

/* ---------- v5: bebê, crescimento, consultas, vacinas ---------- */
:root { --vax: #6d5bd0; --vax-soft: #ece8fb; --ok: #2f7d4f; --ok-soft: #dff1e5; --warn: #c2410c; --warn-soft: #fde4d6; }
@media (prefers-color-scheme: dark) {
  :root { --vax: #a99bf0; --vax-soft: #2a2542; --ok: #7fcf9b; --ok-soft: #1d3326; --warn: #f99868; --warn-soft: #3d2419; }
}
.tabbar { padding-left: max(4px, calc((100vw - 520px) / 2)); padding-right: max(4px, calc((100vw - 520px) / 2)); }
.tabbar button { font-size: .66rem; letter-spacing: -.01em; }
.tabbar svg { width: 24px; height: 24px; }
.tabbar button[data-tab="bebe"].on { color: var(--right); }
.tabbar button[data-tab="consultas"].on { color: var(--coco); }
.tabbar button[data-tab="vacinas"].on { color: var(--vax); }

.title-btn { display: flex; align-items: center; gap: 6px; text-align: left; }
.caret { font-size: 1.3rem; color: var(--muted); line-height: 1; margin-top: -6px; }
.grow { flex: 1; min-width: 0; }
.small { font-size: .85rem; }
.warn { color: var(--warn); font-weight: 800; }

.cta { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin: 14px 0 0; }
.cta strong { display: block; font-size: 1.05rem; }
.cta .muted { display: block; font-size: .9rem; }
.cta-ico { font-size: 2rem; width: 52px; height: 52px; border-radius: 16px; background: var(--right-soft); display: grid; place-items: center; flex-shrink: 0; }
.cta-ico.big { width: 72px; height: 72px; font-size: 2.6rem; border-radius: 22px; margin: 6px auto 12px; }
.empty-card { text-align: center; }
.empty-card h2 { font-family: var(--display); font-weight: 600; font-size: 1.35rem; }
.empty-card p { margin: 6px 0 4px; }
.stats.agenda { margin: 14px 0 0; }
.stat-value.small { font-size: 1.15rem; padding: 3px 0; }

.baby-card { --c: var(--right); --soft: var(--right-soft); }
.baby-card.sex-F { --c: var(--left); --soft: var(--left-soft); }
.baby-head { display: flex; align-items: center; gap: 14px; }
.baby-face { width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); color: var(--c); font-family: var(--display); font-weight: 600; font-size: 1.7rem; flex-shrink: 0; }
.baby-head h2 { font-family: var(--display); font-weight: 600; font-size: 1.5rem; line-height: 1.15; }
.corr { display: inline-block; margin-top: 4px; font-size: .8rem; font-weight: 800; color: var(--c); background: var(--soft); padding: 2px 9px; border-radius: 99px; }
.born { margin: 14px 0 0; font-weight: 700; font-size: .92rem; }
.facts-title { font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 16px 0 8px; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.fact { background: var(--surface-2); border-radius: 12px; padding: 9px 11px; min-width: 0; }
.fact span { display: block; font-size: .74rem; color: var(--muted); font-weight: 700; }
.fact strong { display: block; font-size: .98rem; overflow-wrap: anywhere; }

#growth-metric { margin-bottom: 14px; }
.g-sum { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.g-val { font-family: var(--display); font-weight: 600; font-size: 1.8rem; letter-spacing: -.02em; line-height: 1.1; }
.g-val .muted { font-size: 1.1rem; }
.g-pc { text-align: center; background: var(--right-soft); color: var(--right); padding: 6px 12px; border-radius: 14px; }
.g-pc strong { display: block; font-size: 1.2rem; }
.g-pc span { font-size: .68rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.g-delta { margin-top: 8px; font-weight: 700; font-size: .9rem; color: var(--ok); }
.g-none { margin: 0 0 6px; }
.growth-svg { width: 100%; height: auto; display: block; margin-top: 12px; }
.g-grid { stroke: var(--line); stroke-width: 1; }
.g-axis { font: 700 10px var(--body); fill: var(--muted); }
.g-pct { font: 800 9px var(--body); fill: var(--muted); }
.g-band { fill: color-mix(in srgb, var(--right) 10%, transparent); }
.g-band2 { fill: color-mix(in srgb, var(--right) 14%, transparent); }
.g-p { fill: none; stroke: color-mix(in srgb, var(--right) 45%, transparent); stroke-width: 1; }
.g-p50 { fill: none; stroke: var(--right); stroke-width: 1.6; stroke-dasharray: 4 3; }
.g-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; }
.g-dot { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.g-legend { display: flex; justify-content: space-between; gap: 8px; font-size: .74rem; color: var(--muted); font-weight: 700; margin-top: 4px; }
.ico-measure { background: var(--right-soft); color: var(--right); }

.date-badge { width: 44px; height: 46px; border-radius: 12px; background: var(--coco-soft); color: var(--coco); display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0; line-height: 1; }
.date-badge strong { font-family: var(--display); font-size: 1.25rem; }
.date-badge span { font-size: .68rem; font-weight: 800; text-transform: uppercase; margin-top: 2px; }
.appt .soft { color: var(--muted); font-weight: 600; }
.appt .item-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.status { font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); white-space: nowrap; }
.st-agendada .status { background: var(--coco-soft); color: var(--coco); }
.st-realizada .status { background: var(--ok-soft); color: var(--ok); }
.st-cancelada .item-title { text-decoration: line-through; color: var(--muted); }
#add-appt-btn { margin-top: 0; }

.vax-card .vax-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pill { font-size: .8rem; font-weight: 800; padding: 5px 11px; border-radius: 99px; white-space: nowrap; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); margin: 12px 0 10px; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--vax); border-radius: 99px; transition: width .3s; }
.ico-vax { background: var(--vax-soft); font-size: 1rem; }
.ico-vax.aplicada { background: var(--ok-soft); color: var(--ok); }
.ico-vax.atrasada { background: var(--warn-soft); }
.vx { font-size: .78rem; font-weight: 800; color: var(--muted); white-space: nowrap; }
.vx-ok { color: var(--ok); }
.vx-late { color: var(--warn); background: var(--warn-soft); padding: 3px 8px; border-radius: 99px; }
.vx-now { color: var(--vax); background: var(--vax-soft); padding: 3px 8px; border-radius: 99px; }
.vax-other-head { margin: 26px 4px 12px; }
.section-title.flat { margin: 0; }
#vax-source { margin-bottom: 8px; }

/* formulários */
.dialog-tall { max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain; }
.form-section { font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin: 26px 0 0; padding-top: 14px; border-top: 1px solid var(--line); }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 8px; }
.grid-2 label, .grid-3 label { min-width: 0; }
.unit-wrap { position: relative; display: block; }
.unit-wrap input { padding-right: 44px; }
.unit { position: absolute; right: 12px; top: calc(50% + 4px); transform: translateY(-50%); color: var(--muted); font-weight: 700; font-size: .85rem; pointer-events: none; }
select, textarea {
  font: inherit; font-weight: 600; width: 100%; margin-top: 8px; padding: 14px 14px; border-radius: var(--r-sm);
  border: 1.5px solid var(--line); background: var(--surface-2); color: var(--ink); outline: none;
}
select { -webkit-appearance: none; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
textarea { resize: vertical; min-height: 76px; font-weight: 500; }
select:focus, textarea:focus { border-color: var(--ink); }
input[type="date"] { min-height: 48px; -webkit-appearance: none; appearance: none; padding: 12px 10px; }
.seg-2 { grid-template-columns: 1fr 1fr; }
.list { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: flex; gap: 6px; align-items: center; }
.list-row input { margin: 0; padding: 11px 12px; }
.list-row input.short { width: 34%; flex-shrink: 0; }
.list-row input[type="checkbox"] { width: 22px; height: 22px; flex-shrink: 0; accent-color: var(--ok); }
.rx-row { display: grid; grid-template-columns: 1fr 1fr 34px; background: var(--surface-2); padding: 8px; border-radius: var(--r-sm); }
.rx-row input { background: var(--surface); }
.rx-row input[data-f="name"] { grid-column: 1 / 3; }
.rx-row .rm { grid-row: 1; grid-column: 3; }
.rm { width: 34px; height: 34px; border-radius: 10px; font-size: 1.3rem; color: var(--muted); flex-shrink: 0; }
.add-row { display: inline-block; margin: 10px 0 4px; cursor: pointer; }
.dialog label.add-row { margin: 10px 0 4px; font-size: .8rem; font-weight: 800; }
#form-body:not([data-status="realizada"]) .only-done { display: none; }
.checks { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.dialog label.check { display: flex; align-items: center; gap: 10px; margin: 0; padding: 9px 4px; font-weight: 600; border-bottom: 1px solid var(--line); }
.check input { width: 22px; height: 22px; margin: 0; flex-shrink: 0; accent-color: var(--vax); }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.att { position: relative; display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; }
.att-img { width: 74px; height: 74px; border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.att-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.att-pdf { width: 74px; height: 74px; border-radius: 12px; background: var(--surface-2); display: grid; place-items: center; color: var(--ink); text-decoration: none; }
.att-rm { position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%; background: var(--ink); color: var(--bg); font-size: .95rem; line-height: 1; }
.att-rm[data-armed] { background: var(--danger); width: auto; padding: 0 8px; border-radius: 99px; font-size: .7rem; }
.att-new { background: var(--surface-2); padding: 8px 10px; border-radius: 10px; }
.att-new button { font-size: 1.1rem; color: var(--muted); }
.viewer { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100dvh; }
.viewer::backdrop { background: rgba(0, 0, 0, .88); }
.viewer img { max-width: 96vw; max-height: 82dvh; display: block; margin: 0 auto; border-radius: 12px; }
.viewer-bar { display: flex; justify-content: center; gap: 10px; margin-top: 12px; }
.viewer-bar .chip { background: #fff; color: #111; text-decoration: none; }
.members li .chip { margin-left: auto; }

/* celular: campos com 16px ou mais (o iPhone dá zoom em campos menores e a tela fica "solta" para os lados) */
input, select, textarea { font-size: 16px; }
.tabbar { transform: translateZ(0); }
button, a, label { touch-action: manipulation; }

/* folha de baixo acima do teclado do celular (--kb vem do app.js) */
.dialog { margin-bottom: var(--kb, 0px); max-height: calc(100dvh - var(--kb, 0px) - 8px); overflow-y: auto; overscroll-behavior: contain; transition: margin-bottom .15s ease-out; }
.dialog-tall { max-height: calc(92dvh - var(--kb, 0px)); }
@media (min-width: 560px) { .dialog { margin-bottom: auto; } }
#form-body { padding-bottom: 12px; }
