:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #d9dee7;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;
  --ok: #16a34a;
  --danger: #dc2626;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Arial, Helvetica, sans-serif;
}
a { color: var(--brand); text-decoration: none; }
button, .button {
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 700;
}
button:hover, .button:hover { background: var(--brand-dark); }
.ghost { background: #e8eefc; color: var(--brand); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 230px;
  background: #111827;
  color: #fff;
  padding: 22px;
}
.sidebar strong { display: block; margin-bottom: 24px; font-size: 18px; }
.sidebar a {
  color: #d1d5db;
  display: block;
  padding: 12px 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.content { margin-left: 230px; padding: 28px; }
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px;
}
.login-card h1 { margin-top: 0; }

.notice {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 12px 14px;
  border-radius: 6px;
  margin-bottom: 16px;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
.topbar h1 { margin: 0; font-size: 28px; }
.topbar p { margin: 3px 0 0; color: var(--muted); }
.tenant-switch select { min-width: 240px; }

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.metrics article, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}
.metrics span { color: var(--muted); display: block; }
.metrics strong { display: block; font-size: 30px; margin-top: 6px; }
.grid { display: grid; gap: 16px; }
.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel h2 { margin: 0 0 16px; font-size: 18px; }
.panel canvas { max-height: 300px; }

.searchbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}
input, select, textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  min-height: 38px;
  padding: 8px 10px;
}
textarea { min-height: 92px; resize: vertical; }
label { display: grid; gap: 6px; color: #374151; font-weight: 700; }

.table-wrap {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
}
table { border-collapse: collapse; width: 100%; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: middle; }
th { background: #f8fafc; color: #475467; font-size: 12px; text-transform: uppercase; }
td small { color: var(--muted); display: block; margin-top: 3px; }
.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  display: inline-block;
  background: #e5e7eb;
}
.actions {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.actions form { display: inline; }
.actions button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: var(--danger);
}

.form-grid {
  display: grid;
  gap: 16px;
}
fieldset {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 18px;
}
legend {
  padding: 0 8px;
  font-weight: 800;
  color: var(--text);
}
.wide { grid-column: 1 / -1; }
.save { width: fit-content; padding-inline: 28px; }
.stack { display: grid; gap: 12px; }

@media (max-width: 900px) {
  .sidebar { position: static; width: auto; }
  .content { margin-left: 0; padding: 18px; }
  .metrics, .two, fieldset { grid-template-columns: 1fr; }
  .topbar, .searchbar { align-items: stretch; flex-direction: column; }
}

.hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.tabs a {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #344054;
  padding: 8px 10px;
}
.tabs a.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.top-actions {
  margin-bottom: 4px;
}
.brand-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.menu-toggle {
  display: none;
  min-height: 32px;
  padding: 0 10px;
  background: #374151;
}
.menu-links { display: block; }
.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
  align-items: end;
}
.logo-preview {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 6px;
}
@media (max-width: 900px) {
  .sidebar strong { margin-bottom: 0; }
  .menu-toggle { display: inline-flex; }
  .menu-links { display: none; padding-top: 12px; }
  body.menu-open .menu-links { display: block; }
  .filter-grid { grid-template-columns: 1fr; }
}

/* Menu principal estilo app de membresia */
.sidebar.app-menu {
  width: 280px;
  background: #f4ecdf;
  color: #172033;
  padding: 24px 18px;
  overflow-y: auto;
  border-right: 1px solid #e0d5c4;
}
.sidebar.app-menu .brand-row {
  margin-bottom: 22px;
}
.sidebar.app-menu strong {
  margin: 0;
  font-size: 20px;
  letter-spacing: .02em;
  color: #0f172a;
}
.sidebar.app-menu strong small {
  display: inline;
  margin-left: 5px;
  color: #667085;
  font-size: 12px;
  letter-spacing: 0;
}
.menu-toggle {
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
  border-radius: 8px;
  background: transparent;
  border: 0;
  display: inline-grid;
  place-content: center;
  gap: 5px;
}
.menu-toggle span {
  display: block;
  width: 28px;
  height: 3px;
  border-radius: 999px;
  background: #0f172a;
}
.power-link {
  width: 46px;
  height: 46px;
  border: 1px solid #d2b762 !important;
  border-radius: 999px;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  background: #fffdf8;
  color: #7c2d12 !important;
  font-size: 11px;
  padding: 0 !important;
}
.menu-links {
  display: grid;
  gap: 12px;
}
.sidebar.app-menu a,
.sidebar.app-menu summary {
  border: 1px solid #dfe4e8;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
  box-shadow: 0 12px 28px rgba(15,23,42,.06);
  color: #253041;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 0 16px;
  font-weight: 700;
}
.sidebar.app-menu a { border-bottom: 1px solid #dfe4e8; }
.sidebar.app-menu a.active,
.sidebar.app-menu .menu-card.active {
  background: #dbeafe;
  color: #1d4ed8;
}
.menu-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: #e8f5ee;
  color: #4f9463;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
}
.menu-group {
  display: grid;
  gap: 8px;
}
.menu-group summary {
  cursor: pointer;
  list-style: none;
}
.menu-group summary::-webkit-details-marker { display: none; }
.menu-group summary::after {
  content: '+';
  margin-left: auto;
  color: #667085;
  font-size: 18px;
}
.menu-group[open] summary::after { content: '-'; }
.menu-group a {
  min-height: 44px;
  margin-left: 42px;
  padding-left: 14px;
  font-weight: 600;
  background: rgba(255,255,255,.52);
}
.menu-card.danger {
  background: #fff1f2 !important;
  color: #7f1d1d !important;
}
.content { margin-left: 280px; }
@media (max-width: 900px) {
  body { background: #f4ecdf; }
  .sidebar.app-menu {
    position: sticky;
    top: 0;
    z-index: 20;
    width: auto;
    padding: 20px 18px 10px;
    border-right: 0;
    border-bottom: 1px solid #e0d5c4;
  }
  .sidebar.app-menu .brand-row { margin-bottom: 0; }
  .sidebar.app-menu .menu-links {
    display: none;
    margin: 18px 10px 16px;
    padding: 18px;
    border-radius: 24px;
    background: rgba(255,255,255,.88);
    box-shadow: 0 22px 45px rgba(15,23,42,.16);
  }
  body.menu-open .sidebar.app-menu .menu-links { display: grid; }
  .content { margin-left: 0; padding: 20px; }
}

.avatar-large { width: 76px; height: 76px; border-radius: 16px; object-fit: cover; }

.report-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.report-index {
  position: sticky;
  top: 18px;
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 40px);
  overflow: auto;
}
.report-index strong {
  margin-top: 10px;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
}
.report-index a {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #344054;
  padding: 8px 10px;
  background: #fff;
}
.report-index a.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.report-main { display: grid; gap: 14px; min-width: 0; }
.report-filters { grid-template-columns: 1.4fr repeat(3, minmax(130px, .8fr)) auto; }
.report-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(130px, 1fr));
  gap: 12px;
}
.report-summary article {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}
.report-summary span { color: var(--muted); display: block; }
.report-summary strong { display: block; margin-top: 4px; font-size: 18px; }
.report-table table { font-size: 13px; }
.report-table th { white-space: nowrap; }
@media (max-width: 1100px) {
  .report-shell { grid-template-columns: 1fr; }
  .report-index { position: static; max-height: none; }
  .report-filters, .report-summary { grid-template-columns: 1fr; }
}

