/* Nossa Família: app web (iPhone e navegadores). Mesma paleta do app Android. */
:root {
  --sage: #7FB3A6; --sage-deep: #4F8A7B; --sage-bg: #E4F0EC;
  --lav: #A3ACDB; --lav-deep: #6E78B8; --lav-bg: #ECEEF8;
  --coral: #F2958A; --coral-deep: #D9695C; --coral-bg: #FDEBE8;
  --butter-deep: #A77B16; --butter-bg: #FFF4DD;
  --peach-deep: #C0704E; --peach-bg: #FFE6D8;
  --bg: #F6F4F0; --surface: #fff; --line: #E9E5DE; --ink: #2E3A39; --muted: #6F7B7A;
  --grad: linear-gradient(135deg, #7FB3A6 0%, #A3ACDB 100%);
  --shadow: 0 1px 2px rgba(46,58,57,.04), 0 6px 18px rgba(46,58,57,.06);
  --safe-t: env(safe-area-inset-top, 0px); --safe-b: env(safe-area-inset-bottom, 0px);
  --tabs-h: 64px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px; line-height: 1.4; -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
  -webkit-text-size-adjust: 100%;
}
body.has-tabs #root { padding-bottom: calc(var(--tabs-h) + var(--safe-b)); }
a { color: var(--sage-deep); }
button { font: inherit; color: inherit; }
input, textarea, select { font: inherit; font-size: 16px; color: var(--ink); }
.ico { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.ico.sm { width: 16px; height: 16px; }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }

.splash { min-height: 100vh; display: grid; place-items: center; background: var(--grad); }
.splash img { width: 96px; height: 96px; border-radius: 24px; box-shadow: 0 12px 40px rgba(0,0,0,.15); }

/* ---------- cabeçalho com degradê ---------- */
.hdr {
  background: var(--grad); color: #fff; border-radius: 0 0 30px 30px;
  padding: calc(var(--safe-t) + 14px) 16px 22px 20px;
}
.hdr-row { display: flex; align-items: center; gap: 6px; }
.hdr h1 { font-size: 25px; font-weight: 700; letter-spacing: -.01em; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hdr .sub { opacity: .92; font-size: 15px; margin-top: 2px; }
.hdr .grow { flex: 1; min-width: 0; }
.hbtn { background: transparent; border: 0; color: #fff; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; cursor: pointer; flex: none; }
.hbtn:active { background: rgba(255,255,255,.18); }
.hbtn.back { margin-left: -10px; }
.gbadge { display: inline-flex; align-items: center; gap: 8px; margin-top: 12px; background: rgba(255,255,255,.22); border-radius: 14px; padding: 7px 12px; font-weight: 700; font-size: 17px; max-width: 100%; }
.gbadge span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- conteúdo ---------- */
.page { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.section-title { display: flex; align-items: center; justify-content: space-between; margin: 10px 4px 0; }
.section-title h2 { font-size: 19px; margin: 0; font-weight: 700; }
.section-title a, .linkbtn { color: var(--sage-deep); font-weight: 600; text-decoration: none; background: none; border: 0; cursor: pointer; padding: 4px; }
.label { text-transform: uppercase; font-size: 12.5px; letter-spacing: .03em; font-weight: 700; color: var(--muted); margin: 8px 4px 2px; }

.card { background: var(--surface); border-radius: 22px; padding: 16px; box-shadow: var(--shadow); }
.card.tap { cursor: pointer; transition: transform .08s; }
.card.tap:active { transform: scale(.985); }
.card h3 { margin: 0; font-size: 17px; font-weight: 650; }
.row { display: flex; align-items: center; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.bubble { width: 46px; height: 46px; border-radius: 15px; display: grid; place-items: center; flex: none; }
.bubble.lg { width: 56px; height: 56px; border-radius: 18px; }
.bubble.sm { width: 40px; height: 40px; border-radius: 13px; }
.t-sage { background: var(--sage-bg); color: var(--sage-deep); }
.t-lav { background: var(--lav-bg); color: var(--lav-deep); }
.t-coral { background: var(--coral-bg); color: var(--coral-deep); }
.t-butter { background: var(--butter-bg); color: var(--butter-deep); }
.t-peach { background: var(--peach-bg); color: var(--peach-deep); }

.alert { border-radius: 22px; padding: 14px; display: flex; align-items: center; gap: 12px; cursor: pointer; }
.alert .bubble { background: #fff; }
.alert b { display: block; font-size: 16px; }
.alert .grow > span { font-size: 14.5px; opacity: .9; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tile { background: #fff; border-radius: 22px; box-shadow: var(--shadow); padding: 16px 6px 14px; display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; border: 0; position: relative; }
.tile:active { transform: scale(.97); }
.tile .bubble { width: 56px; height: 56px; border-radius: 18px; }
.tile span { font-weight: 600; font-size: 14.5px; text-align: center; }
.badge { position: absolute; top: 8px; right: 14px; background: var(--coral-deep); color: #fff; border-radius: 999px; font-size: 12px; font-weight: 700; min-width: 21px; height: 21px; padding: 0 6px; display: grid; place-items: center; border: 2px solid #fff; }

.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 4px 10px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.pill:not([class*="t-"]) { background: #F1EFEA; color: var(--muted); }
.pill .ico { width: 14px; height: 14px; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }

.date-tile { width: 54px; height: 58px; border-radius: 16px; display: flex; flex-direction: column; align-items: center; justify-content: center; flex: none; }
.date-tile b { font-size: 21px; line-height: 1; }
.date-tile span { font-size: 12px; text-transform: uppercase; font-weight: 700; margin-top: 3px; }
.meta { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.meta .ico { width: 15px; height: 15px; }
.info { display: flex; align-items: flex-start; gap: 8px; font-size: 15px; }
.info .ico { width: 18px; height: 18px; margin-top: 2px; color: var(--muted); }

.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; flex: none; font-size: 15px; position: relative; }
.avatar.sm { width: 38px; height: 38px; font-size: 13.5px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar .on { position: absolute; right: 0; bottom: 0; width: 12px; height: 12px; border-radius: 50%; background: #3FB27F; border: 2px solid #fff; }

.empty { text-align: center; padding: 26px 10px; color: var(--muted); }
.empty .bubble { margin: 0 auto 10px; }

/* ---------- botões ---------- */
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer; background: var(--sage-deep); color: #fff; height: 54px; border-radius: 17px; font-weight: 650; font-size: 16.5px; padding: 0 18px; width: 100%; text-decoration: none; }
.btn:active { filter: brightness(.94); }
.btn[disabled] { background: #E5E5E3; color: #9AA2A1; pointer-events: none; }
.btn.lav { background: var(--lav-deep); }
.btn.soft { background: var(--sage-bg); color: var(--sage-deep); }
.btn.ghost { background: transparent; color: var(--sage-deep); height: 44px; }
.btn.danger { background: var(--coral-bg); color: var(--coral-deep); }
.btn.wa { background: #3F9B6E; }
.btn.inline { width: auto; height: 40px; border-radius: 13px; font-size: 15px; padding: 0 14px; }
.choice { display: flex; gap: 10px; }
.choice button { flex: 1; height: 56px; border-radius: 16px; border: 1px solid transparent; display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 650; cursor: pointer; }
.choice .yes { background: var(--sage-bg); color: var(--sage-deep); border-color: rgba(79,138,123,.15); }
.choice .no { background: var(--coral-bg); color: var(--coral-deep); border-color: rgba(217,105,92,.15); }
.choice .yes.on { background: var(--sage-deep); color: #fff; }
.choice .no.on { background: var(--coral-deep); color: #fff; }
.spin { width: 20px; height: 20px; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: sp .7s linear infinite; }
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------- formulário ---------- */
.field { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: 17px; background: #fff; padding: 0 14px; min-height: 56px; position: relative; }
.field:focus-within { border-color: var(--sage-deep); }
.field > .ico { color: var(--muted); }
.field input, .field textarea, .field select { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; padding: 16px 0; }
.field textarea { resize: none; min-height: 90px; }
.field .eye { background: none; border: 0; color: var(--muted); padding: 6px; cursor: pointer; }
.hint { font-size: 13.5px; color: var(--muted); margin: 6px 6px 0; display: flex; align-items: center; gap: 6px; }
.hint.ok { color: var(--sage-deep); font-weight: 600; }
.hint.err { color: var(--coral-deep); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1.5px solid var(--line); background: #fff; border-radius: 13px; padding: 8px 12px; font-weight: 600; font-size: 14.5px; cursor: pointer; }
.chip.on { background: var(--sage-bg); color: var(--sage-deep); border-color: transparent; }
.chip .ico { width: 18px; height: 18px; }
.opt { display: flex; align-items: center; gap: 12px; padding: 11px 10px; border-radius: 15px; cursor: pointer; }
.opt.on { background: var(--sage-bg); }
.opt.on b { color: var(--sage-deep); }
.opt .ico.state { color: #D6D2CA; }
.opt.on .ico.state { color: var(--sage-deep); }
.pick { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-radius: 13px; cursor: pointer; }
.pick .ico.state { color: #D6D2CA; }
.pick.on .ico.state { color: var(--sage-deep); }
.picker-row { display: flex; align-items: center; gap: 12px; padding: 10px 4px; position: relative; }
.picker-row input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.picker-row .alt { color: var(--sage-deep); font-weight: 650; font-size: 14.5px; }

/* ---------- autenticação ---------- */
.auth-top { background: var(--grad); color: #fff; text-align: center; padding: calc(var(--safe-t) + 44px) 20px 80px; border-radius: 0 0 40px 40px; }
.auth-top img { width: 96px; height: 96px; border-radius: 26px; box-shadow: 0 10px 30px rgba(0,0,0,.12); }
.auth-top h1 { font-size: 30px; margin: 18px 0 4px; }
.auth-card { background: #fff; border-radius: 30px; margin: -56px 16px 24px; padding: 22px 18px; box-shadow: var(--shadow); }
.grp { display: flex; align-items: center; gap: 12px; border: 1.5px solid var(--line); border-radius: 17px; padding: 8px 4px 8px 12px; cursor: pointer; background: #fff; }
.grp.on { background: var(--sage-bg); border-color: rgba(79,138,123,.45); }
.grp .x { background: none; border: 0; color: var(--muted); padding: 10px; cursor: pointer; }

/* ---------- barra de abas ---------- */
#tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line); display: flex; padding: 6px 4px calc(6px + var(--safe-b)); }
#tabs button { flex: 1; border: 0; background: none; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; position: relative; padding: 0; }
#tabs .ic { width: 58px; height: 32px; border-radius: 16px; display: grid; place-items: center; }
#tabs button.on { color: var(--sage-deep); }
#tabs button.on .ic { background: var(--sage-bg); }
#tabs .badge { top: -4px; right: calc(50% - 26px); }

.fab { position: fixed; right: 18px; bottom: calc(var(--tabs-h) + var(--safe-b) + 16px); z-index: 15; display: flex; align-items: center; gap: 10px; background: var(--sage-deep); color: #fff; border: 0; border-radius: 18px; height: 56px; padding: 0 20px; font-weight: 650; box-shadow: 0 8px 24px rgba(79,138,123,.35); cursor: pointer; }

/* ---------- calendário ---------- */
.month-nav { display: flex; align-items: center; margin-top: 10px; }
.month-nav h2 { flex: 1; text-align: center; font-size: 21px; margin: 0; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal .wd { text-align: center; font-size: 12.5px; font-weight: 700; color: var(--muted); padding-bottom: 6px; }
.cal button { aspect-ratio: 1; border: 0; background: none; border-radius: 14px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 15.5px; cursor: pointer; padding: 0; }
.cal button.out { color: #C4C9C8; }
.cal button.today { box-shadow: inset 0 0 0 1.5px rgba(79,138,123,.5); font-weight: 700; }
.cal button.sel { background: var(--sage-deep); color: #fff; font-weight: 700; }
.dots { display: flex; gap: 3px; height: 8px; margin-top: 3px; }
.dots i { width: 5px; height: 5px; border-radius: 50%; display: block; }
.legend { display: flex; gap: 14px; font-size: 13px; color: var(--muted); margin: 10px 4px 0; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* ---------- itens ---------- */
.item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 15px; }
.item.mine { background: var(--sage-bg); }
.item .act { flex: none; }
.iconbtn { background: none; border: 0; color: var(--muted); padding: 8px; border-radius: 12px; cursor: pointer; display: grid; place-items: center; }
.iconbtn:active { background: #F1EFEA; }
.outline { border: 1.5px solid rgba(79,138,123,.4); background: #fff; color: var(--sage-deep); border-radius: 12px; padding: 8px 14px; font-weight: 650; cursor: pointer; }

/* ---------- conversa ---------- */
.chat { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
.chat .hdr { flex: none; }
.msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; -webkit-overflow-scrolling: touch; }
.daydiv { align-self: center; background: #fff; color: var(--muted); font-size: 13px; font-weight: 600; border-radius: 999px; padding: 4px 12px; margin: 8px 0; }
.msg { max-width: 80%; padding: 9px 14px; border-radius: 20px; background: #fff; align-self: flex-start; border-bottom-left-radius: 6px; word-wrap: break-word; white-space: pre-wrap; }
.msg.me { background: var(--sage-deep); color: #fff; align-self: flex-end; border-bottom-left-radius: 20px; border-bottom-right-radius: 6px; }
.msg .who { font-size: 13px; font-weight: 700; margin-bottom: 2px; white-space: normal; }
.msg time { display: block; text-align: right; font-size: 12px; opacity: .7; margin-top: 2px; }
.msg img.photo { display: block; max-width: 100%; width: 260px; max-height: 320px; object-fit: cover; border-radius: 14px; margin: 2px 0 4px; background: rgba(0,0,0,.05); cursor: pointer; }
.filecard { display: flex; align-items: center; gap: 10px; background: var(--lav-bg); border-radius: 14px; padding: 10px; margin: 2px 0 4px; text-decoration: none; color: var(--ink); min-width: 200px; white-space: normal; }
.msg.me .filecard { background: rgba(255,255,255,.16); color: #fff; }
.filecard .fi { width: 42px; height: 42px; border-radius: 12px; background: #fff; display: grid; place-items: center; color: var(--lav-deep); flex: none; }
.msg.me .filecard .fi { color: var(--sage-deep); }
.composer { flex: none; background: #fff; box-shadow: 0 -4px 16px rgba(0,0,0,.05); padding: 10px 12px calc(10px + var(--safe-b)) 6px; }
.composer .bar { display: flex; align-items: flex-end; gap: 6px; }
.composer textarea { flex: 1; border: 1.5px solid var(--line); background: var(--bg); border-radius: 24px; padding: 13px 16px; resize: none; outline: 0; max-height: 130px; line-height: 1.35; }
.composer textarea:focus { border-color: var(--sage-deep); }
.sendbtn { width: 50px; height: 50px; border-radius: 50%; border: 0; background: var(--sage-deep); color: #fff; display: grid; place-items: center; flex: none; cursor: pointer; }
.sendbtn[disabled] { background: #E5E5E3; color: #9AA2A1; }
.attbtn { width: 46px; height: 50px; border: 0; background: none; color: var(--sage-deep); display: grid; place-items: center; cursor: pointer; flex: none; }
.pending { display: flex; align-items: center; gap: 10px; background: var(--sage-bg); border-radius: 16px; padding: 8px; margin: 0 0 8px 6px; }
.pending img, .pending .fi { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: #fff; display: grid; place-items: center; color: var(--sage-deep); flex: none; }

/* ---------- folha (menu de baixo) e diálogos ---------- */
.sheet-bg { position: fixed; inset: 0; background: rgba(30,40,40,.38); z-index: 50; display: flex; align-items: flex-end; animation: fade .15s; }
.sheet { background: #fff; width: 100%; border-radius: 26px 26px 0 0; padding: 10px 16px calc(18px + var(--safe-b)); max-height: 88vh; overflow-y: auto; animation: up .2s ease-out; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: #DDD8CF; margin: 0 auto 12px; }
.sheet h3 { margin: 0 0 6px; font-size: 19px; }
.sheet .opt { padding: 13px 8px; }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: .5; } }

#toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabs-h) + var(--safe-b) + 14px); z-index: 60; background: #2F3433; color: #fff; padding: 14px 16px; border-radius: 14px; font-size: 15px; box-shadow: 0 10px 30px rgba(0,0,0,.2); animation: up .2s; }
#toast.err { background: #B44C40; }
body:not(.has-tabs) #toast { bottom: calc(var(--safe-b) + 16px); }

/* ---------- ajuda ---------- */
.help-pts { margin: 12px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.help-pts li { display: flex; gap: 8px; font-size: 15px; }
.help-pts li::before { content: "•"; font-weight: 700; color: var(--sage-deep); }
.help-pts li.sub { padding-left: 18px; }
.help-pts li.sub::before { content: ""; }

@media (min-width: 640px) {
  #root { max-width: 560px; margin: 0 auto; }
  #tabs { max-width: 560px; margin: 0 auto; border-radius: 22px 22px 0 0; }
  .fab { right: calc(50% - 262px); }
}
