/* ── BRAND ──────────────────────────────────────────────────── */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-logo {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-dim);
  border: 1px solid rgba(224,69,53,.3);
  border-radius: 12px;
  color: var(--accent);
}
.brand-sm .brand-logo { width: 30px; height: 30px; border-radius: 8px; }
.brand-text { font-size: .95rem; color: var(--text); flex: 1; }
.brand-text span { opacity: .75; margin-right: 4px; }
.brand-text strong { font-weight: 800; }
.brand-text .brand-ministerio {
  margin-left: 6px;
  opacity: .9;
  font-weight: 600;
  color: var(--accent, #e04535);
}
.brand-text .brand-ministerio em { font-style: normal; }
.ministerio-master {
  margin-left: 16px;
  margin-right: auto;
}
.ministerio-master select { min-width: 180px; }

/* Theme toggle */
.theme-toggle {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
  padding: 0;
}
.theme-toggle:hover { color: var(--text); border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
html[data-theme="light"] .theme-toggle .icon-sun  { display: none; }
html[data-theme="light"] .theme-toggle .icon-moon { display: inline-block; }

/* ── LOGIN ─────────────────────────────────────────────────── */
.login-shell {
  min-height: 100dvh;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px 24px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { font-weight: 800; font-size: 1.4rem; color: var(--text-strong); margin-top: 6px; }

/* ── APP SHELL ─────────────────────────────────────────────── */
.app-shell {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
.app-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
  row-gap: 8px;
}
.user-block {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.user-name { font-weight: 600; color: var(--text-strong); }
.user-badge {
  display: inline-block;
  font-size: .68rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: .4px;
  border: 1px solid var(--border);
  color: var(--muted);
}
.user-badge.team-amarelo  { background: var(--team-amarelo-bg);  color: var(--team-amarelo-text);  border-color: var(--team-amarelo-border); }
.user-badge.team-azul     { background: var(--team-azul-bg);     color: var(--team-azul-text);     border-color: var(--team-azul-border); }
.user-badge.team-verde    { background: var(--team-verde-bg);    color: var(--team-verde-text);    border-color: var(--team-verde-border); }
.user-badge.team-vermelho { background: var(--team-vermelho-bg); color: var(--team-vermelho-text); border-color: var(--team-vermelho-border); }
.user-badge.nivel-admin, .user-badge.nivel-co_lider {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(224,69,53,.3);
}

/* Avatar/botão do usuário no header (abre "Meu perfil") */
.user-avatar-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.user-avatar-btn:hover { background: var(--surface-2); border-color: var(--border); }
.user-avatar-wrap {
  width: 30px; height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center;
}
.user-avatar-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-avatar-initial {
  width: 100%; height: 100%;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: .85rem; color: #fff;
}
.user-info {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  line-height: 1;
}

/* Modal Meu Perfil */
.perfil-foto-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 4px 0 8px;
}
#perfil-foto-preview {
  width: 110px; height: 110px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--border);
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}
.perfil-foto-placeholder {
  width: 110px; height: 110px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-weight: 800;
  font-size: 2rem;
  border: 2px solid var(--border);
}
.perfil-foto-actions { display: flex; gap: 8px; }
.perfil-readonly {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .88rem;
  margin: 4px 0;
}
.perfil-readonly strong { text-transform: capitalize; color: var(--text-strong); }

.icon-btn {
  width: 34px; height: 34px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--muted);
  border-radius: var(--r-sm);
  transition: background .15s, color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn-danger:hover { color: var(--accent); }

/* ── TABS ──────────────────────────────────────────────────── */
.tabs {
  display: flex;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 12px;
  overflow-x: auto;
}
.tab-btn {
  padding: 13px 18px;
  font-weight: 600;
  color: #bfb5ae;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--text-strong); }
.tab-btn.active {
  color: var(--text-strong);
  font-weight: 700;
  border-bottom-color: var(--accent);
}
html[data-theme="light"] .tab-btn { color: #6a5e58; }
html[data-theme="light"] .tab-btn.active { color: var(--text-strong); }

.app-main {
  flex: 1;
  padding: 22px 18px;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.panel-header h2 {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text-strong);
  letter-spacing: -.01em;
}

/* ── MODAL ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-backdrop[hidden] { display: none !important; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 440px;
  max-height: 92vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 1.1rem; font-weight: 800; color: var(--text-strong); }
.modal-body { padding: 20px; }

/* QR modal */
.modal-qr-body { text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.qr-event-title { font-weight: 700; color: var(--text-strong); font-size: 1rem; }
.qr-wrap {
  background: #fff;
  padding: 14px;
  border-radius: 14px;
  display: inline-block;
  line-height: 0;
}
.qr-wrap img { display: block; width: 220px; height: 220px; }
.qr-url-row {
  display: flex;
  gap: 6px;
  width: 100%;
}
.qr-url-row input {
  flex: 1;
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-size: .8rem;
  font-family: monospace;
}

/* ── TOAST ─────────────────────────────────────────────────── */
.toast-host {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
  pointer-events: none;
}
.toast {
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: .88rem;
  color: var(--text-strong);
  text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: toastin .22s ease;
}
.toast.ok    { border-color: rgba(52,211,153,.4); }
.toast.warn  { border-color: rgba(245,158,11,.4); }
.toast.error { border-color: rgba(224,69,53,.4); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

/* mobile */
@media (max-width: 560px) {
  .field-row { grid-template-columns: 1fr; }
  .panel-header { flex-direction: column; align-items: stretch; }
  .app-header {
    padding: 8px 12px;
    gap: 8px;
    column-gap: 6px;
  }
  /* Esconde "Painel de" / "Controle" — mantém só o ícone do logo */
  .brand-text { display: none; }
  /* Compacta o user-block: só avatar + botões essenciais */
  .user-name,
  .user-badge,
  .user-ministerio { display: none; }
  .user-info { display: none; }
  .user-avatar-btn { padding: 0; }
  .ministerio-master select { min-width: 130px; max-width: 160px; }
  /* Alguns ícones ficam menores pra caber na linha */
  .user-block .icon-btn,
  .user-block .theme-toggle { padding: 6px; }
}