.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.advanced-filter {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 12px;
}
.advanced-filter h2 {
  grid-column: 1 / -1;
  margin: 0;
}
@media (max-width: 900px) {
  .advanced-filter { grid-template-columns: 1fr; }
}
@media print {
  .sidebar, .report-index, .report-filters, .advanced-filter, .report-actions, .tenant-switch, .notice { display: none !important; }
  .content { margin: 0 !important; padding: 0 !important; }
  body { background: #fff !important; color: #000 !important; }
  .panel, .table-wrap, .report-summary article { border: 0 !important; box-shadow: none !important; }
  table { font-size: 11px; }
  th { background: #ddd !important; color: #000 !important; }
}

/* Menu compacto com flyout */
@media (min-width: 901px) {
  .compact-menu .menu-group:not([open]) > .submenu.flyout { display: none; }
}
.sidebar.compact-menu {
  overflow: visible;
}
.compact-menu .menu-links {
  gap: 10px;
}
.compact-menu .menu-group {
  position: relative;
  display: block;
}
.compact-menu .menu-group > summary,
.compact-menu .menu-card {
  min-height: 54px;
}
.compact-menu .menu-group.active-group > summary,
.compact-menu .menu-card.active {
  background: #dbeafe;
  color: #1d4ed8;
}
.compact-menu .menu-group > summary::after {
  content: '+';
  margin-left: auto;
  color: #667085;
  font-size: 18px;
}
.compact-menu .menu-group[open] > summary::after { content: '-'; }
.compact-menu .submenu.flyout {
  position: absolute;
  left: calc(100% + 12px);
  top: 0;
  z-index: 50;
  display: none;
  width: 260px;
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 12px;
  border: 1px solid #dfe4e8;
  border-radius: 14px;
  background: #080641;
  box-shadow: 0 22px 45px rgba(15,23,42,.22);
}
.compact-menu .menu-group[open] > .submenu.flyout,
.compact-menu .menu-group:hover > .submenu.flyout,
.compact-menu .menu-group:focus-within > .submenu.flyout {
  display: grid;
  gap: 8px;
}
.compact-menu .reports-flyout {
  width: min(760px, calc(100vw - 330px));
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  align-items: start;
}
.compact-menu .submenu section {
  display: grid;
  gap: 7px;
}
.compact-menu .submenu strong {
  margin: 4px 0 2px;
  color: #c7d2fe;
  font-size: 12px;
  text-transform: uppercase;
}
.compact-menu .submenu a,
.compact-menu .menu-group .submenu a {
  min-height: 36px;
  margin-left: 0;
  padding: 8px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  color: #f8fafc;
  font-weight: 600;
}
.compact-menu .submenu a:hover,
.compact-menu .submenu a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
@media (max-width: 900px) {
  .sidebar.compact-menu { overflow: visible; }
  .compact-menu .menu-group { display: grid; gap: 8px; }
  .compact-menu .submenu.flyout,
  .compact-menu .reports-flyout {
    position: static;
    width: auto;
    max-height: none;
    overflow: visible;
    padding: 8px 0 0 42px;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    grid-template-columns: 1fr;
  }
  .compact-menu .menu-group:not([open]) > .submenu.flyout { display: none; }
  .compact-menu .menu-group[open] > .submenu.flyout { display: grid; gap: 6px; }
  .compact-menu .submenu strong { color: #667085; }
  .compact-menu .submenu a,
  .compact-menu .menu-group .submenu a {
    color: #253041;
    background: rgba(255,255,255,.68);
    border: 1px solid #dfe4e8;
  }
}

/* Temas clean/dark e menu por categoria */
html[data-theme="clean"] {
  --bg: #f4ecdf;
  --panel: #fffdf8;
  --text: #172033;
  --muted: #667085;
  --line: #e0d5c4;
  --brand: #2f80ed;
  --brand-dark: #1d4ed8;
  --input-bg: #ffffff;
  --input-text: #172033;
  --table-head: #eef3fb;
  --menu-bg: #f4ecdf;
  --menu-card: rgba(255,255,255,.76);
  --menu-card-active: #dbeafe;
  --menu-card-text: #253041;
  --menu-flyout: #fffdf8;
  --menu-flyout-text: #253041;
  --menu-shadow: rgba(15,23,42,.14);
}
html[data-theme="dark"] {
  --bg: #0f172a;
  --panel: #172033;
  --text: #edf2f7;
  --muted: #aab4c3;
  --line: #334155;
  --brand: #60a5fa;
  --brand-dark: #3b82f6;
  --input-bg: #0f172a;
  --input-text: #edf2f7;
  --table-head: #1f2a44;
  --menu-bg: #111827;
  --menu-card: rgba(30,41,59,.92);
  --menu-card-active: #1e3a8a;
  --menu-card-text: #edf2f7;
  --menu-flyout: #111827;
  --menu-flyout-text: #edf2f7;
  --menu-shadow: rgba(0,0,0,.32);
}
html[data-theme] body { background: var(--bg); color: var(--text); }
html[data-theme] input,
html[data-theme] select,
html[data-theme] textarea {
  background: var(--input-bg);
  color: var(--input-text);
  border-color: var(--line);
}
html[data-theme] label { color: var(--text); }
html[data-theme] .panel,
html[data-theme] .metrics article,
html[data-theme] .table-wrap,
html[data-theme] fieldset,
html[data-theme] .login-card,
html[data-theme] .report-summary article {
  background: var(--panel);
  border-color: var(--line);
  color: var(--text);
}
html[data-theme] th { background: var(--table-head); color: var(--muted); }
html[data-theme] td,
html[data-theme] th { border-color: var(--line); }
html[data-theme] .tabs a,
html[data-theme] .report-index a {
  background: var(--input-bg);
  color: var(--text);
  border-color: var(--line);
}
html[data-theme] .ghost { background: var(--menu-card-active); color: var(--brand); }
html[data-theme] .sidebar.app-menu {
  background: var(--menu-bg);
  color: var(--text);
  border-color: var(--line);
}
html[data-theme] .sidebar.app-menu strong { color: var(--text); }
html[data-theme] .sidebar.app-menu strong small { color: var(--muted); }
html[data-theme] .sidebar.app-menu a,
html[data-theme] .sidebar.app-menu summary {
  background: var(--menu-card);
  border-color: var(--line);
  color: var(--menu-card-text);
  box-shadow: 0 12px 28px var(--menu-shadow);
}
html[data-theme] .sidebar.app-menu a.active,
html[data-theme] .sidebar.app-menu .menu-card.active,
html[data-theme] .compact-menu .menu-group.active-group > summary,
html[data-theme] .compact-menu .menu-card.active {
  background: var(--menu-card-active);
  color: var(--brand);
}
html[data-theme] .menu-icon {
  background: rgba(79,148,99,.15);
  color: #4f9463;
}
html[data-theme="dark"] .menu-icon {
  background: rgba(96,165,250,.16);
  color: #93c5fd;
}
html[data-theme] .menu-toggle span { background: var(--text); }
.theme-toggle {
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--menu-card);
  color: var(--text);
  border: 1px solid var(--line);
  box-shadow: 0 8px 18px var(--menu-shadow);
  font-size: 12px;
}
.theme-toggle:hover { background: var(--menu-card-active); color: var(--brand); }
html[data-theme] .power-link {
  background: var(--menu-card) !important;
  border-color: #d2b762 !important;
  color: var(--text) !important;
}
html[data-theme] .compact-menu .submenu.flyout {
  width: 300px;
  background: var(--menu-flyout);
  border-color: var(--line);
  box-shadow: 0 22px 45px var(--menu-shadow);
}
html[data-theme] .compact-menu .submenu a,
html[data-theme] .compact-menu .menu-group .submenu a {
  color: var(--menu-flyout-text);
  background: transparent;
  box-shadow: none;
}
html[data-theme] .compact-menu .submenu a:hover,
html[data-theme] .compact-menu .submenu a.active {
  background: var(--menu-card-active);
  color: var(--brand);
}
html[data-theme] .compact-menu .menu-group > summary::after { color: var(--muted); }
html[data-theme] .logo-preview { background: var(--input-bg); border-color: var(--line); }
@media (max-width: 900px) {
  html[data-theme] .sidebar.app-menu .menu-links {
    background: var(--panel);
    box-shadow: 0 22px 45px var(--menu-shadow);
  }
  html[data-theme] .compact-menu .submenu a,
  html[data-theme] .compact-menu .menu-group .submenu a {
    background: var(--menu-card);
    color: var(--menu-card-text);
    border-color: var(--line);
  }
}

.report-execution { grid-template-columns: minmax(0, 1fr); }
.report-execution .report-main { width: 100%; }

/* Menu mais compacto e com icones pequenos */
.sidebar.app-menu {
  padding: 14px 12px;
}
.sidebar.app-menu .brand-row {
  gap: 8px;
  margin-bottom: 12px;
}
.sidebar.app-menu strong {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 17px;
}
.sidebar.app-menu strong small {
  display: block;
  margin-left: 0;
  font-size: 11px;
}
.menu-links,
.compact-menu .menu-links {
  gap: 6px;
}
.sidebar.app-menu a,
.sidebar.app-menu summary {
  min-height: 42px;
  border-radius: 10px;
  gap: 9px;
  padding: 0 10px;
  box-shadow: 0 7px 16px rgba(15,23,42,.05);
}
.compact-menu .menu-group > summary,
.compact-menu .menu-card {
  min-height: 42px;
}
.menu-group {
  gap: 4px;
}
.menu-group a {
  min-height: 34px;
  margin-left: 28px;
}
.menu-icon {
  width: 20px;
  height: 20px;
  border-radius: 7px;
  font-size: 0;
  position: relative;
}
.menu-icon::before,
.menu-icon::after {
  content: '';
  position: absolute;
  display: block;
}
.menu-icon::before {
  width: 8px;
  height: 8px;
  left: 6px;
  top: 6px;
  border: 2px solid currentColor;
  border-radius: 3px;
}
.menu-icon::after {
  width: 4px;
  height: 4px;
  right: 4px;
  top: 4px;
  background: currentColor;
  border-radius: 999px;
  opacity: .8;
}
.menu-toggle,
.theme-toggle,
.power-link {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  flex: 0 0 34px;
}
.menu-toggle span {
  width: 22px;
  height: 2px;
}
.theme-toggle {
  font-size: 0;
  padding: 0;
  position: relative;
}
.theme-toggle::before {
  content: '';
  width: 15px;
  height: 15px;
  border: 2px solid currentColor;
  border-radius: 999px;
}
html[data-theme="dark"] .theme-toggle::before {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  box-shadow: -4px 0 0 0 var(--menu-card);
  background: currentColor;
}
.power-link {
  font-size: 0 !important;
  position: relative;
}
.power-link::before {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 999px;
}
.power-link::after {
  content: '';
  position: absolute;
  width: 2px;
  height: 10px;
  top: 7px;
  left: 50%;
  transform: translateX(-50%);
  background: currentColor;
  border-radius: 999px;
}
.compact-menu .submenu.flyout {
  padding: 8px;
}
.compact-menu .submenu a,
.compact-menu .menu-group .submenu a {
  min-height: 31px;
  padding: 6px 9px;
}
@media (max-width: 900px) {
  .sidebar.app-menu {
    padding: 12px 12px 8px;
  }
  .sidebar.app-menu .menu-links {
    gap: 7px;
    margin: 12px 6px 10px;
    padding: 12px;
    border-radius: 18px;
  }
}

/* Identidade da igreja e usuario no menu */
.brand-title {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 0;
}
.brand-title strong {
  font-size: 16px;
  line-height: 1.05;
}
.brand-title small {
  color: var(--muted);
  font-size: 11px;
}
.church-chip,
.user-chip {
  display: flex !important;
  align-items: center;
  gap: 8px;
  min-height: 38px !important;
  margin: 0 0 7px;
  padding: 6px 8px !important;
  border: 1px solid var(--line) !important;
  border-radius: 10px !important;
  background: var(--menu-card) !important;
  color: var(--menu-card-text) !important;
  box-shadow: 0 7px 16px var(--menu-shadow) !important;
}
.church-chip img,
.user-chip img,
.church-logo-empty,
.user-photo-empty {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  border-radius: 8px;
  object-fit: cover;
  background: rgba(79,148,99,.15);
  border: 1px solid var(--line);
}
.user-chip img,
.user-photo-empty {
  border-radius: 999px;
}
.church-logo-empty::before,
.user-photo-empty::before {
  content: '';
  display: block;
  width: 12px;
  height: 12px;
  margin: 7px auto;
  border: 2px solid currentColor;
  border-radius: 4px;
  color: #4f9463;
}
.user-photo-empty::before {
  border-radius: 999px;
}
.church-chip strong,
.user-chip strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px !important;
  margin: 0 !important;
}
.user-chip span {
  display: grid;
  min-width: 0;
}
.user-chip small {
  color: var(--muted);
  font-size: 10px;
}

.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;
}
.icon-inline,
.icon-action,
.icon-back,
.icon-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.icon-inline {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--menu-card-active);
  text-decoration: none;
}
.icon-action,
.icon-back,
.icon-save {
  width: 40px;
  min-width: 40px;
  padding: 0;
  font-size: 18px;
}
.icon-back::before { content: '\2190'; }
.icon-save::before { content: '\1F4BE'; }
.notification-options { align-items: start; }
.check-switch {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
}
.check-switch input[type="checkbox"] {
  appearance: none;
  width: 38px;
  height: 22px;
  min-width: 38px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #cbd5e1;
  position: relative;
  transition: background .18s ease, border-color .18s ease;
}
.check-switch input[type="checkbox"]::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  left: 1px;
  top: 1px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 2px 6px rgba(15,23,42,.25);
  transition: transform .18s ease;
}
.check-switch input[type="checkbox"]:checked {
  background: var(--brand);
  border-color: var(--brand);
}
.check-switch input[type="checkbox"]:checked::before { transform: translateX(16px); }
.check-switch span { font-weight: 600; color: var(--text); }
.lgpd-check { align-items: flex-start; }
.lgpd-check span { line-height: 1.45; font-weight: 500; }

