:root {
  --primary: #1e3c72;
  --primary-2: #2a5298;
  --secondary: #4a7bb0;
  --accent-theme: #f57c00;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
  --kids: #e91e63;
  --oracao: #4caf50;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --shadow: 0 4px 16px rgba(15, 23, 42, 0.08);
  --radius: 16px;
  --sidebar: 300px;
  --sidebar-start: var(--primary);
  --sidebar-end: var(--primary-2);
  --login-start: var(--primary);
  --login-mid: var(--primary-2);
  --login-end: var(--secondary);
  --ghost-bg: color-mix(in srgb, var(--primary) 10%, white);
  --badge-bg: color-mix(in srgb, var(--primary) 12%, white);
  --focus-ring: color-mix(in srgb, var(--primary) 25%, transparent);
}

/* Modo escuro "Chama" — neutros quentes (carvao) em harmonia com o logo IAR */
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f0c0a;
  --card: #171310;
  --text: #f4eee6;
  --muted: #a99f93;
  --border: #2c251e;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.45);
  --ghost-bg: color-mix(in srgb, var(--primary) 24%, #171310);
  --badge-bg: color-mix(in srgb, var(--primary) 26%, #171310);
  --focus-ring: color-mix(in srgb, var(--primary) 45%, transparent);
}

/* clip (nao hidden): evita barra horizontal SEM quebrar o sticky da sidebar */
html { width: 100%; overflow-x: clip; }
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: "Poppins", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  width: 100%;
  max-width: 100%;
  overflow-x: clip;
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }

