/* Tema preto do Ministério Clown */
:root {
  --bg: #000000;
  --card: #121212;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #27272a;
  --primary: #ff3fa4;
  --primary-soft: #3b0f27;
  --ok: #4ade80;
  --ok-soft: #10301d;
  --warn: #fbbf24;
  --warn-soft: #3a2a08;
  --bad: #f87171;
  --bad-soft: #3d1414;
  --radius: 14px;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.1rem; margin-top: 1.5rem; }
p { margin: .25rem 0 .75rem; }
small, .muted { color: var(--muted); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  background: var(--card); border-bottom: 1px solid var(--line);
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
}
.brand { display: flex; align-items: center; gap: 10px; max-width: 720px; margin: 0 auto; }
.brand img { width: 34px; height: 34px; border-radius: 9px; }
.brand div { display: flex; flex-direction: column; line-height: 1.15; }
.brand small { font-size: .78rem; }

.view { max-width: 720px; margin: 0 auto; padding: 16px 16px calc(90px + env(safe-area-inset-bottom)); }
.loading { padding: 3rem 0; text-align: center; color: var(--muted); }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: center;
  background: var(--card); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center;
  padding: 8px 0 7px; font-size: .72rem; color: var(--muted); text-decoration: none;
}
.tabbar .ico { font-size: 1.25rem; line-height: 1.3; }
.tabbar a.active { color: var(--primary); font-weight: 600; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 14px 16px; margin-bottom: 10px;
}
.card.click { cursor: pointer; }
.card.click:active { transform: scale(.995); }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 8px; }
.title-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.title-row h1, .title-row h2 { margin: 0; }
.empty { text-align: center; color: var(--muted); padding: 1.5rem 1rem; border: 1px dashed var(--line); border-radius: var(--radius); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.cifra { font-family: ui-monospace, Consolas, monospace; font-size: .9rem; white-space: pre; overflow-x: auto; background: var(--bg); padding: 12px; border-radius: 10px; }

.date-badge {
  flex: none; width: 52px; text-align: center; border-radius: 12px;
  background: var(--primary-soft); color: var(--primary); padding: 6px 0; line-height: 1.1;
}
.date-badge b { display: block; font-size: 1.3rem; }
.date-badge span { font-size: .72rem; text-transform: uppercase; }

.tag { display: inline-block; font-size: .74rem; padding: 2px 8px; border-radius: 99px; background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.bad { background: var(--bad-soft); color: var(--bad); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

button, .btn {
  font: inherit; font-size: .92rem; font-weight: 600; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 8px 14px; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
}
button.primary { background: var(--primary); border-color: var(--primary); color: #000; }
button.ok { color: var(--ok); }
button.bad { color: var(--bad); }
button.small { padding: 5px 10px; font-size: .82rem; }
button.full { width: 100%; justify-content: center; padding: 11px; }
button:disabled { opacity: .55; cursor: default; }
button.link { border: 0; background: none; color: var(--primary); padding: 4px 0; }
button.on { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

label { display: block; font-size: .85rem; font-weight: 600; margin: 10px 0 4px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: .95rem; }
input, select, textarea {
  font: inherit; width: 100%; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
}
label.check input { width: auto; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
.search { margin-bottom: 12px; }

.auth { max-width: 380px; margin: 6vh auto 0; }
.auth .logo { text-align: center; margin-bottom: 18px; }
.auth .logo img { width: 64px; height: 64px; border-radius: 16px; }
.seg { display: flex; background: var(--line); border-radius: 10px; padding: 3px; margin-bottom: 8px; }
.seg button { flex: 1; border: 0; background: none; justify-content: center; }
.seg button.on { background: var(--card); color: var(--text); }

.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; cursor: pointer; }
.list-item:last-child { border-bottom: 0; }
.list { padding: 0; overflow: hidden; }
.avatar { flex: none; width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); font-weight: 700; }

dialog {
  border: 0; padding: 0; border-radius: 18px; width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 40px); background: var(--card); color: var(--text);
}
dialog::backdrop { background: rgba(10, 8, 25, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--card); z-index: 1; }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-body { padding: 4px 16px 16px; }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.x { border: 0; background: none; font-size: 1.4rem; padding: 0 4px; color: var(--muted); }

.toast {
  position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }

/* foto do ministério */
.auth .logo img.hero { width: 100%; max-width: 320px; height: auto; border-radius: 22px; box-shadow: var(--shadow); }
.banner { display: block; width: 100%; height: 180px; object-fit: cover; object-position: center 45%; border-radius: var(--radius); margin-bottom: 16px; background: #000; }
@media (min-width: 600px) { .banner { height: 280px; object-fit: contain; } }

/* celulares pequenos (iPhone SE, Androids compactos) */
@media (max-width: 360px) {
  .view { padding-left: 12px; padding-right: 12px; }
  .card { padding: 12px; }
  .date-badge { width: 46px; }
  .date-badge b { font-size: 1.15rem; }
  h1 { font-size: 1.3rem; }
  .tabbar a { font-size: .66rem; }
  .banner { height: 150px; }
}

/* fotos e aniversariantes */
img.avatar { object-fit: cover; padding: 0; background: var(--line); }
.avatar.grande { width: 88px; height: 88px; font-size: 1.7rem; margin: 0 auto 8px; }
.niver-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.card.niver { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; margin: 0; padding: 14px 10px; }
.card.niver strong { overflow-wrap: anywhere; line-height: 1.25; }
.card.niver .tag { margin-top: 6px; }
.card.niver.passou { opacity: .5; }
.niver-hoje { text-decoration: none; color: inherit; border-color: var(--primary); background: var(--primary-soft); }
.niver-hoje .avatar + .avatar { margin-left: -18px; border: 2px solid var(--primary-soft); }
.tabbar a { min-width: 0; white-space: nowrap; }
@media (max-width: 360px) {
  .tabbar a { font-size: .6rem; letter-spacing: -.2px; }
  .niver-grid { gap: 8px; }
  .avatar.grande { width: 76px; height: 76px; }
}

/* log de alterações */
.log-item { display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: .92rem; }
.log-item:last-child { border-bottom: 0; }
.log-ico { flex: none; width: 26px; text-align: center; padding: 2px 0; }
.log-hora { flex: none; color: var(--muted); font-variant-numeric: tabular-nums; }
.log-det { margin: 4px 0 0; padding-left: 16px; color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }

/* aprovações */
.pendencias { display: block; max-width: 720px; margin: 8px auto 0; padding: 8px 12px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: .88rem; text-decoration: none; }
.yt { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: #000; margin: 8px 0; }
.yt iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