.simple-chart {
  display: grid;
  gap: 10px;
  min-height: 220px;
}
.simple-row {
  display: grid;
  grid-template-columns: minmax(90px, 1fr) minmax(80px, 2fr) 44px;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}
.simple-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.simple-row b {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--brand), #22c55e);
  min-width: 6px;
}
.simple-row em {
  font-style: normal;
  font-weight: 700;
  text-align: right;
}
.pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin: 14px 0 24px;
}
.pagination label {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin: 0;
}
.pagination select {
  width: auto;
  min-width: 76px;
}
.wa-icon {
  width: 18px;
  height: 18px;
  display: inline-block;
  background: #25d366;
  border-radius: 999px;
  position: relative;
}
.wa-icon::before {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  left: 5px;
  top: 4px;
  border: 2px solid #fff;
  border-left-color: transparent;
  border-top-color: transparent;
  border-radius: 50%;
  transform: rotate(35deg);
}
.wa-icon::after {
  content: '';
  position: absolute;
  width: 5px;
  height: 5px;
  left: 2px;
  bottom: 1px;
  background: #25d366;
  transform: rotate(25deg);
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
}

/* Cadastro público em formato app */
.app-public {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 0;
  overflow: hidden;
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .12);
}
.public-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 22px;
  color: #172033;
  background: linear-gradient(135deg, #f7f3e8 0%, #e8f4ee 100%);
  border-bottom: 1px solid var(--line);
}
.public-logo {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: #1f7a4d;
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  flex: 0 0 auto;
}
.app-public .public-church-logo { background: transparent; border-radius: 0; }
.app-public .public-church-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.public-hero small {
  text-transform: uppercase;
  color: #5b6b62;
  font-weight: 800;
  font-size: 11px;
}
.public-hero h1 {
  margin: 2px 0 4px;
  font-size: 24px;
}
.public-hero p { margin: 0; color: #475467; }
.public-steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.public-steps span {
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #eef6f1;
  color: #256247;
  font-size: 12px;
  font-weight: 800;
}
.app-public .form-grid { padding: 18px; }
.app-public fieldset {
  background: #fbfcfb;
  border-radius: 14px;
}
.app-public .form-actions {
  position: sticky;
  bottom: 0;
  padding: 14px 0 4px;
  background: linear-gradient(180deg, rgba(255,255,255,.2), #fff 35%);
}
@media (max-width: 700px) {
  .app-public {
    border-radius: 0;
    box-shadow: none;
  }
  .public-hero {
    align-items: flex-start;
    padding: 18px;
  }
  .public-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }
  .public-steps {
    grid-template-columns: repeat(2, 1fr);
  }
  .app-public .form-grid { padding: 14px; }
}
/* Dashboard: mistura de gráficos */
.dashboard-charts {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: stretch;
}
.chart-card {
  position: relative;
  min-height: 330px;
  display: grid;
  grid-template-rows: auto auto minmax(230px, 1fr);
  gap: 6px;
}
.chart-card canvas {
  width: 100% !important;
  height: 250px !important;
  max-height: none;
}
.chart-wide { grid-column: span 2; }
.chart-small { grid-column: span 1; }
.chart-kind {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  background: rgba(37, 99, 235, .09);
  color: #1d4ed8;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}
html[data-theme="dark"] .chart-kind {
  background: rgba(96, 165, 250, .18);
  color: #bfdbfe;
}
.dashboard-charts .simple-chart {
  min-height: 230px;
  align-content: center;
}
.dashboard-charts .simple-row b {
  background: var(--brand);
}
@media (max-width: 1200px) {
  .dashboard-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-wide, .chart-small { grid-column: span 1; }
}
@media (max-width: 700px) {
  .dashboard-charts { grid-template-columns: 1fr; }
  .chart-card { min-height: 300px; grid-template-rows: auto auto minmax(210px, 1fr); }
  .chart-card canvas { height: 220px !important; }
}
/* Ajustes finais: mensagens, pendentes, botoes em texto e mobile */
.flash {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 80;
  width: min(440px, calc(100vw - 32px));
  transform: translate(-50%, -50%);
  padding: 18px 20px;
  border: 1px solid rgba(22, 101, 52, .22);
  border-radius: 16px;
  background: #ffffff;
  color: #172033;
  box-shadow: 0 24px 70px rgba(15, 23, 42, .22);
  font-weight: 800;
  text-align: center;
}
.flash::before {
  content: '';
  display: block;
  width: 38px;
  height: 38px;
  margin: 0 auto 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  box-shadow: 0 10px 24px rgba(22, 163, 74, .22);
}
html[data-theme="dark"] .flash {
  border-color: rgba(96, 165, 250, .25);
  background: #172033;
  color: #eef6ff;
}
.pending-link {
  position: relative;
}
.pending-badge {
  position: absolute;
  right: -8px;
  top: -8px;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  border: 2px solid #fff;
  font-size: 11px;
  line-height: 1;
  font-weight: 900;
}
html[data-theme="dark"] .pending-badge {
  border-color: #101828;
}
.metric-icon,
.title-icon {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  margin-right: 8px;
  border-radius: 10px;
  background: #e8f4ee;
  color: #1f7a4d;
  font-style: normal;
  font-weight: 900;
  font-size: 12px;
  vertical-align: middle;
}
.metric-icon {
  margin: 0 0 8px;
}
.title-icon {
  width: 24px;
  height: 24px;
  border-radius: 8px;
}
html[data-theme="dark"] .metric-icon,
html[data-theme="dark"] .title-icon {
  background: rgba(96, 165, 250, .16);
  color: #bfdbfe;
}
.icon-save::before,
.icon-back::before {
  content: none !important;
}
.form-actions .button.icon-save,
.form-actions .button.icon-back {
  gap: 0;
}
@media (max-width: 700px) {
  .dashboard-charts {
    gap: 12px;
  }
  .chart-card {
    min-height: auto;
    grid-template-rows: auto auto auto;
    padding: 14px;
    overflow: hidden;
  }
  .chart-card h2 {
    display: flex;
    align-items: center;
    font-size: 17px;
    line-height: 1.2;
  }
  .chart-kind {
    font-size: 10px;
    padding: 3px 8px;
  }
  .chart-card canvas {
    display: block;
    height: 190px !important;
    max-height: 190px !important;
  }
  .chart-card.chart-small canvas,
  .chart-card canvas[id="sexo"],
  .chart-card canvas[id="estado_civil"],
  .chart-card canvas[id="estado"] {
    height: 210px !important;
    max-height: 210px !important;
  }
  .metrics article {
    min-height: 106px;
  }
  .flash {
    top: 46%;
    padding: 16px;
    border-radius: 14px;
  }
}
/* Icones reais e relatorios estilo consulta */
.oc-icon {
  width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
}
.oc-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.metric-icon,
.title-icon {
  color: #1f7a4d;
}
.metric-icon .oc-icon,
.title-icon .oc-icon {
  margin: 0;
}
.chart-kind {
  display: none !important;
}
.report-filter-card {
  width: min(760px, 100%);
  margin: 0 auto 14px;
  padding: 22px 28px;
  border: 1px solid #b9c3e8;
  border-radius: 0;
  background: #fff;
}
.report-filter-row {
  display: grid;
  grid-template-columns: 180px minmax(180px, 1fr);
  gap: 14px;
  align-items: center;
  max-width: 560px;
  margin: 0 auto 10px;
}
.report-filter-row label {
  margin: 0;
  color: #172033;
  font-weight: 800;
  text-transform: uppercase;
}
.report-filter-row input,
.report-filter-row select {
  min-height: 42px;
}
.inline-range {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}
.report-filter-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 22px;
}
.report-filter-actions button,
.report-filter-actions .button {
  min-height: 44px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .14);
}
.button.mini {
  min-height: 30px;
  padding: 6px 10px;
  font-size: 12px;
}
html[data-theme="dark"] .report-filter-card {
  background: #172033;
  border-color: rgba(148, 163, 184, .28);
}
html[data-theme="dark"] .report-filter-row label {
  color: #e5eefb;
}
@media (max-width: 700px) {
  .report-filter-card {
    padding: 16px;
  }
  .report-filter-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .report-filter-actions {
    flex-direction: column;
  }
}
/* Polimento exclusivo para desktop: nao altera o layout mobile aprovado */
@media (min-width: 901px) {
  body {
    font-family: "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.42;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }
  .content {
    padding: 22px 26px;
  }
  .topbar {
    margin-bottom: 16px;
  }
  .topbar h1 {
    font-size: 23px;
    font-weight: 750;
    letter-spacing: 0;
  }
  .topbar p,
  .hint,
  td small {
    font-size: 12px;
  }
  button,
  .button,
  input,
  select,
  textarea {
    min-height: 34px;
    font-size: 13px;
  }
  button,
  .button {
    padding: 0 12px;
    font-weight: 650;
    box-shadow: none;
  }
  label {
    gap: 5px;
    font-size: 12.5px;
    font-weight: 650;
  }
  .panel,
  .metrics article {
    border-radius: 7px;
    padding: 14px;
    box-shadow: 0 8px 22px rgba(15, 23, 42, .045);
  }
  .metrics {
    gap: 12px;
    margin-bottom: 14px;
  }
  .metrics article {
    min-height: 96px;
  }
  .metrics span {
    font-size: 12px;
  }
  .metrics strong {
    font-size: 24px;
    margin-top: 4px;
  }
  .metric-icon {
    width: 24px;
    height: 24px;
    border-radius: 8px;
    margin-bottom: 6px;
  }
  .title-icon {
    width: 22px;
    height: 22px;
    border-radius: 7px;
  }
  .oc-icon,
  .oc-icon svg {
    width: 16px;
    height: 16px;
  }
  .dashboard-charts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
  }
  .chart-card {
    min-height: 250px;
    grid-template-rows: auto minmax(170px, 1fr);
    gap: 4px;
    padding: 14px;
  }
  .chart-card h2 {
    display: flex;
    align-items: center;
    margin-bottom: 6px;
    font-size: 15px;
    font-weight: 720;
  }
  .chart-card canvas {
    height: 185px !important;
    max-height: 185px !important;
  }
  .chart-card.chart-wide canvas {
    height: 200px !important;
    max-height: 200px !important;
  }
  th,
  td {
    padding: 9px 10px;
  }
  th {
    font-size: 11px;
    font-weight: 750;
  }
  .report-table table,
  table {
    font-size: 12.5px;
  }
  fieldset {
    gap: 12px;
    padding: 14px;
    border-radius: 7px;
  }
  legend {
    font-size: 13px;
    font-weight: 750;
  }
  .form-grid,
  .grid {
    gap: 13px;
  }
  .report-filter-card {
    padding: 18px 24px;
  }
  .report-filter-row {
    margin-bottom: 8px;
  }
  .report-filter-actions {
    margin-top: 16px;
  }
  .report-filter-actions button,
  .report-filter-actions .button {
    min-height: 38px;
    box-shadow: 0 8px 18px rgba(15, 23, 42, .10);
  }
  .flash {
    width: min(380px, calc(100vw - 40px));
    padding: 14px 16px;
    border-radius: 12px;
    font-size: 13px;
    box-shadow: 0 18px 44px rgba(15, 23, 42, .18);
  }
  .flash::before {
    width: 26px;
    height: 26px;
    margin-bottom: 7px;
  }
}
/* Relatorios: filtros sempre em coluna, sem alterar os campos existentes */
.report-filter-card {
  display: grid;
  grid-template-columns: 1fr;
}
.report-filter-row {
  width: min(620px, 100%);
}
@media (min-width: 701px) {
  .report-filter-card {
    justify-items: center;
  }
  .report-filter-row {
    grid-template-columns: 190px minmax(260px, 1fr);
  }
}
/* Filtros em faixa horizontal, preservando os campos existentes */
@media (min-width: 701px) {
  .filter-grid,
  .report-filter-card {
    width: 100%;
    max-width: none;
    margin: 0 0 14px;
    padding: 16px 18px;
    display: flex !important;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 14px;
    background: #fffdf8;
    border: 1px solid #e4d7c3;
    border-radius: 8px;
    box-shadow: none;
  }

  .filter-grid > input[type="hidden"],
  .report-filter-card > input[type="hidden"] {
    display: none;
  }

  .filter-grid > label,
  .report-filter-row {
    width: auto !important;
    min-width: 190px;
    max-width: 260px;
    flex: 1 1 210px;
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px;
    align-items: start;
    margin: 0 !important;
  }

  .filter-grid > label,
  .report-filter-row label {
    margin: 0;
    color: #111827;
    font-weight: 750;
    text-transform: none;
  }

  .filter-grid input,
  .filter-grid select,
  .report-filter-card input,
  .report-filter-card select {
    width: 100%;
    min-height: 42px;
    border-radius: 7px;
    border-color: #decfb8;
    background: #fff;
  }

  .inline-range {
    grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr);
  }

  .filter-grid .form-actions,
  .report-filter-actions {
    flex: 0 0 auto;
    display: flex;
    align-items: flex-end;
    justify-content: flex-start;
    gap: 10px;
    margin: 0 !important;
    padding-top: 20px;
  }

  .filter-grid .form-actions button,
  .filter-grid .form-actions .button,
  .report-filter-actions button,
  .report-filter-actions .button {
    min-height: 42px;
    padding: 0 16px;
    border-radius: 7px;
    box-shadow: none;
  }

  html[data-theme="dark"] .filter-grid,
  html[data-theme="dark"] .report-filter-card {
    background: #172033;
    border-color: rgba(148, 163, 184, .30);
  }

  html[data-theme="dark"] .filter-grid > label,
  html[data-theme="dark"] .report-filter-row label {
    color: #e5eefb;
  }
}
/* Login centralizado com logomarca */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: #f4ecdf;
}

