:root {
  --navy: #032854; --navy-deep: #0B132B; --navy-light: #0d3c75;
  --amber: #F97316; --gold: #FFD200;
  --bg: #f2f5f9; --card: #ffffff; --ink: #0B132B; --muted: #64748B; --line: #e2e8f0;
  --ok: #15803d; --ok-bg: #e9f7ef; --warn: #8a4b00; --warn-bg: #fff4e5; --bad: #b91c1c; --bad-bg: #fdecec; --info-bg: #eaf1fb;
  --radius: 16px;
  --shadow: 0 1px 3px rgba(11,19,43,.06), 0 4px 14px rgba(11,19,43,.05);
  --tabbar-h: 64px;
}
* { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body { font-family: 'Inter', system-ui, sans-serif; background: var(--bg); color: var(--ink); min-height: 100vh; font-size: 15px; line-height: 1.4; }
.hidden { display: none !important; }
a { color: var(--navy); }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.boot { display: grid; place-items: center; min-height: 100vh; color: var(--muted); }

/* ---------- botões e campos ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 11px 16px; border-radius: 11px; font-weight: 700; background: var(--bg); color: var(--navy); border: 1px solid var(--line); min-height: 44px; text-decoration: none; }
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
.btn.primary:hover { background: var(--navy-light); }
.btn.danger { background: var(--bad-bg); color: var(--bad); border-color: #f6caca; }
.btn.ok { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn.sm { padding: 7px 11px; min-height: 36px; font-size: .88rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 1.5rem; color: #fff; background: rgba(255,255,255,.12); }
label { display: grid; gap: 6px; font-weight: 600; font-size: .9rem; color: var(--navy); }
input[type=text], input[type=email], input[type=password], input[type=search], input:not([type]), select, textarea {
  width: 100%; padding: 12px 13px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-weight: 500; font-size: 16px; min-height: 46px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
form { display: grid; gap: 14px; }
.form-error { background: var(--bad-bg); color: var(--bad); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.form-ok { background: var(--ok-bg); color: var(--ok); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; color: var(--ink); }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--navy); flex-shrink: 0; }

/* ---------- login ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; background: linear-gradient(160deg, var(--navy-deep) 0%, var(--navy) 60%, var(--navy-light) 100%); }
.auth-card { width: 100%; max-width: 400px; background: #fff; border-radius: 22px; padding: 28px 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.auth-card h1 { font-size: 1.35rem; color: var(--navy); margin-top: 12px; }
.auth-card > p { margin: 4px 0 18px; }
.auth-logo { width: 56px; height: 56px; border-radius: 14px; object-fit: contain; }

/* ---------- topo e navegação ---------- */
.top { position: sticky; top: 0; z-index: 5; background: linear-gradient(160deg, var(--navy-deep) 0%, var(--navy) 100%); color: #fff; padding: calc(env(safe-area-inset-top) + 10px) 16px 12px; }
.top-row { max-width: 760px; margin: 0 auto; display: flex; align-items: center; gap: 10px; min-height: 44px; }
.top-title { flex: 1; min-width: 0; }
.top-title small { display: block; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.65); font-weight: 600; }
.top-title b { display: block; font-size: 1.15rem; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 8px; }
.top-actions .btn { background: rgba(255,255,255,.12); color: #fff; border-color: transparent; min-height: 38px; padding: 8px 12px; font-size: .88rem; }

main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px); outline: none; }
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: #fff; border-top: 1px solid var(--line); display: flex; justify-content: center; padding-bottom: env(safe-area-inset-bottom); }
.tabbar a { flex: 1; max-width: 160px; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--muted); text-decoration: none; font-size: .72rem; font-weight: 600; position: relative; }
.tabbar a svg { width: 24px; height: 24px; }
.tabbar a.active { color: var(--navy); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; left: 30%; right: 30%; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.tabbar .badge { position: absolute; top: 8px; left: calc(50% + 6px); }

@media (min-width: 900px) {
  .tabbar { top: 0; bottom: auto; left: 0; right: auto; width: 96px; height: 100vh; flex-direction: column; justify-content: flex-start; padding-top: 90px; border-top: 0; border-right: 1px solid var(--line); }
  .tabbar a { max-width: none; flex: 0 0 76px; }
  .tabbar a.active::before { top: 20%; bottom: 20%; left: 0; right: auto; width: 3px; height: auto; border-radius: 0 3px 3px 0; }
  body { padding-left: 96px; }
  main { padding-bottom: 40px; }
}

/* ---------- blocos ---------- */
.section-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; margin: 22px 2px 10px; }
.section-title:first-child { margin-top: 4px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; }
.stack { display: grid; gap: 10px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.hello { font-size: 1.3rem; font-weight: 800; color: var(--navy); margin: 2px 2px 2px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 1.6rem; font-weight: 800; color: var(--navy); }
.stat span { color: var(--muted); font-size: .85rem; }
.stat.hot b { color: var(--amber); }
.tile { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); text-decoration: none; color: inherit; }
.tile:active { transform: scale(.99); }
button.tile { width: 100%; text-align: left; }
.tile .ico { font-size: 1.3rem; }
.tile .ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex-shrink: 0; background: var(--navy); color: var(--gold); }
.tile .ico svg { width: 24px; height: 24px; }
.tile .txt { flex: 1; min-width: 0; }
.tile .txt b { display: block; color: var(--navy); }
.tile .txt span { display: block; color: var(--muted); font-size: .84rem; margin-top: 1px; }
.tile .go { color: var(--muted); font-size: 1.3rem; }
.empty { text-align: center; color: var(--muted); padding: 34px 12px; }
.empty b { display: block; color: var(--navy); margin-bottom: 4px; }
.note { font-size: .82rem; color: var(--muted); }

