:root {
  --navy: #1f3a5f;
  --navy-dark: #152a47;
  --accent: #2f7d5b;
  --bg: #f3f5f8;
  --card: #fff;
  --text: #1c2430;
  --muted: #667085;
  --line: #e2e6ec;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --ok: #067647;
  --ok-bg: #ecfdf3;
  --warn: #b54708;
  --warn-bg: #fffaeb;
  --radius: 10px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.45; }
h1 { font-size: 1.4rem; margin: 0; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
a { color: var(--navy); }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; padding: 1rem .75rem; display: flex; flex-direction: column; gap: .25rem; position: sticky; top: 0; height: 100vh; height: 100dvh; overflow: hidden; }
.brand { font-weight: 700; font-size: 1.05rem; padding: .5rem .75rem 1rem; display: flex; align-items: center; gap: .6rem; }
.brand svg { flex: none; }
.nav a { display: block; color: #d5deeb; text-decoration: none; padding: .55rem .75rem; border-radius: 8px; }
.nav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav a.active { background: rgba(255,255,255,.16); color: #fff; font-weight: 600; }
.nav .group { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: #93a4bd; padding: .9rem .75rem .25rem; }
.sidebar .nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.sidebar .me { flex: none; margin-top: auto; padding: .75rem; border-top: 1px solid rgba(255,255,255,.15); font-size: .85rem; }
.sidebar .me small { display: block; color: #9fb0c8; }
.sidebar .me button { margin-top: .5rem; }
.main { padding: 1.5rem 2rem 3rem; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.1rem; }
.menu-toggle { display: none; }

/* ---------- components ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem 1.2rem; }
.card + .card { margin-top: 1rem; }
.grid { display: grid; gap: 1rem; }
/* KPI rows (stat cards): flexbox instead of grid tracks, so a half-full last line still fills the width evenly
   instead of leaving a gap under it — and the cross-axis stretch equalizes every card's height automatically. */
.grid.cols-4, .grid.cols-3 { display: flex; flex-wrap: wrap; align-items: stretch; }
.grid.cols-4 > *, .grid.cols-3 > * { flex: 1 1 200px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.stat .label { color: var(--muted); font-size: .85rem; }
.stat .value { font-size: 1.55rem; font-weight: 700; margin-top: .15rem; }
.stat .sub { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.pos { color: var(--ok); } .neg { color: var(--danger); }

button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: #fff; color: var(--text); padding: .5rem .9rem; border-radius: 8px; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: #f0f3f7; }
button.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.primary:hover { background: var(--navy-dark); }
button.green { background: var(--accent); border-color: var(--accent); color: #fff; }
button.green:hover { background: #266a4c; }
button.danger { color: var(--danger); border-color: #f3c6c2; }
button.link { border: 0; background: none; color: var(--navy); padding: .2rem .35rem; text-decoration: underline; }
button.sm { padding: .25rem .55rem; font-size: .85rem; }
button:disabled { opacity: .55; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid #4c8bd6; outline-offset: 1px; }
.row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

.toolbar { display: flex; gap: .6rem; flex-wrap: wrap; align-items: end; margin-bottom: 1rem; }
label.field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
label.field > span.req::after { content: " *"; color: var(--danger); }
input, select, textarea { font: inherit; color: var(--text); padding: .45rem .6rem; border: 1px solid #ccd3dd; border-radius: 8px; background: #fff; min-width: 0; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox], input[type=radio] { padding: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: .8rem 1rem; }
.form-grid .full { grid-column: 1 / -1; }
fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0; padding: .6rem .8rem; }
fieldset[disabled] { opacity: .85; }
legend { font-size: .85rem; color: var(--muted); padding: 0 .3rem; }
.checks { display: flex; flex-wrap: wrap; gap: .35rem 1rem; }
.checks label { display: flex; gap: .35rem; align-items: center; font-size: .95rem; color: var(--text); }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .55rem .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); background: #fafbfc; position: sticky; top: 0; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: #f7f9fc; }
tfoot td { font-weight: 700; background: #fafbfc; }
.table-wrap { overflow-x: auto; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.empty { text-align: center; color: var(--muted); padding: 2rem 1rem; }

.badge { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .78rem; background: #eef1f5; color: #475467; white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.bad { background: var(--danger-bg); color: var(--danger); }
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin-bottom: 1rem; flex-wrap: wrap; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; background: none; padding: .55rem .9rem; }
.tabs button.active { border-bottom-color: var(--navy); font-weight: 600; }
.bar { height: 8px; border-radius: 4px; background: #e8ecf1; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.exp > i { background: #c2543f; }
.err { background: var(--danger-bg); color: var(--danger); border: 1px solid #f3c6c2; padding: .5rem .75rem; border-radius: 8px; margin-bottom: .75rem; }
.notice { background: #eef4ff; border: 1px solid #cfdcf7; padding: .6rem .8rem; border-radius: 8px; font-size: .9rem; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); box-shadow: 0 20px 60px rgba(16,24,40,.35); }
dialog.narrow { width: min(460px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(16,24,40,.5); }
.dlg-head { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1.2rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: #fff; z-index: 1; }
.dlg-head h2 { margin: 0; }
.dlg-body { padding: 1.1rem 1.2rem; }
.dlg-foot { display: flex; justify-content: flex-end; gap: .5rem; margin-top: 1.1rem; }

#toasts { position: fixed; right: 1rem; bottom: 1rem; display: flex; flex-direction: column; gap: .5rem; z-index: 50; }
.toast { background: #101828; color: #fff; padding: .65rem 1rem; border-radius: 8px; box-shadow: 0 6px 20px rgba(0,0,0,.25); max-width: 360px; }
.toast.error { background: var(--danger); }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 1rem; background: linear-gradient(160deg, var(--navy) 0%, #2c527f 100%); }
.login { width: min(400px, 100%); background: #fff; border-radius: 14px; padding: 2rem; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login h1 { margin-bottom: .25rem; }
.login form { display: grid; gap: .9rem; margin-top: 1.25rem; }
.login button { padding: .65rem; }

/* ---------- printing ---------- */
#print-area { display: none; }
.doc { font-family: Georgia, "Times New Roman", serif; color: #000; max-width: 720px; margin: 0 auto; }
.doc h1 { font-size: 1.3rem; text-align: center; margin-bottom: .2rem; }
.doc .doc-head { text-align: center; border-bottom: 2px solid #000; padding-bottom: .6rem; margin-bottom: 1rem; }
.doc .doc-head small { display: block; color: #333; }
.doc table th { background: none; position: static; color: #000; border-bottom: 1px solid #000; }
.doc td, .doc th { border-bottom: 1px solid #ccc; }
.doc .sign { margin-top: 3rem; text-align: center; }
.doc .sign span { display: inline-block; border-top: 1px solid #000; padding-top: .25rem; min-width: 260px; }
.doc p { line-height: 1.7; }

@media print {
  body { background: #fff; }
  #app, #toasts, dialog { display: none !important; }
  #print-area { display: block; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  /* dvh = the visible height (phones: without the browser toolbar covering the bottom); keeps "Minha conta / Sair" on screen */
  .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 20; transform: translateX(-100%); transition: transform .2s; height: 100vh; height: 100dvh; padding-bottom: 1.75rem; }
  .sidebar.open { transform: none; }
  .menu-toggle { display: inline-block; }
  .main { padding: 1rem 1rem 3rem; }
  th, td { padding: .5rem .4rem; }
}

.donor td { font-size: .9rem; color: var(--muted); border-bottom-style: dashed; }
.donor td:first-child { padding-left: 1.6rem; }
.doc .donor td { color: #333; }
.bank-actions { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; margin-top: .35rem; }
.sugg { background: #f6faf7; border: 1px solid #cfe6d8; border-radius: 8px; padding: .4rem .6rem; margin-top: .4rem; font-size: .9rem; }
.sugg .row { justify-content: space-between; }
tr.entry-conciliado td { background: #fbfdfb; }
tr.entry-ignorado td { color: var(--muted); }
dialog .table-wrap { max-height: 45vh; overflow: auto; }

/* ---------- pickers, radios ---------- */
div.field { display: flex; flex-direction: column; gap: .25rem; font-size: .85rem; color: var(--muted); }
.picker { flex-wrap: nowrap; }
.picker select { flex: 1; min-width: 0; }
.radio { display: inline-flex; gap: .35rem; align-items: center; font-size: .95rem; color: var(--text); }
.badge.info { background: #eef4ff; color: #1d4ed8; }

/* ---------- member photo ---------- */
.photo-box { display: flex; gap: 1rem; align-items: center; margin-bottom: .8rem; }
.photo-box .column { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
.member-photo { width: 75px; height: 100px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #eef1f5; }
.member-photo.empty { display: grid; place-items: center; font-size: 2rem; color: var(--muted); }
.docs-bar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .8rem; padding: .5rem .7rem; background: #f7f9fc; border: 1px solid var(--line); border-radius: 8px; }
.doc-preview { overflow-x: auto; padding: .5rem 0; }

/* ---------- membership card (CR80: 85.6 x 54 mm) — preto e branco ---------- */
.idcards-sheet { display: flex; flex-wrap: wrap; gap: 6mm; page: idcards; font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; color: #111;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.idcard { flex: none; width: 85.6mm; height: 54mm; border-radius: 3mm; overflow: hidden; position: relative; display: flex; flex-direction: column; break-inside: avoid; box-sizing: border-box; }
.idcard::before { content: ""; position: absolute; inset: 1.5mm; border-radius: 2mm; pointer-events: none; }
/* frente: fundo preto, texto branco */
.idcard.front { background: #0b0b0b; color: #fff; padding: 3.6mm 4.6mm 0; }
.idcard.front::before { border: .2mm solid rgba(255, 255, 255, .5); }
.idc-head { display: flex; gap: 2.6mm; align-items: center; }
.idc-logo { flex: none; width: 9mm; height: 9mm; border-radius: 50%; background: #0b0b0b; display: grid; place-items: center; overflow: hidden; }
.idc-logo img { width: 9mm; height: 9mm; object-fit: contain; }
.idc-logo img.cross { width: 6.5mm; height: 6.5mm; }
.idc-church { min-width: 0; }
.idc-church strong { display: block; font-size: 3.1mm; line-height: 1.15; letter-spacing: .25mm; text-transform: uppercase; font-weight: 600; }
.idc-church small { display: block; margin-top: .6mm; font-size: 1.9mm; letter-spacing: .75mm; text-transform: uppercase; color: #b9b9b9; }
.idc-body { display: flex; gap: 3.4mm; margin-top: 3mm; flex: 1; min-height: 0; }
.idc-photo { width: 19mm; height: 25.3mm; object-fit: cover; border: .35mm solid #fff; border-radius: 1mm; flex: none; background: #2a2a2a; }
.idc-photo.empty { display: grid; place-items: center; font-size: 8mm; color: #bbb; font-family: Georgia, "Times New Roman", serif; }
.idc-info { flex: 1; min-width: 0; }
.idc-name { font-family: Georgia, "Times New Roman", serif; font-weight: 700; font-size: 4mm; line-height: 1.15; padding-bottom: 1.6mm; margin-bottom: 1.6mm; border-bottom: .2mm solid rgba(255, 255, 255, .4); }
.idc-row { display: block; margin-bottom: 1.1mm; }
.idc-row span { display: block; font-size: 1.8mm; letter-spacing: .4mm; text-transform: uppercase; color: #a8a8a8; line-height: 1.2; }
.idc-row strong { display: block; font-size: 2.8mm; font-weight: 600; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idc-strip { display: flex; justify-content: space-between; align-items: baseline; margin: 0 -4.6mm; padding: 1.5mm 4.6mm 2.6mm; position: relative; }
.idc-strip span { font-size: 1.8mm; letter-spacing: .5mm; text-transform: uppercase; color: #a8a8a8; }
.idc-strip strong { font-size: 3mm; letter-spacing: .6mm; font-variant-numeric: tabular-nums; font-weight: 600; }
/* verso: fundo branco, texto preto */
.idcard.back { background: #fff; color: #111; padding: 3.6mm 4.6mm 3mm; justify-content: space-between; border: .25mm solid #111; }
.idcard.back::before { border: .15mm solid #111; inset: 1.3mm; }
.idcard.back .idc-row span { color: #666; }
.idc-grid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 3mm; position: relative; }
.idcard.back .idc-row { margin-bottom: .8mm; }
.idc-lower { display: flex; align-items: flex-end; gap: 2.5mm; position: relative; }
.idc-sign { flex: 1; min-width: 0; text-align: center; position: relative; }
.idc-qr { flex: none; width: 14.5mm; text-align: center; line-height: 1; }
.idc-qr img { display: block; width: 14.5mm; height: 14.5mm; border: .2mm solid #111; }
.idc-qr small { display: block; margin-top: .5mm; font-size: 1.5mm; letter-spacing: .4mm; text-transform: uppercase; color: #444; }
.idc-signature { font: italic 5mm/1.1 "Segoe Script", "Snell Roundhand", "Brush Script MT", "Apple Chancery", Georgia, serif; min-height: 6mm; padding: 0 2mm; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idc-signline { border-top: .25mm solid #111; margin: .4mm 2mm 0; padding-top: .7mm; }
.idc-signline strong { display: block; font-size: 2.5mm; font-weight: 600; line-height: 1.2; }
.idc-signline small { display: block; font-size: 1.9mm; letter-spacing: .4mm; text-transform: uppercase; color: #555; }
.idc-stamp { margin-top: .9mm; font-size: 1.7mm; color: #444; letter-spacing: .1mm; }
.idc-foot { font-size: 1.7mm; color: #555; text-align: center; line-height: 1.35; position: relative; }

/* ---------- baptism certificate (A4 landscape) ---------- */
.cert-page { page: certificate; }
.cert-wrap { container-type: inline-size; width: 100%; max-width: 277mm; margin: 0 auto; }
.cert { aspect-ratio: 297 / 210; border: 1.6cqw double #1f3a5f; outline: .25cqw solid #1f3a5f; outline-offset: -2.1cqw; padding: 4cqw 7cqw; text-align: center; font-family: Georgia, "Times New Roman", serif; color: #111; display: flex; flex-direction: column; justify-content: space-between; background: #fffdf8; }
.cert-cross { width: 5cqw; height: 5cqw; margin: 0 auto; }
.cert-church { font-size: 3cqw; font-weight: 700; color: #1f3a5f; }
.cert-sub { font-size: 1.3cqw; color: #444; }
.cert-title { font-size: 4.6cqw; letter-spacing: .5cqw; margin: 1cqw 0; color: #1f3a5f; }
.cert-text { font-size: 2.15cqw; line-height: 1.7; margin: 0; text-align: justify; text-indent: 4cqw; }
.cert-date { font-size: 1.9cqw; margin: 0; }
.cert-sigs { display: flex; justify-content: space-around; }
.cert-sig { width: 34%; }
.cert-sig span { display: block; border-top: .2cqw solid #111; padding-top: .5cqw; font-size: 1.8cqw; min-height: 3.5cqw; }
.cert-sig small { font-size: 1.4cqw; color: #444; }

@page idcards { size: A4 portrait; margin: 10mm; }
@page certificate { size: A4 landscape; margin: 8mm; }
@media print {
  #print-area .cert-wrap { max-width: none; }
}

/* ---------- unhandled-error / stale-server banner ---------- */
.stale { position: sticky; top: 0; z-index: 60; background: #b42318; color: #fff; padding: .6rem 1rem; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; font-size: .9rem; }
.stale button { margin-left: auto; }

/* ---------- mobile collection module ---------- */
.shell.bare { grid-template-columns: 1fr; }
.shell.bare .sidebar { display: none; }
.shell.bare .menu-toggle { display: none; }
.shell.bare .main { padding: 0 0 5rem; max-width: 560px; margin: 0 auto; width: 100%; }
.m-page { display: flex; flex-direction: column; gap: .8rem; padding: 0 1rem; }
.m-top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem; justify-content: space-between; background: var(--navy); color: #fff; margin: 0 -1rem; padding: .8rem 1rem; }
.m-top a { color: #fff; text-decoration: none; padding: .35rem .2rem; min-height: 44px; display: inline-flex; align-items: center; }
.m-top strong { flex: 1; text-align: center; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-top .muted { color: #b9c6dc; }
.m-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: .6rem 0 0; }
button.m-big { width: 100%; min-height: 56px; font-size: 1.1rem; font-weight: 600; border-radius: 14px; }
.m-actions { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.m-actions:has(button:only-child) { grid-template-columns: 1fr; }
.m-card { display: flex; flex-direction: column; gap: .3rem; background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; text-decoration: none; color: inherit; min-height: 64px; }
.m-summary { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1rem; text-align: center; }
.m-total { font-size: 2.3rem; font-weight: 800; color: var(--navy); font-variant-numeric: tabular-nums; }
.m-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.m-item { display: flex; align-items: center; gap: .7rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; min-height: 60px; }
.m-item .grow { flex: 1; min-width: 0; }
.m-item.wait { background: var(--warn-bg); border-color: #f5d9a8; }
.m-item.bad { background: var(--danger-bg); border-color: #f3c6c2; color: var(--danger); }
.m-results { display: flex; flex-direction: column; gap: .4rem; margin-top: .4rem; }
button.m-result { text-align: left; min-height: 52px; font-size: 1rem; border-radius: 10px; }
button.m-result.add { color: var(--accent); font-weight: 600; }
.m-chip { display: flex; justify-content: space-between; align-items: center; padding: .7rem .9rem; background: var(--ok-bg); border: 1px solid #b7e4c7; border-radius: 10px; min-height: 52px; }
.m-quick { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .4rem; }
.m-quick button { min-height: 44px; flex: 1; border-radius: 10px; }
.m-seg { display: flex; gap: .4rem; }
.m-seg button { flex: 1; min-height: 50px; border-radius: 10px; }
.m-seg button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.m-foot { display: grid; gap: .6rem; margin-top: 1rem; }
.m-page input, dialog.sheet input, dialog.sheet select, dialog.sheet textarea { font-size: 1.05rem; min-height: 48px; }
input.m-amount { font-size: 1.8rem; font-weight: 700; text-align: right; }
dialog.sheet { width: min(560px, 100vw); }
@media (max-width: 640px) {
  dialog.sheet { margin: auto 0 0 0; max-width: 100vw; width: 100vw; border-radius: 18px 18px 0 0; max-height: 92vh; }
}

/* ---------- church logo ---------- */
.logo-box { display: flex; gap: 1rem; align-items: center; }
.logo-preview { width: 240px; height: 120px; display: grid; place-items: center; border: 1px dashed var(--line); border-radius: 10px; background: #fafbfc; overflow: hidden; }
.logo-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.logo-box .column { display: flex; flex-direction: column; gap: .3rem; align-items: flex-start; }
img.brand-logo { height: 34px; width: auto; max-width: 150px; object-fit: contain; background: #fff; border-radius: 7px; padding: 3px 5px; flex: none; }
img.login-logo { display: block; max-height: 90px; max-width: 100%; margin: 0 auto 1rem; object-fit: contain; }
.doc .doc-logo { display: block; max-height: 22mm; max-width: 60mm; margin: 0 auto .4rem; object-fit: contain; }
.idc-head img.logo { height: 7mm; width: auto; max-width: 16mm; object-fit: contain; background: #fff; border-radius: 1mm; padding: .5mm; flex: none; }
.cert-logo { max-height: 11cqw; max-width: 32cqw; object-fit: contain; margin: 0 auto; }
.notice.nomatch { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: var(--warn-bg); border-color: #f5d9a8; color: var(--warn); }

/* ---------- prebenda / contracheque ---------- */
.items-table td { padding: .25rem .3rem; }
.items-table input, .items-table select { width: 100%; }
.items-table td:nth-child(3) input { text-align: right; min-width: 7.5rem; }
.payroll-totals { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: flex-end; margin: .6rem 0 1rem; font-size: .95rem; }
.payroll-totals strong { margin-left: .25rem; font-variant-numeric: tabular-nums; }
.payslip-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .4rem 1rem; border: 1px solid #999; padding: .5rem .7rem; margin-bottom: 1rem; }
.payslip-meta small { display: block; color: #444; font-size: .75rem; }
.payslip-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.payslip-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.payslip-table tfoot th { border-top: 1px solid #000; border-bottom: 0; }
.payslip-net { display: flex; justify-content: space-between; align-items: baseline; border: 2px solid #000; padding: .55rem .8rem; margin: 1rem 0 .3rem; font-size: 1.05rem; }
.payslip-net strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .payslip-cols { grid-template-columns: 1fr; } }

/* ---------- relatórios da membresia ---------- */
table.dist td.bar-col, table.dist th.bar-col { width: 32%; }
table.dist progress { width: 100%; height: .7rem; accent-color: var(--navy); }
details.card { margin-bottom: .8rem; }
details.card summary { cursor: pointer; }
details.card table { margin-top: .5rem; }

/* ---------- chamada de presença (celular) ---------- */
button.m-person { display: flex; align-items: center; gap: .8rem; width: 100%; min-height: 58px; text-align: left; border-radius: 12px; font-size: 1.05rem; padding: .5rem .9rem; background: #fff; border: 1px solid var(--line); }
button.m-person .box { flex: none; width: 30px; height: 30px; border: 2px solid var(--line); border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: #fff; }
button.m-person .grow { flex: 1; min-width: 0; }
button.m-person.on { background: var(--ok-bg); border-color: #b7e4c7; }
button.m-person.on .box { background: var(--ok); border-color: var(--ok); }
button.m-person:disabled { opacity: .75; }

ul.cols-list { list-style: none; padding: 0; margin: 0; columns: 1; }
ul.cols-list li { padding: .15rem 0; border-bottom: 1px solid var(--line); }
a.btn.wa { background: #e8f8ee; border-color: #b7e4c7; color: #146c3a; text-decoration: none; }

.scan-row { margin-bottom: .8rem; padding: .6rem .8rem; background: #eef4ff; border: 1px dashed #b6c8ee; border-radius: 8px; }

/* ---------- contracheque (modelo moderno) ---------- */
@page payslip { size: A4 portrait; margin: 11mm; }
.ps { --ps-ink: #1b2733; --ps-mute: #64748b; --ps-line: #e3e8ef; --ps-navy: #1f3a5f; --ps-green: #1f7a55; --ps-red: #b4232a;
  page: payslip; width: 100%; max-width: 190mm; margin: 0 auto; color: var(--ps-ink); background: #fff;
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; font-size: 10.5pt; line-height: 1.4;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.ps * { box-sizing: border-box; }
.ps .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ps small { display: block; color: var(--ps-mute); font-size: .78em; letter-spacing: .03em; }
.ps h3 { margin: 0 0 .35rem; font-size: .78em; letter-spacing: .1em; text-transform: uppercase; }
.ps table { width: 100%; border-collapse: collapse; }
.ps td, .ps th { padding: .38rem .55rem; border: 0; border-bottom: 1px solid var(--ps-line); text-align: left; font-size: 1em; background: none; color: inherit; position: static; }
.ps th { color: var(--ps-mute); font-size: .78em; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
.ps th.num { text-align: right; }
.ps tbody tr:nth-child(even) td { background: #f6f8fb; }

.ps-head { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.2rem; background: var(--ps-navy); color: #fff; border-radius: 12px 12px 0 0; }
.ps-logo { height: 54px; max-width: 120px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.ps-church { flex: 1; min-width: 0; }
.ps-church strong { display: block; font-size: 1.25em; letter-spacing: .01em; }
.ps-church small { color: #c6d3e8; }
.ps-title { text-align: right; }
.ps-title span { display: block; font-size: .72em; letter-spacing: .28em; color: #c6d3e8; }
.ps-title strong { display: block; font-size: 1.35em; }
.ps-title small { color: #c6d3e8; }

.ps-person { display: grid; grid-template-columns: 2fr 1.3fr 1.2fr; gap: .7rem 1.2rem; padding: 1rem 1.2rem; border: 1px solid var(--ps-line); border-top: 0; background: #f6f8fb; }
.ps-field small { margin-bottom: .1rem; }
.ps-field strong { font-size: 1.02em; }
.ps-field.wide strong { font-size: 1.25em; color: var(--ps-navy); }
.ps-state { justify-self: end; align-self: end; font-size: .68em; font-weight: 700; letter-spacing: .12em; padding: .25rem .65rem; border-radius: 999px; border: 1.5px solid currentColor; }
.ps-state.ok { color: var(--ps-green); background: #e7f5ee; }
.ps-state.part { color: #a15c00; background: #fff4e0; }
.ps-state.open { color: var(--ps-mute); background: #eef1f5; }

.ps-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.ps-list { border: 1px solid var(--ps-line); border-radius: 10px; overflow: hidden; break-inside: avoid; }
.ps-list h3 { margin: 0; padding: .55rem .8rem; color: #fff; }
.ps-list.earn h3 { background: var(--ps-green); }
.ps-list.ded h3 { background: var(--ps-red); }
.ps-none { color: var(--ps-mute); font-style: italic; }
.ps-subtotal { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .8rem; font-size: .95em; background: #f6f8fb; border-top: 1px solid var(--ps-line); font-variant-numeric: tabular-nums; }

.ps-summary { display: grid; grid-template-columns: 1fr 1fr 1.5fr; gap: .8rem; align-items: stretch; break-inside: avoid; }
.ps-box { border: 1px solid var(--ps-line); border-radius: 10px; padding: .7rem .9rem; }
.ps-box strong { display: block; font-size: 1.2em; font-variant-numeric: tabular-nums; }
.ps-net { border-radius: 10px; padding: .7rem 1rem; background: var(--ps-navy); color: #fff; }
.ps-net small { color: #c6d3e8; letter-spacing: .12em; }
.ps-net strong { display: block; font-size: 1.9em; line-height: 1.15; font-variant-numeric: tabular-nums; }
.ps-extenso { margin: .5rem 0 1rem; text-align: right; color: var(--ps-mute); font-style: italic; }

.ps-pay { border: 1px solid var(--ps-line); border-radius: 10px; overflow: hidden; margin-bottom: 1rem; break-inside: avoid; }
.ps-pay h3 { margin: 0; padding: .55rem .8rem; background: #eef1f5; color: var(--ps-navy); }
.ps-notes, .ps-receipt { margin: .5rem 0; padding: .6rem .8rem; border-left: 3px solid var(--ps-navy); background: #f6f8fb; border-radius: 0 8px 8px 0; }
.ps-receipt { border-left-color: var(--ps-green); }

.ps-sign { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; margin-top: 2.6rem; break-inside: avoid; }
.ps-sign > div { text-align: center; }
.ps-sign span { display: block; min-height: 1.3em; border-top: 1px solid var(--ps-ink); padding-top: .3rem; font-weight: 600; }
.ps-foot { margin-top: 1.4rem; padding-top: .6rem; border-top: 1px dashed var(--ps-line); text-align: center; color: var(--ps-mute); font-size: .8em; }
.ps-preview { padding: .5rem; background: #e9edf3; border-radius: 10px; }
.ps-preview .ps { box-shadow: 0 2px 14px rgba(0, 0, 0, .12); }
@media (max-width: 720px) {
  .ps-person, .ps-cols, .ps-summary, .ps-sign { grid-template-columns: 1fr; }
  .ps-state { justify-self: start; }
  .ps-head { flex-wrap: wrap; }
}
@media print { #print-area .ps { max-width: none; box-shadow: none; } }

/* =====================================================================================================
   Identidade visual única (mesma linguagem do contracheque): azul-marinho, verde e vermelho, cartões com
   cabeçalho colorido, tabelas listradas e números destacados. Vale para a tela e para os relatórios.
   ===================================================================================================== */
:root {
  --navy: #1f3a5f; --navy-dark: #152a47; --accent: #1f7a55; --danger: #b4232a; --danger-bg: #fdf0f0;
  --ok: #1f7a55; --ok-bg: #e7f5ee; --warn: #a15c00; --warn-bg: #fff4e0;
  --bg: #f3f6fa; --line: #e3e8ef; --soft: #f6f8fb; --muted: #64748b; --text: #1b2733; --radius: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif;
}
body { background: var(--bg); }
.sidebar { background: linear-gradient(180deg, var(--navy) 0%, var(--navy-dark) 100%); }
.nav a { border-left: 3px solid transparent; }
.nav a.active { background: rgba(255,255,255,.14); border-left-color: #7fd1a7; }
.nav-badge { float: right; min-width: 1.4rem; text-align: center; padding: 0 .4rem; border-radius: 999px; background: #e0a800; color: #1b2733; font-size: .75rem; font-weight: 700; }

.page-head { background: var(--navy); color: #fff; padding: .9rem 1.2rem; border-radius: var(--radius); margin-bottom: 1.2rem; box-shadow: 0 2px 10px rgba(31,58,95,.18); }
.page-head h1 { font-size: 1.3rem; letter-spacing: .01em; }
.page-head button, .page-head .btn { border-color: transparent; }
.page-head button.primary, .page-head .btn.primary { background: #fff; color: var(--navy); border-color: #fff; font-weight: 600; }
.page-head button.primary:hover, .page-head .btn.primary:hover { background: #eaf0f8; }
.page-head button.sm { background: rgba(255,255,255,.14); color: #fff; }
.page-head button.sm:hover { background: rgba(255,255,255,.24); }

.card { border-radius: var(--radius); box-shadow: 0 1px 3px rgba(16,24,40,.06); transition: box-shadow .15s, transform .15s; }
tr.clickable, .m-card, .sermon a { transition: background .12s; }
.card > h2:first-child { color: var(--navy); font-size: 1rem; text-transform: uppercase; letter-spacing: .06em; padding-bottom: .5rem; border-bottom: 2px solid var(--line); margin-bottom: .9rem; }
.card.stat { border-top: 4px solid var(--navy); display: flex; flex-direction: column; justify-content: center; gap: .1rem; min-height: 92px; }
.card.stat .value { font-variant-numeric: tabular-nums; color: var(--navy); }
.card.stat .value.pos { color: var(--ok); } .card.stat .value.neg { color: var(--danger); }
.grid.cols-4 > .card.stat:nth-child(3n+2) { border-top-color: var(--accent); }
.grid.cols-4 > .card.stat:nth-child(3n) { border-top-color: #b8862b; }

button, .btn { border-radius: 10px; }
button.primary, .btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
button.green { background: var(--accent); border-color: var(--accent); }
button.green:hover { background: #196a49; }
button.danger { color: var(--danger); border-color: #efc2c4; background: #fff; }
input, select, textarea { border-radius: 10px; border-color: #d2d9e3; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); outline: 2px solid rgba(31,58,95,.25); outline-offset: 0; }

table th { background: #eef2f7; color: #4b5b70; font-weight: 600; }
.card table tbody tr:nth-child(even) td { background: var(--soft); }
tr.clickable:hover td { background: #eaf1fb !important; }
tfoot td { background: #eef2f7; }
.badge { font-weight: 600; }
.notice { background: #eef4ff; border-color: #cddcf5; border-radius: 10px; }
.tabs button.active { border-bottom-color: var(--accent); color: var(--navy); }

dialog { border-radius: 14px; overflow: hidden; }
dialog.wide { width: min(980px, calc(100vw - 2rem)); }
.dlg-head { background: var(--navy); color: #fff; border-bottom: 0; }
.dlg-head h2 { color: #fff; font-size: 1.05rem; }
.dlg-head button { background: rgba(255,255,255,.14); border-color: transparent; color: #fff; }
.dlg-head button:hover { background: rgba(255,255,255,.26); }
.dlg-body { max-height: calc(100vh - 8rem); overflow: auto; }

/* ---------- documentos impressos e relatórios (.doc) no mesmo padrão do contracheque ---------- */
.doc { font-family: "Segoe UI", system-ui, -apple-system, Helvetica, Arial, sans-serif; color: var(--text); max-width: 190mm; line-height: 1.4; font-size: 10.5pt;
  -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.doc .doc-head { display: flex; align-items: center; gap: 1rem; padding: .9rem 1.1rem; background: var(--navy); color: #fff; border: 0; border-radius: 12px 12px 0 0; margin-bottom: 1rem; text-align: left; }
.doc .doc-head small { color: #c6d3e8; display: block; }
.doc .doc-logo { height: 48px; max-width: 110px; object-fit: contain; background: #fff; border-radius: 8px; padding: 4px; }
.doc .dh-church { flex: 1; min-width: 0; }
.doc .dh-church strong { display: block; font-size: 1.2em; }
.doc .dh-title { text-align: right; }
.doc .dh-title h1 { margin: 0; font-size: 1.3em; text-align: right; color: #fff; }
.doc h2, .doc h3 { color: var(--navy); font-size: .85em; text-transform: uppercase; letter-spacing: .08em; border-bottom: 2px solid var(--line); padding-bottom: .25rem; margin: 1rem 0 .5rem; }
.doc table th { background: #eef2f7; color: #4b5b70; border-bottom: 1px solid #cfd8e3; font-size: .78em; text-transform: uppercase; letter-spacing: .05em; position: static; }
.doc td, .doc th { border-bottom: 1px solid var(--line); }
.doc tbody tr:nth-child(even) td { background: var(--soft); }
.doc tfoot td, .doc tfoot th { background: #eef2f7; font-weight: 700; }
.doc .num { font-variant-numeric: tabular-nums; }
.doc p { line-height: 1.5; }
.doc .grid { display: grid; gap: 1rem; }
.doc .card { box-shadow: none; }
@media print { .doc { max-width: none; } }

/* ---------- assinatura digital ---------- */
.sigs { margin-top: 1.4rem; break-inside: avoid; }
.sigs h3 { color: var(--navy); font-size: .8em; text-transform: uppercase; letter-spacing: .1em; border-bottom: 2px solid var(--line); padding-bottom: .25rem; margin: 0 0 .8rem; }
.sig-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 1.6rem 1.4rem; }
.sig { text-align: center; }
.sig-stamp { min-height: 3.1rem; margin-bottom: .2rem; padding: .3rem .4rem; border: 1.5px solid var(--accent); border-radius: 8px; background: #f0faf5; color: var(--accent); }
.sig-stamp strong { display: block; font-size: .8em; letter-spacing: .04em; }
.sig-stamp small { display: block; color: #3d6b56; font-size: .72em; }
.sig-stamp.empty { border-color: transparent; background: none; }
.sig-line { display: block; border-top: 1px solid var(--text); padding-top: .3rem; font-weight: 600; }
.sig small { display: block; color: var(--muted); font-size: .78em; }
.sig-verify { margin: 1rem 0 0; padding: .5rem .7rem; border-top: 1px dashed var(--line); color: var(--muted); font-size: .72em; text-align: center; word-break: break-all; }
.sign-panel { margin-bottom: 1rem; }
.sign-list { list-style: none; margin: .5rem 0; padding: 0; }
.sign-list li { padding: .25rem 0; border-bottom: 1px solid var(--line); }
.sign-card { margin: .8rem 0; background: var(--soft); }
.sign-notice { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; background: #fff8e6; border-color: #f0d98a; margin-bottom: 1rem; }
.public-wrap { max-width: 760px; margin: 0 auto; padding: 1.5rem 1rem; }
.public-head { display: flex; align-items: center; gap: 1rem; background: var(--navy); color: #fff; padding: 1rem 1.2rem; border-radius: var(--radius); margin-bottom: 1rem; }
.public-head small { display: block; color: #c6d3e8; }
.public-head .login-logo { height: 46px; background: #fff; border-radius: 8px; padding: 4px; }
.card.verify.ok { border-top: 4px solid var(--accent); }
.card.verify.bad { border-top: 4px solid var(--danger); }
.ps .sigs { margin-top: 1.6rem; }
.board-grid { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.board-grid .column, .column { display: flex; flex-direction: column; gap: .3rem; }

.access-card { margin-top: 1rem; border-top: 4px solid var(--accent); }
input.mono { font-family: Consolas, "Courier New", monospace; font-size: 1.1rem; letter-spacing: .05em; }

/* ---------- rodapé com a versão ---------- */
.app-foot { margin: 2rem 0 .5rem; text-align: center; color: var(--muted); font-size: .78rem; letter-spacing: .02em; }
.login .app-foot { margin: 1.4rem 0 0; }
@media print { .app-foot { display: none; } }

/* ---------- rascunho: documento impresso antes de todas as assinaturas ---------- */
.draft-foot { margin-top: 1.4rem; padding: .5rem .7rem; border: 1.5px dashed #b42318; border-radius: 6px; background: #fff5f4; color: #b42318; text-align: center; font-size: .78rem; letter-spacing: .02em; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
@media print {
  #print-area .draft-foot { position: fixed; left: 0; right: 0; bottom: 0; margin: 0; background: #fff; }
  #print-area:has(.draft-foot) { padding-bottom: 14mm; }
}

/* ---------- avisos e notificações ---------- */
.announcement { padding: .7rem 0; border-bottom: 1px solid var(--line); }
.announcement:last-child { border-bottom: 0; }
.announcement p { margin: .3rem 0 0; white-space: pre-wrap; }
.announcement .row { align-items: baseline; }
.push-banner { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }

/* ---------- PDF no celular: palco fora da vista, com a largura do papel ---------- */
.pdf-stage { position: absolute; left: 0; top: 0; z-index: -1; background: #fff; color: #000; box-sizing: border-box; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.pdf-stage .doc, .pdf-stage .cert-wrap, .pdf-stage .ps { max-width: none; box-shadow: none; }
.pdf-actions { align-items: stretch; gap: .6rem; margin: .8rem 0; }
.pdf-actions .btn, .pdf-actions button { text-align: center; padding: .8rem 1rem; }

/* ---------- autocadastro ---------- */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.row .grow { flex: 1 1 260px; min-width: 0; }
button.big { padding: .9rem 1.2rem; font-size: 1.05rem; width: 100%; }
.card.done { text-align: center; padding: 2rem 1rem; }

/* ---------- sermões ---------- */
.sermon { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.sermon:last-child { border-bottom: 0; }
.sermon .row { align-items: baseline; }
.sermon p { margin: .3rem 0; white-space: pre-wrap; }
.announcement-img { display: block; max-width: 100%; max-height: 360px; margin-top: .5rem; border-radius: 10px; border: 1px solid var(--line); object-fit: contain; background: #fff; }

/* ---------- versículo, PIX, agenda e página da igreja ---------- */
.verse { margin: .9rem 0 0; padding: .7rem .9rem; border-left: 3px solid var(--navy); background: #f4f7fb; border-radius: 0 8px 8px 0; font-family: Georgia, "Times New Roman", serif; font-style: italic; color: #2b3a4f; line-height: 1.5; }
.verse cite { display: block; margin-top: .35rem; font-style: normal; font-size: .82rem; color: var(--muted); }
.login-links { text-align: center; margin: 1rem 0 0; font-size: .9rem; }
.pix-key { display: grid; gap: .15rem; margin: .6rem 0 .9rem; padding: .8rem 1rem; border: 1px dashed #1f7a55; border-radius: 10px; background: #f0faf5; }
.pix-key strong { font-size: 1.35rem; letter-spacing: .03em; color: #14563b; word-break: break-all; }
.install-card ol { margin: .4rem 0 0; padding-left: 1.2rem; line-height: 1.6; }
.schedule { display: grid; gap: .9rem; }
.sch-day h3 { margin: 0 0 .3rem; font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; color: var(--navy); display: flex; gap: .5rem; align-items: center; }
.sch-day.today { background: #f0faf5; border-radius: 10px; padding: .5rem .7rem; }
.sch-row { display: flex; gap: .8rem; align-items: baseline; padding: .25rem 0; }
.sch-time { min-width: 3.2rem; font-variant-numeric: tabular-nums; color: var(--navy); }
.sch-row.is-event { font-weight: 500; }
.sch-row.struck .sch-title, .sch-row.struck .sch-time { text-decoration: line-through; opacity: .55; }
.sch-note { color: var(--danger); font-size: .8rem; }

/* ---------- carteira sem a assinatura do Pastor Presidente ---------- */
.idc-void { position: absolute; inset: auto 0 0 0; z-index: 3; padding: 1.2mm 2mm; background: #b42318; color: #fff; text-align: center; font-size: 2.1mm; font-weight: 700; letter-spacing: .2mm; text-transform: uppercase; }

/* ---------- validação pública da carteira ---------- */
.cardv-photo { width: 30mm; height: 40mm; max-width: 40vw; object-fit: cover; border: 1px solid var(--line); border-radius: 6px; justify-self: center; }
.cardv { display: grid; gap: .6rem; }
.cardv-row { display: grid; gap: .1rem; }
.cardv-row strong { font-size: 1.1rem; }
input.upper { text-transform: uppercase; }

/* ---------- aparência (paletas) ---------- */
.theme-choices { gap: .8rem; flex-wrap: wrap; }
.theme-choice { display: inline-flex; align-items: center; gap: .6rem; padding: .6rem .9rem; border: 2px solid var(--line); border-radius: 12px; background: var(--card); cursor: pointer; }
.theme-choice.active { border-color: var(--navy); font-weight: 600; }
.theme-swatch { width: 1.6rem; height: 1.6rem; border-radius: 50%; border: 1px solid #aab; background: linear-gradient(135deg, #1f3a5f 50%, #f3f5f8 50%); }
.theme-choice.bw .theme-swatch { background: linear-gradient(135deg, #111 50%, #fff 50%); }

/* ---------- aniversariantes (área do membro) ---------- */
.birthday-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.birthday-list li { padding: .3rem .5rem; border-radius: 8px; }
.birthday-list li.today { background: var(--ok-bg); }

/* ---------- documentos anexados aos lançamentos ---------- */
.files-list { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: .5rem; }
.files-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; padding: .5rem .7rem; border: 1px solid #dbe2ec; border-radius: 10px; background: #fff; }
.files-list li a { font-weight: 600; word-break: break-all; }

/* ---------- usuários: blocos Administração / Geral ---------- */
.section-title { margin: 1.4rem 0 .3rem; font-size: 1.05rem; color: var(--navy); }

/* ---------- árvore da família ---------- */
.ftree { --fline: #9aa8bd; display: block; width: max-content; margin: 0 auto; padding: .4rem; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.tree-scroll { overflow-x: auto; padding: .5rem 0; }
.tree-measure { position: absolute; left: -99999px; top: 0; width: max-content; visibility: hidden; }
.tree-center { display: flex; justify-content: center; margin-top: .6rem; }
.tree-fit { overflow: hidden; }
.tree-page { page: treepage; }
@page treepage { size: A4 landscape; margin: 8mm; }
.fheart { color: #d6336c; font-size: 1.5rem; line-height: 1; align-self: center; }
.fcard { display: grid; justify-items: center; gap: .1rem; align-content: start; text-align: center; width: 9.5rem; padding: .5rem .5rem .6rem; border: 1px solid #cfd8e6; border-top: 4px solid #aab4c4; border-radius: 12px; background: #fff; box-shadow: 0 1px 3px rgba(16, 24, 40, .08); }
.fcard.m { border-top-color: #6d9be0; }
.fcard.f { border-top-color: #e58ab0; }
.fcard.self { border-color: var(--navy); border-top-color: var(--navy); background: #eef4ff; box-shadow: 0 0 0 2px var(--navy); }
.fcard.ghost { border-style: dashed; background: #fafbfc; box-shadow: none; }
.fcard.gone { background: #f4f4f5; }
.fcard.empty { border-style: dashed; border-top-style: dashed; color: var(--muted); font-size: .8rem; align-content: center; min-height: 5rem; box-shadow: none; }
.fcard strong { font-size: .82rem; line-height: 1.2; }
.fcard small { font-size: .7rem; }
.fcap { font-size: .62rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.frole { color: var(--navy); font-weight: 600; }
.favatar { width: 3.6rem; height: 3.6rem; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd8e6; background: #e8edf5; }
.favatar.none { display: grid; place-items: center; font-weight: 700; color: #51607a; font-size: 1.1rem; }
.favatar.none.m { background: #dce8fb; color: #2b5aa8; }
.favatar.none.f { background: #fbe0ec; color: #b03a6c; }
.frow { display: flex; align-items: center; justify-content: center; gap: .4rem; }
/* ancestrais: cada casal tem em cima os casais das duas pessoas, ligados por linhas */
.cu { display: grid; justify-items: stretch; }
.cu-up, .cu-pair { display: grid; grid-template-columns: 1fr 1fr; column-gap: 2.4rem; }
.cu-branch { position: relative; padding-bottom: 1.2rem; }
.cu-branch.has::after { content: ''; position: absolute; left: 50%; bottom: 0; height: 1.2rem; border-left: 2px solid var(--fline); }
.cu-pair { position: relative; }
.cu-pair > .fcard { justify-self: center; }
.cu-pair > .fheart { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 1; }
.cu-pair:not(.both) { grid-template-columns: 1fr 1fr; }
/* descendentes: árvore com ligações (ul/li) */
.ft { display: flex; justify-content: center; margin: 0; padding: 1.2rem 0 0; list-style: none; position: relative; }
.ft > li { position: relative; padding: 1.2rem .5rem 0; display: flex; flex-direction: column; align-items: center; }
.ft > li::before, .ft > li::after { content: ''; position: absolute; top: 0; right: 50%; width: 50%; height: 1.2rem; border-top: 2px solid var(--fline); }
.ft > li::after { right: auto; left: 50%; border-left: 2px solid var(--fline); }
.ft > li:only-child::before, .ft > li:only-child::after { display: none; }
.ft > li:only-child { padding-top: 0; }
.ft > li:first-child::before, .ft > li:last-child::after { border: 0 none; }
.ft > li:last-child::before { border-right: 2px solid var(--fline); border-radius: 0 8px 0 0; }
.ft > li:first-child::after { border-radius: 8px 0 0 0; }
.ft ul.ft::before, .ft.kids::before { content: ''; position: absolute; top: 0; left: 50%; height: 1.2rem; border-left: 2px solid var(--fline); }
.ft.solo { padding-top: 0; }
.ft.solo::before { display: none; }
.ftree.compact .fcard { width: 6.6rem; padding: .3rem .3rem .4rem; border-radius: 9px; }
.ftree.compact .favatar { width: 2.6rem; height: 2.6rem; }
.ftree.compact .fcard strong { font-size: .68rem; }
.ftree.compact .fcard small { font-size: .58rem; }
.ftree.compact .fheart { font-size: 1.1rem; }
.ftree.compact .cu-up, .ftree.compact .cu-pair { column-gap: 1.4rem; }
.cu-pair.both::before { content: ''; position: absolute; left: 25%; right: 25%; top: 50%; border-top: 2px dashed #eaa6c0; }
.cu-pair > .fcard { position: relative; z-index: 1; }
.cu-pair > .fheart { z-index: 2; background: #fff; padding: 0 .2rem; }
.tree-page .dh-title h1 { font-size: 1.1rem; }