.login-page .login-card {
  width: min(430px, 100%);
  margin: 0 auto;
  text-align: center;
  border-radius: 14px;
  padding: 30px 28px;
  box-shadow: 0 18px 48px rgba(15, 23, 42, .10);
}

.login-logo {
  display: block;
  width: clamp(96px, 28vw, 150px);
  height: auto;
  margin: 0 auto 18px;
}

.login-page .login-card h1 {
  margin: 0 0 6px;
}

.login-page .login-card p {
  margin: 0 0 22px;
  color: var(--muted);
}

.login-page .stack {
  text-align: left;
}

.login-page .stack button,
.login-page .stack .button {
  width: 100%;
}

html[data-theme="dark"] .login-page {
  background: #111827;
}

@media (max-width: 700px) {
  .login-page {
    align-items: center;
    padding: 18px;
  }

  .login-page .login-card {
    padding: 26px 20px;
  }

  .login-logo {
    width: 112px;
    margin-bottom: 16px;
  }
}
/* Calendario de aniversariantes e flyout compacto de relatorios */
.birthday-calendar {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}
.birthday-calendar header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
}
.birthday-calendar header strong { font-size: 18px; }
.birthday-calendar header span { color: var(--muted); font-size: 13px; }
.birthday-calendar table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.birthday-calendar th {
  padding: 10px;
  background: #eef2ff;
  color: #1f2a44;
  text-align: center;
  font-size: 12px;
}
.birthday-calendar td {
  height: 118px;
  vertical-align: top;
  padding: 8px;
  border: 1px solid var(--line);
  background: #fff;
}
.birthday-calendar td.empty { background: #f8fafc; }
.birthday-calendar b {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  color: #172033;
  margin-bottom: 5px;
}
.birthday-calendar span {
  display: block;
  margin-top: 4px;
  padding: 4px 6px;
  border-radius: 6px;
  background: #e8f3ff;
  color: #164e83;
  font-size: 11px;
  line-height: 1.2;
}
.report-filter-row select[multiple] {
  min-height: 112px;
  padding: 8px;
}
.compact-menu .submenu.flyout {
  max-height: min(520px, calc(100vh - 42px));
  overflow-y: auto;
}
.compact-menu .submenu.flyout a {
  min-height: 32px;
  padding: 7px 10px;
  font-size: 12px;
}
html[data-theme="dark"] .birthday-calendar header,
html[data-theme="dark"] .birthday-calendar td.empty { background: #111827; }
html[data-theme="dark"] .birthday-calendar th { background: #1f2937; color: #e5eefb; }
html[data-theme="dark"] .birthday-calendar td { background: #172033; }
html[data-theme="dark"] .birthday-calendar span { background: rgba(37, 99, 235, .18); color: #bfdbfe; }
@media (max-width: 700px) {
  .birthday-calendar { overflow-x: auto; }
  .birthday-calendar table { min-width: 720px; }
  .birthday-calendar td { height: 104px; }
}
/* Submenus acima dos paineis no desktop */
@media (min-width: 901px) {
  .sidebar.app-menu,
  .sidebar.compact-menu {
    z-index: 2000;
  }

  .compact-menu .menu-group {
    z-index: 2001;
  }

  .compact-menu .menu-group[open],
  .compact-menu .menu-group:hover,
  .compact-menu .menu-group:focus-within {
    z-index: 2100;
  }

  .compact-menu .submenu.flyout,
  html[data-theme] .compact-menu .submenu.flyout {
    z-index: 2200;
  }

  .content {
    position: relative;
    z-index: 1;
  }
}
/* Menu principal mais compacto em desktop e celular */
.sidebar.app-menu,
.sidebar.compact-menu {
  padding: 12px 9px;
}
.sidebar.app-menu .brand-row,
.sidebar.compact-menu .brand-row {
  gap: 6px;
  margin-bottom: 8px;
}
.sidebar.app-menu strong,
.sidebar.compact-menu strong {
  font-size: 13px;
  line-height: 1.12;
}
.sidebar.app-menu strong small,
.sidebar.compact-menu strong small,
.brand-title small {
  font-size: 8.5px;
  line-height: 1.12;
}
.church-chip,
.user-chip {
  padding: 6px 7px;
  min-height: 38px;
  gap: 6px;
}
.church-chip strong,
.user-chip strong {
  font-size: 11.5px;
}
.user-chip small {
  font-size: 9.5px;
  line-height: 1.2;
}
.sidebar.app-menu a,
.sidebar.app-menu summary,
.compact-menu .menu-card,
.compact-menu .menu-group > summary {
  min-height: 32px;
  padding: 5px 7px;
  font-size: 11.5px;
  line-height: 1.12;
  border-radius: 7px;
}
.menu-icon {
  width: 19px;
  height: 19px;
  min-width: 19px;
  border-radius: 6px;
  font-size: 9px;
}
.compact-menu .menu-links {
  gap: 5px;
}
.compact-menu .submenu.flyout a {
  min-height: 27px;
  padding: 5px 8px;
  font-size: 11px;
}
.theme-toggle,
.power-link {
  min-height: 28px;
  width: 28px;
  padding: 0;
}
@media (max-width: 900px) {
  .sidebar.app-menu,
  .sidebar.compact-menu {
    padding: 9px;
  }
  .sidebar.app-menu .menu-links,
  .sidebar.compact-menu .menu-links {
    gap: 4px;
  }
  .sidebar.app-menu a,
  .sidebar.app-menu summary,
  .compact-menu .menu-card,
  .compact-menu .menu-group > summary {
    min-height: 30px;
    padding: 5px 6px;
    font-size: 11px;
  }
  .menu-icon {
    width: 18px;
    height: 18px;
    min-width: 18px;
  }
}
.module-access {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.45);
}
.module-access legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 12px;
}
.module-access .check-switch {
  margin: 0;
}
html[data-theme="dark"] .module-access {
  background: rgba(15,23,42,.28);
}

/* Organização da tela de usuários */
.users-layout {
  display: grid;
  gap: 14px;
}
.user-form-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.user-form-panel h2,
.user-form-panel .wide,
.user-form-panel .form-actions {
  grid-column: 1 / -1;
}
.users-list-panel {
  min-width: 0;
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.section-title-row h2 {
  margin: 0;
}
.muted-count {
  color: var(--muted);
  font-size: 13px;
  white-space: nowrap;
}
.users-list-panel .table-wrap {
  overflow-x: auto;
}
.users-list-panel table {
  min-width: 920px;
}
@media (max-width: 800px) {
  .user-form-panel {
    grid-template-columns: 1fr;
  }
  .section-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
}
/* Dashboard: últimos membros com foto */
.latest-members-card {
  min-height: 250px;
}
.latest-members-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-content: start;
}
.latest-member {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  background: rgba(255,255,255,.58);
}
.latest-member:hover {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 10px 22px rgba(15,23,42,.08);
}
.latest-member img,
.latest-member-initial {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  object-fit: cover;
}
.latest-member-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
  font-size: 20px;
}
.latest-member strong,
.latest-member small {
  display: block;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest-member strong {
  font-size: 14px;
}
.latest-member small {
  color: var(--muted);
  margin-top: 3px;
  font-size: 12px;
}
html[data-theme="dark"] .latest-member {
  background: rgba(15,23,42,.36);
}
html[data-theme="dark"] .latest-member-initial {
  background: rgba(96,165,250,.18);
  color: #bfdbfe;
}
@media (max-width: 700px) {
  .latest-members-list {
    grid-template-columns: 1fr;
  }
  .latest-member {
    grid-template-columns: 48px minmax(0, 1fr);
  }
  .latest-member img,
  .latest-member-initial {
    width: 48px;
    height: 48px;
    border-radius: 12px;
  }
}
/* Dashboard: cards de aniversariantes */
.dashboard-event-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 14px 0;
}
.event-card {
  min-width: 0;
}
.event-card h2 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.event-list {
  display: grid;
  gap: 9px;
}
.event-person {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-decoration: none;
  color: inherit;
  background: rgba(255,255,255,.55);
}
.event-person:hover {
  border-color: rgba(37,99,235,.45);
  box-shadow: 0 8px 18px rgba(15,23,42,.08);
}
.event-person img,
.event-person > span:first-child {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
}
.event-person > span:first-child {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #dbeafe;
  color: #1d4ed8;
  font-weight: 800;
}
.event-person b,
.event-person small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-person b {
  font-size: 13.5px;
}
.event-person small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
html[data-theme="dark"] .event-person {
  background: rgba(15,23,42,.36);
}
html[data-theme="dark"] .event-person > span:first-child {
  background: rgba(96,165,250,.18);
  color: #bfdbfe;
}
@media (max-width: 1000px) {
  .dashboard-event-cards { grid-template-columns: 1fr; }
}
/* Dashboard: cards visuais com foto no estilo app */
.dashboard-event-cards .event-list,
.latest-members-card .latest-members-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 12px;
  align-items: stretch;
}
.event-card,
.latest-members-card {
  overflow: hidden;
}
.event-person,
.latest-member {
  position: relative;
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  min-height: 160px;
  padding: 12px 8px 10px;
  border: 1px solid rgba(148, 163, 184, .20);
  border-radius: 10px;
  background: linear-gradient(180deg, #111827 0%, #0b1020 100%);
  color: #f8fafc;
  text-align: center;
  text-decoration: none;
  box-shadow: 0 10px 22px rgba(15,23,42,.12);
}
.event-person::after,
.latest-member::after {
  content: "";
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #22c55e;
  box-shadow: 0 0 0 3px rgba(34,197,94,.14);
}
.event-person:hover,
.latest-member:hover {
  transform: translateY(-1px);
  border-color: rgba(96,165,250,.45);
  box-shadow: 0 14px 28px rgba(15,23,42,.18);
}
.event-person img,
.latest-member img,
.event-person > span:first-child,
.latest-member-initial {
  width: 70px !important;
  height: 70px !important;
  flex: 0 0 70px;
  border-radius: 16px !important;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.16);
  background: #1f2937;
}
.event-person > span:first-child,
.latest-member-initial {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #bfdbfe;
  font-size: 24px;
  font-weight: 800;
}
.event-person b,
.latest-member strong {
  width: 100%;
  display: block;
  margin-top: 2px;
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.event-person small,
.latest-member small {
  width: 100%;
  display: block;
  color: #cbd5e1;
  font-size: 10.5px;
  line-height: 1.2;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.latest-member > span:not(.latest-member-initial) {
  width: 100%;
  min-width: 0;
}
.latest-member small:last-child,
.event-person small:last-child {
  color: #93c5fd;
}
html[data-theme="clean"] .event-person,
html[data-theme="clean"] .latest-member {
  background: linear-gradient(180deg, #111827 0%, #0b1020 100%);
}
@media (max-width: 700px) {
  .dashboard-event-cards .event-list,
  .latest-members-card .latest-members-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .event-person,
  .latest-member {
    min-height: 148px;
  }
  .event-person img,
  .latest-member img,
  .event-person > span:first-child,
  .latest-member-initial {
    width: 62px !important;
    height: 62px !important;
    flex-basis: 62px;
  }
}
/* Ajustes solicitados: senha, mensagens e cadastro de pessoa */
.password-field { position: relative; display: block; width: 100%; }
.password-field input { padding-right: 76px; }
.password-toggle {
  position: absolute; right: 7px; top: 50%; transform: translateY(-50%);
  width: auto; min-width: 48px; min-height: 30px; height: 30px; padding: 0 8px;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  box-shadow: none; font-size: 12px; font-weight: 800;
}
.password-toggle:hover, .password-toggle.is-visible { background: rgba(37,99,235,.10); color: var(--brand); }
.flash { padding-bottom: 18px; }
.flash-ok {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 92px; min-height: 38px; margin-top: 14px; border: 0; border-radius: 8px;
  background: var(--brand); color: #fff; font-weight: 800; cursor: pointer;
}
.form-grid.member-form { gap: 18px; }
.member-form fieldset {
  border-radius: 12px; padding: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.94), rgba(248,250,252,.88));
}
.member-form legend { padding: 0 10px; font-size: 14px; letter-spacing: .02em; }
.member-form label { gap: 6px; }
.member-form input, .member-form select, .member-form textarea { min-height: 42px; }
.member-form textarea { min-height: 120px; }
.member-form .top-actions {
  position: sticky; top: 10px; z-index: 20; justify-content: flex-end; padding: 10px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  box-shadow: 0 10px 24px rgba(15,23,42,.08);
}
.member-photo-card {
  align-self: stretch; justify-content: center; min-height: 150px; padding: 14px;
  border: 1px dashed var(--line); border-radius: 12px; background: var(--input-bg);
}
.member-photo-card .avatar-large { width: 118px; height: 118px; border-radius: 20px; }
html[data-theme="dark"] .member-form fieldset { background: linear-gradient(180deg, rgba(23,32,51,.96), rgba(15,23,42,.92)); }
@media (max-width: 800px) {
  .member-form .top-actions { position: static; justify-content: stretch; }
  .member-form .top-actions .button, .member-form .top-actions button { width: 100%; }
}
/* Correção: olhinho da senha ao lado do campo, sem cobrir a digitação */
.password-field {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: center;
  gap: 6px;
}
.password-field input {
  padding-right: 12px !important;
  min-width: 0;
}
.password-field .password-toggle,
.login-page .stack .password-field .password-toggle {
  position: static !important;
  transform: none !important;
  width: 42px !important;
  min-width: 42px !important;
  max-width: 42px !important;
  height: 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  flex: 0 0 42px;
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.password-field .password-toggle:hover,
.password-field .password-toggle.is-visible {
  background: rgba(37,99,235,.10);
  color: var(--brand);
}

/* Central de ajuda */
@media (max-width: 900px) {
  .compact-menu .submenu.flyout {
    max-height: none;
    overflow: visible;
  }
}
@media (min-width: 901px) {
  .compact-menu .submenu.flyout {
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}
.help-floating {
  position: fixed;
  right: max(8px, env(safe-area-inset-right));
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 1000;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  min-width: 60px;
  padding: 0;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #2563eb;
  color: #fff;
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  box-shadow: 0 5px 20px rgba(37,99,235,.4), 0 2px 6px rgba(0,0,0,.2);
  transition: background .15s ease, box-shadow .15s ease;
}
.help-floating:hover { background: #1d4ed8; color: #fff; box-shadow: 0 6px 24px rgba(37,99,235,.5); }
.help-floating:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.help-topbar { margin-bottom: 14px; }
.help-search-panel { margin-bottom: 16px; padding: 18px; }
.help-search-panel > label {
  display: block;
  margin-bottom: 9px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
}
.help-search-box {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: center;
  max-width: 780px;
  min-height: 48px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
}
.help-search-box > span {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 16px;
}
.help-search-box input {
  width: 100%;
  min-height: 46px;
  padding: 0 14px 0 0;
  border: 0;
  border-radius: 0;
  outline: 0;
  background: transparent;
  box-shadow: none;
}
.help-search-hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }
.help-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.help-categories {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 3px;
  padding: 12px;
}
.help-categories strong { padding: 7px 9px; font-size: 13px; }
.help-categories a {
  padding: 8px 9px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.help-categories a:hover { background: rgba(37,99,235,.10); color: var(--brand); }
.help-content { display: grid; gap: 12px; min-width: 0; }
.help-article {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 13px;
  padding: 18px;
  scroll-margin-top: 12px;
}
.help-article[hidden] { display: none !important; }
.help-article-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: rgba(37,99,235,.12);
  color: var(--brand);
  font-size: 14px;
  font-weight: 900;
}
.help-article h2 { margin: 2px 0 5px; font-size: 17px; }
.help-article p { margin: 0; color: var(--muted); line-height: 1.55; }
.help-article ol { margin: 12px 0 0; padding-left: 20px; color: var(--muted); }
.help-article li + li { margin-top: 5px; }
.help-article details {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.help-article summary {
  cursor: pointer;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}
.help-article details p { padding: 8px 0 2px; font-size: 13px; }
.help-empty { margin: 0; color: var(--muted); text-align: center; }
@media (max-width: 900px) {
  .help-layout { grid-template-columns: 1fr; }
  .help-categories {
    position: static;
    display: flex;
    overflow-x: auto;
    white-space: nowrap;
  }
  .help-categories strong { display: none; }
  .help-categories a { flex: 0 0 auto; border: 1px solid var(--line); }
}
@media (max-width: 600px) {
  .help-search-panel, .help-article { padding: 14px; }
  .help-article { grid-template-columns: 32px minmax(0, 1fr); gap: 10px; }
  .help-article-icon { width: 32px; height: 32px; }
  .help-article h2 { font-size: 15px; }
}

/* Keep long content inside its layout without clipping wide tables. */
.churches-layout { grid-template-columns: minmax(280px, .8fr) minmax(0, 1.2fr); }
.churches-layout > * { min-width: 0; }
.churches-list .table-wrap { overflow-x: auto; }
.churches-list table { min-width: 650px; }
@media (max-width: 1200px) {
  .churches-layout { grid-template-columns: minmax(0, 1fr); }
}
.content, .content > *, .panel, .table-wrap,
.form-grid, fieldset, .filter-grid, .report-main {
  min-width: 0;
}
.content p, .content h1, .content h2, .content h3,
.content label, .content .hint, .content .flash {
  overflow-wrap: anywhere;
}
.table-wrap { max-width: 100%; }
.content input, .content select, .content textarea {
  min-width: 0;
  max-width: 100%;
}
.content .form-actions, .content .top-actions, .content .pagination {
  flex-wrap: wrap;
  max-width: 100%;
}
.content .form-actions > *, .content .top-actions > * {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}
.topbar > div, .tenant-switch { min-width: 0; max-width: 100%; }
@media (max-width: 700px) {
  .tenant-switch select { min-width: 0; }
  .content .form-actions, .content .top-actions { row-gap: 10px; }
}