/* ---------- chips e filtros ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { text-decoration: none; flex-shrink: 0; border: 1px solid var(--line); background: #fff; color: var(--navy); padding: 8px 13px; border-radius: 99px; font-weight: 600; font-size: .86rem; min-height: 38px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.chip .n { font-size: .75rem; opacity: .75; }
.searchbar { display: flex; gap: 8px; margin: 10px 0; }
.searchbar input { flex: 1; }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--amber); color: #fff; font-size: .72rem; font-weight: 800; }
.pill { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 99px; font-size: .74rem; font-weight: 700; background: var(--info-bg); color: var(--navy); white-space: nowrap; }
.pill.new { background: #fff1e6; color: #b45309; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.muted { background: #eef1f5; color: var(--muted); }
.pill.type-voluntarios { background: #eaf6ff; color: #0369a1; }
.pill.type-historias { background: #f4ecff; color: #6d28d9; }
.pill.type-adocao { background: #fff7d6; color: #8a6100; }

/* ---------- listas ---------- */
.list { display: grid; gap: 10px; }
.item { display: block; width: 100%; text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; box-shadow: var(--shadow); }
.item:active { background: #f8fafc; }
.item-top { display: flex; align-items: center; gap: 8px; }
.item-top b { flex: 1; min-width: 0; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { color: var(--muted); font-size: .84rem; margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px 10px; }
.item-text { margin-top: 6px; font-size: .9rem; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.urg-alta { color: var(--bad); font-weight: 700; }

/* ---------- folha (bottom sheet) ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; background: rgba(11,19,43,.55); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: #fff; width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 22px 22px 0 0; padding: 8px 18px calc(env(safe-area-inset-bottom) + 22px); overscroll-behavior: contain; }
.sheet::before { content: ""; display: block; width: 42px; height: 5px; border-radius: 3px; background: #d6dbe3; margin: 4px auto 12px; }
@media (min-width: 700px) { .sheet-wrap { align-items: center; } .sheet { border-radius: 22px; } }
.sheet-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.sheet-head h2 { flex: 1; font-size: 1.15rem; color: var(--navy); }
.sheet-close { width: 36px; height: 36px; border-radius: 50%; background: var(--bg); color: var(--muted); font-size: 1.1rem; flex-shrink: 0; }
.kv { display: grid; gap: 10px; margin-bottom: 16px; }
.kv div { display: grid; gap: 2px; }
.kv dt { font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; }
.kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.actions .btn { flex: 1 1 140px; }
.media { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin-bottom: 14px; }
.media a { display: block; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); position: relative; }
.media img { width: 100%; height: 100%; object-fit: cover; }
.media .vid { position: absolute; inset: 0; display: grid; place-items: center; font-size: .8rem; font-weight: 700; color: var(--navy); }
.secret { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.05rem; background: var(--bg); border: 1px dashed var(--navy); border-radius: 10px; padding: 12px; text-align: center; user-select: all; word-break: break-all; }

/* ---------- editor de perfil ---------- */
.svc { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #fff; }
.svc + .svc { margin-top: 10px; }
.svc summary { list-style: none; padding: 14px; display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 700; color: var(--navy); }
.svc summary::-webkit-details-marker { display: none; }
.svc summary .count { margin-left: auto; color: var(--muted); font-weight: 600; font-size: .82rem; }
.svc summary::after { content: "›"; color: var(--muted); font-size: 1.3rem; transition: transform .15s; }
.svc[open] summary::after { transform: rotate(90deg); }
.svc .body { padding: 0 14px 14px; display: grid; gap: 12px; }
.svc .desc { font-size: .84rem; color: var(--muted); }
.screen { border-top: 1px solid var(--line); padding-top: 12px; }
.screen b { display: block; font-size: .92rem; }
.screen small { display: block; color: var(--muted); font-size: .8rem; margin-top: 2px; }
.acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.act { border: 1px solid var(--line); border-radius: 99px; padding: 7px 12px; font-size: .84rem; font-weight: 600; background: #fff; color: var(--muted); min-height: 36px; }
.act.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.act:disabled { opacity: .45; }

/* ---------- interruptor ---------- */
.switch-row { display: flex; align-items: center; gap: 12px; }
.switch-row .txt { flex: 1; }
.switch { position: relative; width: 52px; height: 30px; flex-shrink: 0; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: #cbd5e1; transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch input:checked + span { background: #16a34a; }
.switch input:checked + span::after { transform: translateX(22px); }
.switch input:disabled + span { opacity: .5; }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 14px); z-index: 30; background: var(--navy-deep); color: #fff; padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.25); }
.toast.bad { background: var(--bad); }
.qr svg { width: 200px; height: 200px; display: block; margin: 0 auto; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-family: ui-monospace, Menlo, monospace; text-align: center; }
.codes span { background: var(--bg); border-radius: 8px; padding: 8px; }