/* LOGIN */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 20%, color-mix(in srgb, var(--secondary) 35%, transparent), transparent 40%),
    linear-gradient(135deg, var(--login-start), var(--login-mid) 55%, var(--login-end));
}
.login-card {
  width: min(440px, 100%);
  background: color-mix(in srgb, var(--card) 96%, transparent);
  border-radius: 24px;
  padding: 32px 28px;
  box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.login-brand {
  text-align: center;
  margin-bottom: 24px;
}
.login-brand .logo {
  width: 168px; height: 168px; border-radius: 36px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  color: #fff; display: grid; place-items: center;
  font-size: 3.4rem; margin: 0 auto 18px;
  box-shadow: var(--shadow);
}
.login-brand h1 { font-size: 2.15rem; font-weight: 800; line-height: 1.2; margin: 0 0 8px; }
.login-brand p { color: var(--muted); font-size: 1.02rem; }
.login-tagline { color: var(--muted); font-size: 0.95rem; margin: 0; }
.login-register-btn { width: 100%; margin-top: 14px; }
.login-sync-box { margin-top: 16px; }
.login-sync-toggle { width: 100%; }
.login-sync-panel {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 92%, var(--primary) 8%);
}
.login-sync-help { font-size: 0.82rem; margin: 0 0 10px; }
.login-church-code-show {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #ecfdf5;
  color: #166534;
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  word-break: break-all;
}
html[data-theme="dark"] .login-church-code-show {
  background: color-mix(in srgb, #166534 35%, #171310);
  color: #bbf7d0;
}
.login-demo {
  margin-top: 18px;
  font-size: 0.82rem;
  color: var(--muted);
}
.login-demo summary {
  cursor: pointer;
  font-weight: 600;
  padding: 6px 0;
}
.login-demo .quick-roles { margin-top: 10px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: .82rem; font-weight: 600; margin-bottom: 6px; color: var(--muted); }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 12px 14px; border: 1px solid var(--border);
  border-radius: 12px; background: var(--card); color: var(--text); outline: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus {
  border-color: var(--secondary); box-shadow: 0 0 0 3px var(--focus-ring);
}
.btn {
  border: 0; border-radius: 12px; padding: 12px 16px; font-weight: 600;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: .2s ease;
}
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-2)); color: #fff; width: 100%; }
.btn-primary:hover { transform: translateY(-1px); filter: brightness(1.05); }
.btn-ghost { background: var(--ghost-bg); color: var(--primary); }
.btn:disabled,
.btn[disabled],
.btn[aria-disabled="true"] {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
  filter: grayscale(0.25);
  box-shadow: none;
  pointer-events: auto; /* permite toast explicando o bloqueio (aria-disabled) */
}
.btn-danger { background: #fee2e2; color: #b91c1c; }
.btn-success { background: #dcfce7; color: #166534; }
.btn-sm { padding: 8px 12px; font-size: .85rem; border-radius: 10px; }
.quick-roles { display: grid; gap: 8px; margin-top: 16px; }
.quick-roles button {
  border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 12px;
  padding: 10px 12px; text-align: left; cursor: pointer;
}
.quick-roles button:hover { border-color: var(--secondary); background: var(--ghost-bg); }
.quick-roles small { color: var(--muted); display: block; }
.login-error { color: var(--danger); font-size: .85rem; margin-top: 8px; min-height: 1.2em; }

/* APP SHELL */
.app-shell { display: flex; min-height: 100vh; max-width: 100%; overflow-x: clip; }
/* Rolagem unica (padrao de sites profissionais com menu lateral longo):
   a sidebar acompanha a rolagem da pagina e o fundo escuro estica ate o fim. */
.sidebar {
  width: var(--sidebar); background: linear-gradient(180deg, var(--sidebar-start), var(--sidebar-end));
  color: #fff; padding: 22px 16px;
  min-height: 100vh;
  display: flex; flex-direction: column; gap: 18px;
  flex-shrink: 0;
}
.sidebar .brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 16px;
  text-align: center;
}
.sidebar .brand .mark {
  width: 128px; height: 128px; border-radius: 28px; background: rgba(255,255,255,.18);
  display: grid; place-items: center; flex-shrink: 0; font-size: 2.8rem; overflow: hidden;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.18);
}
.sidebar .brand strong {
  display: block;
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1.2;
  word-break: break-word;
  letter-spacing: -0.01em;
}
.sidebar .brand > div:last-child {
  font-size: .95rem;
  opacity: .95;
  line-height: 1.35;
  width: 100%;
}
.sidebar .brand .mark .brand-logo-img,
.sidebar .brand .mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
  display: block;
}
/* Com logo real: canto arredondado estilo icone de app, fundo consistente */
.sidebar .brand .mark:has(img) {
  border-radius: 24px;
  background: transparent;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.28);
  overflow: hidden;
}
.sidebar .brand-tagline {
  display: block;
  margin-top: 4px;
  font-size: .88rem;
  font-weight: 500;
  opacity: .85;
}
.sidebar nav { display: flex; flex-direction: column; gap: 6px; flex: 1; }
.nav-btn {
  border: 0; background: transparent; color: rgba(255,255,255,.85);
  text-align: left; padding: 12px 14px; border-radius: 12px; cursor: pointer;
  display: flex; gap: 10px; align-items: center; font-weight: 500;
}
.nav-btn:hover, .nav-btn.active { background: rgba(255,255,255,.14); color: #fff; }
/* Item ativo do menu: pílula com acento da cor da igreja (a cor vive aqui, não no fundo todo) */
.nav-btn.active {
  background: color-mix(in srgb, var(--primary) 42%, rgba(255, 255, 255, .06));
  box-shadow: inset 3px 0 0 var(--accent-theme);
}
/* Botões de navegação com setas: formato pílula (cantos totalmente arredondados) */
.btn:has(i.fa-arrow-left), .btn:has(i.fa-arrow-right) { border-radius: 999px; }
.nav-btn:disabled { opacity: .35; cursor: not-allowed; }
.user-box {
  background: rgba(255,255,255,.1); border-radius: 14px; padding: 12px;
}
.user-box strong { display: block; font-size: .95rem; }
.user-box span { font-size: .75rem; opacity: .85; }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow-x: clip; }
.topbar {
  background: var(--card); border-bottom: 1px solid var(--border);
  padding: 16px 24px; display: flex; justify-content: space-between; align-items: center;
  gap: 12px; position: sticky; top: 0; z-index: 5;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
}
.topbar h2 {
  font-size: 1.15rem;
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  max-width: 55%;
}
.topbar-theme-btn {
  width: auto;
  flex-shrink: 0;
  white-space: nowrap;
}
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 12px; font-size: .75rem; font-weight: 700;
  background: var(--badge-bg); color: var(--primary);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Badge legivel no escuro: tint quente da cor de destaque, texto claro */
