:root {
  --bg: #f4f7f6; --card: #ffffff; --ink: #17302d; --ink2: #2c403e; --muted: #55676a;
  --line: #c9d3d1; --soft: #e1e8e6; --teal: #1a6b65; --teal-dark: #124a46;
  --gold-ink: #6e5214; --gold-soft: #fbf4e3; --sel: #e6f0ee; --err: #9b2c1f;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 400 16px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid #c49a3c; outline-offset: 2px; }
#app { max-width: 480px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }

.head { padding: 24px 20px 10px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.head.back { padding: 16px 8px 4px; justify-content: flex-start; gap: 4px; }
.brand { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #8a6a1f; }
h1 { margin: 0; font-size: 24px; font-weight: 700; line-height: 1.2; }
.head.back h1 { font-size: 21px; }
.iconbtn { width: 44px; height: 44px; border: 0; background: transparent; border-radius: 22px; display: flex; align-items: center; justify-content: center; padding: 0; flex: none; }
.fab { width: 48px; height: 48px; border: 0; border-radius: 24px; background: var(--teal); display: flex; align-items: center; justify-content: center; padding: 0; flex: none; }
.body { padding: 4px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.card { background: var(--card); border-radius: 18px; padding: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.label { font-size: 15px; font-weight: 600; }
.big { font-size: 17px; font-weight: 600; }
.center { text-align: center; }
.err { color: var(--err); font-size: 14px; font-weight: 600; min-height: 20px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }

.btn { height: 54px; width: 100%; border: 0; border-radius: 16px; background: var(--teal); color: #fff; font-size: 16px; font-weight: 700; }
.btn:disabled { background: #a9b8b5; cursor: default; }
.btn.ghost { background: transparent; color: var(--teal); border: 1.5px solid var(--teal); height: 52px; }
.link { border: 0; background: transparent; color: var(--teal); font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 8px; }
.field { height: 48px; width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 0 12px; background: #fff; font-size: 16px; }
.pin { text-align: center; letter-spacing: .4em; font-size: 22px; font-weight: 600; height: 56px; }
textarea.field { height: 120px; padding: 12px 14px; resize: vertical; line-height: 1.45; border-radius: 14px; }

/* calendário */
.cal { margin: 0 16px; padding: 10px 12px 12px; background: var(--card); border-radius: 20px; display: flex; flex-direction: column; gap: 8px; }
.calnav { display: flex; align-items: center; justify-content: space-between; }
.grid7 { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.dow { font-size: 12px; font-weight: 600; color: var(--muted); text-align: center; }
.days { row-gap: 2px; }
.day { height: 54px; border: 0; background: transparent; border-radius: 12px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 0; font-size: 13px; font-weight: 500; }
.day.sel { background: var(--sel); }
.day.today .num { font-weight: 800; color: var(--teal); }
.day:disabled { color: #9aa8a5; cursor: default; }
.dot { width: 22px; height: 22px; border-radius: 11px; border: 1.5px dashed #b9c4c1; }
.dot.on { border-color: transparent; }
.legend { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 0; font-size: 12px; color: var(--muted); }
.legend .sw { display: flex; gap: 6px; }
.legend .sw span { width: 16px; height: 16px; border-radius: 8px; }
.daylist { padding: 16px 20px 20px; display: flex; flex-direction: column; gap: 10px; }
.item { width: 100%; text-align: left; border: 0; background: var(--card); border-radius: 16px; padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start; }
.item .t { font-size: 13px; font-weight: 600; }
.item .x { font-size: 14px; color: #3a4d4c; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* novo registro */
.faces { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.facebtn { height: 84px; border-radius: 16px; border: 2px solid transparent; background: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 11px; font-weight: 600; padding: 0; }
.faces.small .facebtn { height: 60px; font-size: 0; gap: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { height: 44px; padding: 0 14px; border-radius: 22px; border: 1.5px solid var(--line); background: #fff; font-size: 14px; font-weight: 600; }
.chip.on { background: var(--teal); border-color: var(--teal); color: #fff; }
.chip.other { border-style: dashed; border-color: #8a9a97; background: transparent; }
.chipin { width: 170px; height: 44px; padding: 0 14px; border-radius: 22px; border: 1.5px solid var(--teal); background: #fff; font-size: 14px; font-weight: 600; }
.okbtn { width: 44px; height: 44px; padding: 0; border: 0; border-radius: 22px; background: var(--teal); display: flex; align-items: center; justify-content: center; }
.whenrow { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.foot { margin-top: auto; padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; }
.notice { font-size: 12px; color: var(--muted); text-align: center; }

/* detalhe */
.orig .txt, .add .txt { font-size: 15px; line-height: 1.5; color: var(--ink2); white-space: pre-wrap; overflow-wrap: anywhere; }
.lock { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--muted); }
.add { margin-left: 20px; background: var(--gold-soft); border-radius: 18px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.add .h { font-size: 13px; font-weight: 700; color: var(--gold-ink); }
.saved { background: var(--sel); color: var(--teal-dark); border-radius: 12px; padding: 10px 14px; font-size: 14px; font-weight: 600; }

/* abas */
.tabs { position: sticky; bottom: 0; margin-top: auto; background: var(--card); border-top: 1px solid var(--soft); display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-bottom: env(safe-area-inset-bottom); }
.tab { height: 64px; border: 0; background: transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); }
.tab.on { color: var(--teal); font-weight: 700; }

.gate { padding: 48px 24px 24px; display: flex; flex-direction: column; gap: 16px; }

svg { display: block; }

/* questionários */
.abtn { display: flex; align-items: center; justify-content: center; text-decoration: none; height: 48px; font-size: 15px; }
.qnote { font-size: 13px; font-weight: 600; color: var(--gold-ink); }
.qlist { padding: 4px 16px; }
.qrow { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--soft); }
.qrow:last-child { border-bottom: 0; }

/* termo */
.ttxt { font-size: 15px; line-height: 1.5; color: var(--ink2); }
.aceite { display: flex; align-items: flex-start; gap: 12px; font-size: 15px; font-weight: 600; padding: 12px 0; min-height: 44px; }
.chk { width: 24px; height: 24px; flex: none; margin: 0; accent-color: var(--teal); }
.center2 { justify-content: center; gap: 24px; }