html[data-theme="dark"] .badge {
  background: color-mix(in srgb, var(--accent-theme) 20%, #171310);
  color: color-mix(in srgb, var(--accent-theme) 40%, #ffffff);
}
html[data-theme="dark"] .nav-btn:hover,
html[data-theme="dark"] .nav-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
/* Superficies com branco fixo tambem seguem o modo escuro */
html[data-theme="dark"] .theme-card,
html[data-theme="dark"] .pastor-edit-card { background: #1d1712; }
html[data-theme="dark"] .pastor-edit-card.president { background: color-mix(in srgb, #f59e0b 12%, #171310); }
html[data-theme="dark"] .color-edit-row input[type=color],
html[data-theme="dark"] .theme-fields input[type=color] { background: #201a15; }
html[data-theme="dark"] .gestao-input { background: #201a15; border-color: var(--border); color: var(--text); }
html[data-theme="dark"] .gestao-resumo-card,
html[data-theme="dark"] .gestao-escala-dia,
html[data-theme="dark"] .gestao-aviso { background: #1d1712; border-color: var(--border); color: var(--text); }
/* Gestao no escuro: cartao, rotulos, tabela e acoes consistentes com o carvao */
html[data-theme="dark"] .gestao-form { background: #1d1712; border-color: var(--border); }
html[data-theme="dark"] .gestao-form label { color: #cfc4b8; }
/* Campos com contorno claro visivel no escuro (nunca somem no fundo) */
html[data-theme="dark"] .gestao-input,
html[data-theme="dark"] .form-group input,
html[data-theme="dark"] .form-group select,
html[data-theme="dark"] .form-group textarea,
html[data-theme="dark"] .hex-input,
html[data-theme="dark"] .hex-mini {
  background: #241d17;
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--text);
}
html[data-theme="dark"] .gestao-table th { color: var(--muted); border-bottom-color: var(--border); }
html[data-theme="dark"] .gestao-table td { border-bottom-color: var(--border); }
html[data-theme="dark"] .gestao-resumo-card span { color: var(--muted); }
html[data-theme="dark"] .gestao-escala-dia h4,
html[data-theme="dark"] .gestao-aviso h4 { color: var(--text); }
html[data-theme="dark"] .btn-ghost.btn-sm { color: #ffd9c2; }
html[data-theme="dark"] .tag { color: color-mix(in srgb, currentColor 62%, #ffffff); }
.content { padding: 24px; min-width: 0; max-width: 100%; box-sizing: border-box; }

.grid { display: grid; gap: 16px; min-width: 0; max-width: 100%; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
  min-width: 0; max-width: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.card h3 { font-size: 1rem; margin-bottom: 8px; }
.stat-value { font-size: 1.8rem; font-weight: 700; line-height: 1.1; }
.stat-label { color: var(--muted); font-size: .85rem; margin-top: 4px; }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
th { font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.tag {
  display: inline-block; padding: 4px 8px; border-radius: 8px;
  font-size: .72rem; font-weight: 700;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.35;
}
.tag-blue { background: color-mix(in srgb, var(--primary) 16%, white); color: var(--primary); }
html[data-theme="dark"] .tag-blue { background: color-mix(in srgb, var(--primary) 30%, #171310); color: #fff; }
.tag-pink { background: #fce7f3; color: #be185d; }
.tag-green { background: #dcfce7; color: #166534; }
.tag-amber { background: #fef3c7; color: #92400e; }
.tag-red { background: #fee2e2; color: #b91c1c; }
.tag-slate { background: #f1f5f9; color: #475569; }

.section-head {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
  min-width: 0;
}
.muted {
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.empty {
  padding: 28px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border); border-radius: 14px;
}
.list-item {
  padding: 12px 0; border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; gap: 12px; align-items: flex-start;
  min-width: 0;
  max-width: 100%;
  flex-wrap: wrap;
  box-sizing: border-box;
}
.list-item > * {
  min-width: 0;
  max-width: 100%;
}
.list-item:last-child { border-bottom: 0; }
.sub-select {
  max-width: 100%;
  box-sizing: border-box;
}
.diaconia-lead {
  font-size: .82rem;
  margin-bottom: 10px;
  line-height: 1.45;
}
.toast {
  position: fixed; right: 18px; bottom: 18px; background: #0f172a; color: #fff;
  padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow);
  z-index: 50; opacity: 0; transform: translateY(8px); transition: .25s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

.mobile-toggle {
  display: none; border: 0; background: var(--ghost-bg); color: var(--primary);
  width: 42px; height: 42px; border-radius: 12px; cursor: pointer;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .main {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; inset: 0 auto 0 0;
    width: min(86vw, 300px);
    max-width: 300px;
    transform: translateX(-105%);
    transition: .25s ease; z-index: 20;
    padding: 14px 12px;
    gap: 12px;
    height: 100dvh;
    /* gaveta mobile: menu rola dentro dela */
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar .brand {
    gap: 8px;
    padding: 4px 4px 10px;
  }
  .sidebar .brand .mark {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    font-size: 1.75rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.14);
  }
  .sidebar .brand strong {
    font-size: 1.08rem;
    line-height: 1.2;
  }
  .sidebar .brand-tagline {
    font-size: 0.78rem;
  }
  .sidebar .brand > div:last-child {
    font-size: 0.85rem;
  }
  .nav-btn {
    padding: 11px 12px;
    font-size: 0.92rem;
  }
  .content {
    padding: 12px 10px 28px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }
  .card {
    padding: 14px 12px;
    width: 100%;
  }
  .list-item {
    flex-direction: column;
    align-items: stretch;
  }
  .section-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .section-head .btn,
  .section-head .btn-sm {
    width: 100%;
  }
  .btn {
    max-width: 100%;
    box-sizing: border-box;
  }
  .topbar {
    padding: 8px 10px;
    gap: 6px;
    width: 100%;
  }
  .topbar-left {
    gap: 8px;
  }
  .topbar h2 {
    font-size: 0.95rem;
    line-height: 1.2;
  }
  .topbar-actions {
    gap: 6px;
    max-width: none;
    flex-shrink: 0;
  }
  .topbar-theme-btn {
    padding: 8px 10px;
    min-width: 40px;
  }
  .topbar-theme-label {
    display: none;
  }
  .badge {
    display: none;
  }
  .mobile-toggle {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
  }
  .stat-value {
    font-size: 1.45rem;
  }
  .login-wrap {
    padding: 16px 12px;
    align-items: start;
  }
  .login-card {
    padding: 22px 16px;
    border-radius: 20px;
    margin: 8px 0 24px;
  }
  .login-brand {
    margin-bottom: 16px;
  }
  .login-brand .logo,
  .login-logo-img {
    width: 96px !important;
    height: 96px !important;
    border-radius: 0 !important;
    font-size: 2.1rem;
    margin-bottom: 12px;
  }
  .login-brand h1 {
    font-size: 1.4rem;
  }
  .login-brand p {
    font-size: 0.88rem;
  }
  .quick-roles button {
    padding: 10px 12px;
  }
  .mobile-toggle { display: grid; place-items: center; }
  .backdrop {
    position: fixed; inset: 0; background: rgba(15,23,42,.45);
    z-index: 15; display: none;
  }
  .backdrop.show { display: block; }
}

@media (max-width: 640px) {
  .sidebar .brand .mark {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    font-size: 1.55rem;
  }
  .sidebar .brand strong {
    font-size: 1rem;
  }
  .content {
    padding: 12px 10px 24px;
  }
  .btn {
    padding: 11px 14px;
  }
  .empty {
    padding: 18px 12px;
  }
  .section-head {
    margin-bottom: 10px;
  }
}

/* SETUP / CADASTRO IGREJA */
.setup-wrap {
  min-height: 100vh;
  padding: 28px 16px;
  background:
    radial-gradient(circle at 15% 20%, rgba(74,123,176,.28), transparent 42%),
    linear-gradient(145deg, #0f274f, var(--primary) 50%, var(--secondary));
  display: grid;
  place-items: start center;
}
.setup-wrap-embed {
  min-height: auto;
  padding: 0;
  background: transparent;
  place-items: stretch;
}
.setup-wrap-embed .setup-card {
  box-shadow: var(--shadow);
  margin: 0;
  width: 100%;
}
.setup-card {
  width: min(920px, 100%);
  background: rgba(255,255,255,.97);
  border-radius: 24px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0,0,0,.28);
  margin: 12px 0 40px;
}
.setup-head {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  margin-bottom: 18px;
}
.setup-head h1 { font-size: 1.35rem; }
.setup-logo-mini {
  width: 64px; height: 64px; border-radius: 12px; object-fit: contain; padding: 4px;
  border: 3px solid var(--primary); background: #eef2ff;
  display: grid; place-items: center; color: var(--primary); font-size: 1.4rem;
}
/* Logo real no mini: canto arredondado estilo icone, sem moldura colorida */
img.setup-logo-mini {
  border: none; background: transparent; border-radius: 14px; padding: 0;
}
.setup-logo-mini.placeholder { display: grid; }
.steps {
  display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px;
}
.step {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 999px; background: #f1f5f9;
  color: var(--muted); font-size: .82rem; font-weight: 600;
}
.step span {
  width: 22px; height: 22px; border-radius: 50%; background: #cbd5e1; color: #fff;
  display: grid; place-items: center; font-size: .75rem;
}
.step.active { background: #e0eaff; color: var(--primary); }
.step.active span { background: var(--primary); }
.step.done span { background: var(--success); }
.setup-body { min-height: 280px; }
.setup-actions {
  display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap;
}
.setup-actions .btn-primary { width: auto; min-width: 160px; }
.setup-error { color: var(--danger); min-height: 1.2em; font-size: .88rem; margin-top: 8px; }

.logo-preview-box {
  border: 1px dashed var(--border); border-radius: 20px; min-height: 220px;
  display: grid; place-items: center; background: #f8fafc; overflow: hidden;
}
.logo-preview-box img { width: 180px; height: 180px; border-radius: 16px; object-fit: contain; border: none; }
html[data-theme="dark"] .logo-preview-box { background: #1d1712; }
.logo-empty { display: grid; place-items: center; gap: 8px; color: var(--muted); }
.logo-empty i { font-size: 2rem; }

.logo-stage {
  width: 240px; height: 240px; margin: 0 auto;
  border-radius: 0; overflow: hidden; position: relative;
  border: 4px solid var(--primary); background: var(--ghost-bg);
  cursor: grab; touch-action: none;
  box-shadow: 0 10px 30px rgba(15,23,42,.2);
}
.logo-stage.dragging { cursor: grabbing; }
.logo-stage img {
  position: absolute; top: 50%; left: 50%;
  width: 100%; height: 100%; object-fit: contain;
  transform-origin: center center;
  user-select: none; -webkit-user-drag: none;
}
.post-setup-hint {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #065f46;
  font-size: .85rem;
}
.post-setup-hint ol { margin: 8px 0 0 18px; }
.post-setup-hint p { margin-top: 6px; }
.sub-select {
  padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border);
  max-width: 180px;
}
.logo-panel { display: flex; flex-direction: column; align-items: center; }
.logo-controls {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px;
}
.logo-controls-below {
  justify-content: center;
  margin-top: 14px;
  width: 100%;
}
.swatch-btn {
  width: 30px; height: 30px; border-radius: 8px; border: 2px solid #fff;
  box-shadow: 0 0 0 1px #cbd5e1; cursor: pointer; padding: 0;
}
.swatch-btn:hover { transform: scale(1.08); }
.color-edit-row { display: flex; gap: 8px; align-items: center; }
.color-edit-row input[type=color] {
  width: 52px; height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: #fff;
}
.hex-input, .hex-mini {
  flex: 1; min-width: 0; padding: 10px 12px; border: 1px solid var(--border);
  border-radius: 10px; font-family: ui-monospace, monospace; font-size: .85rem;
}
.hex-mini { width: 78px; flex: none; padding: 6px 8px; font-size: .75rem; }

.extracted-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.swatch { width: 28px; height: 28px; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1px #cbd5e1; }

.theme-models { display: grid; gap: 12px; }
.theme-card {
  border: 2px solid var(--border); border-radius: 16px; padding: 14px; cursor: pointer;
  background: #fff; display: block;
}
.theme-card.selected { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,60,114,.12); }
.theme-card input[type=radio] { display: none; }
.theme-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 10px; }
.theme-preview-bar { height: 12px; width: 140px; border-radius: 999px; }
.theme-fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.theme-fields input[type=color] {
  width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 4px; background: #fff;
}

.pastor-edit-card {
  border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 12px; background: #fff;
}
.pastor-edit-card.president { border-color: #f59e0b; background: #fffbeb; }
.pastor-edit-head {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px;
}
.permissoes-box {
  margin-top: 14px; background: #f0f9ff; border: 1px solid #bae6fd; border-radius: 14px; padding: 14px;
}
.permissoes-box ul { margin: 8px 0 0 18px; color: var(--muted); }

.brand-logo-img {
  width: 128px; height: 128px; border-radius: 0; object-fit: contain; display: block;
}
.login-logo-img {
  width: 168px; height: 168px; border-radius: 28px; object-fit: contain;
  box-shadow: var(--shadow); margin: 0 auto 18px; display: block;
}

/* IARzinho — IAR (sigla) + zinho · cores dos botões Kids */
.brand-iarzinho {
  display: inline;
  white-space: nowrap;
  font-weight: 800;
  letter-spacing: -0.01em;
  font-family: var(--kids-font-display, "Baloo 2", system-ui, sans-serif);
}
.brand-iarzinho-acr {
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0ea5e9;
}
.brand-iarzinho-suf {
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
  color: #fbbf24;
}
.nav-btn .brand-iarzinho-acr,
.nav-btn .brand-iarzinho-suf {
  color: inherit;
  opacity: 1;
}
.nav-btn .brand-iarzinho-acr {
  font-weight: 800;
  letter-spacing: 0.03em;
}
.nav-btn.active .brand-iarzinho-acr {
  color: #fff;
}
.nav-btn.active .brand-iarzinho-suf {
  color: #fde68a;
}
.iarzinho-hub-head h1 .brand-iarzinho {
  font-size: inherit;
  font-weight: 800;
}
.iarzinho-hub-head h1 .brand-iarzinho-acr {
  color: #0ea5e9;
  letter-spacing: 0.06em;
}
.iarzinho-hub-head h1 .brand-iarzinho-suf {
  color: #fbbf24;
}
.topbar h2 .brand-iarzinho {
  font-size: inherit;
  font-weight: 800;
}
.topbar h2 .brand-iarzinho-acr {
  color: #0ea5e9;
  letter-spacing: 0.04em;
}
.topbar h2 .brand-iarzinho-suf {
  color: #fbbf24;
}
html[data-theme="dark"] .iarzinho-hub-head h1 .brand-iarzinho-acr,
html[data-theme="dark"] .topbar h2 .brand-iarzinho-acr {
  color: #38bdf8;
}
html[data-theme="dark"] .iarzinho-hub-head h1 .brand-iarzinho-suf,
html[data-theme="dark"] .topbar h2 .brand-iarzinho-suf {
  color: #fcd34d;
}

/* Kids — etapa 1 compreensão bíblica */
.kids-etapa .actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}
.kids-etapa .actions-row.wrap { margin-top: 4px; }
.kids-status {
  display: inline-block;
  font-size: .75rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 8px;
  letter-spacing: .02em;
}
.kids-st-idle { background: #e2e8f0; color: #334155; }
.kids-st-busy { background: #dbeafe; color: #1d4ed8; }
.kids-st-review { background: #ffedd5; color: #c2410c; }
.kids-st-ok { background: #dcfce7; color: #166534; }
.kids-st-warn { background: #fef3c7; color: #92400e; }
.kids-subtitle {
  font-size: 1rem;
  margin: 16px 0 10px;
  color: var(--primary);
}
.kids-cena {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: color-mix(in srgb, var(--card) 92%, var(--primary));
}
.kids-cena-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.kids-alert {
  margin: 12px 0;
  padding: 10px 12px;
  border-left: 4px solid var(--warning);
  background: color-mix(in srgb, var(--warning) 12%, white);
  border-radius: 8px;
  font-size: .9rem;
}
.kids-alert-err {
  border-left-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, white);
}
.kids-provider { margin: 8px 0 12px; font-size: .85rem; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tag-amber { background: #ffedd5; color: #9a3412; }

@media (max-width: 720px) {
  .theme-fields, .grid-3 { grid-template-columns: 1fr; }
  .setup-card { padding: 18px; }
}

/* ===== Módulos de gestão (Membros, Financeiro, Escala, Comunicação) ===== */
.gestao-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; background: #f7f9fc; border: 1px solid #e3e8ef; border-radius: 12px; padding: 12px; margin: 10px 0; }
.gestao-form label { display: flex; flex-direction: column; gap: 4px; font-size: .82rem; font-weight: 600; color: #44506a; }
.gestao-input { border: 1px solid #ccd5e0; border-radius: 8px; padding: 8px 10px; font: inherit; background: #fff; }
.gestao-form-acoes { grid-column: 1 / -1; display: flex; gap: 8px; }
.gestao-scroll { overflow-x: auto; }
.gestao-table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.gestao-table th { text-align: left; color: #55617c; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 2px solid #e3e8ef; }
.gestao-table td { padding: 9px 10px; border-bottom: 1px solid #eef1f6; vertical-align: middle; }
.gestao-num { font-variant-numeric: tabular-nums; font-weight: 600; }
.gestao-acoes { display: inline-flex; gap: 4px; }
.gestao-badge { display: inline-block; padding: 4px 10px; border-radius: 8px; font-size: .72rem; font-weight: 700; margin-left: 4px; }
.gestao-badge:first-child { margin-left: 0; }
.gestao-resumo { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 10px 0; }
.gestao-resumo-card { background: #fff; border: 1px solid #e3e8ef; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; }
.gestao-resumo-card span { font-size: .76rem; color: #55617c; }
.gestao-escala-dia { background: #fff; border: 1px solid #e3e8ef; border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.gestao-escala-dia h4 { margin: 0 0 8px; color: #1e3c72; }
.gestao-escala-dia ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.gestao-escala-item { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.gestao-escala-resp { font-weight: 600; }
.gestao-avisos { display: grid; gap: 10px; }
.gestao-aviso { background: #fff; border: 1px solid #e3e8ef; border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 2px rgb(16 24 40 / .05); }
.gestao-aviso p { margin: 8px 0 10px; line-height: 1.55; color: #3c4657; font-size: .95rem; }
.gestao-aviso footer { color: #7a8699; }
.gestao-aviso .gestao-acoes { display: inline-flex; gap: 4px; }
.gestao-aviso .fa-whatsapp { color: #128c7e; }
.gestao-aviso-img { display: block; width: 100%; max-height: 340px; object-fit: contain; background: #f2f5f9; border: 1px solid #e3e8ef; border-radius: 12px; margin: 10px 0 4px; }
html[data-theme="dark"] .gestao-aviso-img { background: #241d17; border-color: var(--border); }
tr.is-hoje td { background: #fff7e6; }
tr.is-hoje td:first-child { box-shadow: inset 3px 0 0 #f59e0b; }
html[data-theme="dark"] tr.is-hoje td { background: #2a2013; }
.nav-badge { margin-left: auto; background: var(--primary); color: #fff; border-radius: 999px; font-size: .68rem; font-weight: 700; padding: 2px 7px; }
html[data-theme="dark"] .gestao-aviso p { color: #d8cfc4; }
.gestao-aviso.is-fixado { border-color: #2e7d32; box-shadow: 0 0 0 1px #2e7d3233; }
.gestao-aviso header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.gestao-aviso h4 { margin: 0; color: #1e3c72; }
.gestao-aviso footer { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; }

/* ===== Botao de tema com arte (sol/lua) — ajuste fino 2 ===== */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
/* Botao de tema: SEM fundo próprio — a arte transparente flutua sobre o painel,
   garantindo que o pixel ao redor da lua/sol seja exatamente o pixel do painel. */
.topbar-theme-img-btn {
  padding: 0; border: none; background: transparent;
  width: 46px; height: 46px; border-radius: 14px; overflow: hidden;
  box-shadow: none;
  transition: transform .18s ease, filter .18s ease;
}
.topbar-theme-img-btn:hover { transform: translateY(-1px) scale(1.06); filter: brightness(1.07); }
.topbar-theme-img-btn:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; }
.topbar-theme-img-btn .theme-btn-img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  background: transparent; animation: themeBtnIn .28s ease;
}
@keyframes themeBtnIn {
  from { opacity: .3; transform: scale(.9); }
  to { opacity: 1; transform: scale(1); }
}

/* Telas baixas: sidebar mais compacta p/ mostrar mais menu sem rolagem */
@media (max-height: 720px) {
  .sidebar { gap: 12px; padding: 16px 14px; }
  .sidebar .brand { padding: 4px 4px 10px; gap: 8px; }
  .sidebar .brand .mark { width: 96px; height: 96px; font-size: 2.2rem; }
  .sidebar .brand .mark:has(img) { border-radius: 20px; }
  .sidebar .brand strong { font-size: 1.2rem; }
  .nav-btn { padding: 10px 12px; }
  .user-box { padding: 10px; }
}

/* Chips de ministerios (cadastro de membros) */
.min-chips-wrap { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.min-chips-title { font-size: .82rem; font-weight: 600; color: #44506a; }
.min-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.min-chip {
  border: 1px solid var(--border); background: var(--card); color: var(--text);
  border-radius: 12px; padding: 8px 14px; font-size: .8rem; font-weight: 600;
  cursor: pointer; transition: transform .15s ease, background .15s ease, color .15s ease;
}
.min-chip:hover { transform: translateY(-1px); }
.min-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
html[data-theme="dark"] .min-chips-title { color: #cfc4b8; }
html[data-theme="dark"] .min-chip { background: #241d17; border-color: rgba(255, 255, 255, 0.28); }
html[data-theme="dark"] .min-chip.on { background: var(--primary); border-color: var(--primary); color: #fff; }
