*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── DROPDOWN NOTIF / USER MENU ─── */
.notif-dropdown, .user-menu {
  position: absolute; top: calc(100% + 8px); right: 0;
  background: var(--card-bg); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  min-width: 240px; z-index: 200; overflow: hidden;
}
.notif-header { padding: .65rem 1rem; font-size: .78rem; font-weight: 700; color: var(--text-muted); border-bottom: 1px solid var(--border); background: var(--bg); }
.notif-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; font-size: .83rem; color: var(--text); text-decoration: none; }
.notif-item:hover { background: var(--bg); }
.user-menu .um-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); background: var(--bg); }
.user-menu .um-header strong { display: block; font-size: .85rem; }
.user-menu .um-header small { color: var(--text-muted); font-size: .75rem; }
.user-menu a { display: flex; align-items: center; gap: .6rem; padding: .65rem 1rem; font-size: .85rem; color: var(--text); text-decoration: none; }
.user-menu a:hover { background: var(--bg); }

:root {
  --primary: #4F46E5;
  --primary-light: #EEF2FF;
  --primary-dark: #3730A3;
  --green: #10B981;
  --green-light: #ECFDF5;
  --orange: #F59E0B;
  --orange-light: #FFFBEB;
  --red: #EF4444;
  --red-light: #FEF2F2;
  --purple: #8B5CF6;
  --purple-light: #F5F3FF;
  --blue: #3B82F6;
  --blue-light: #EFF6FF;
  --sidebar-w: 260px;
  --sidebar-collapsed: 68px;
  --topbar-h: 64px;
  --bg: #F8FAFC;
  --card-bg: #FFFFFF;
  --border: #E2E8F0;
  --text: #1E293B;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1), 0 2px 4px -1px rgba(0,0,0,.06);
  --radius: 12px;
  --radius-sm: 8px;
}

html { overflow-x: hidden; max-width: 100vw; }
body { font-family: 'Inter', sans-serif; background: var(--bg); color: var(--text); display: flex; min-height: 100vh; overflow-x: hidden; max-width: 100vw; width: 100%; }

/* ─── SIDEBAR ─── */
.sidebar {
  width: var(--sidebar-w);
  background: #1E1B4B;
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh;
  z-index: 100; transition: width .25s ease;
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-label,
.sidebar.collapsed .nav-item span:not(.badge),
.sidebar.collapsed .user-name,
.sidebar.collapsed .user-role { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: .75rem; }
.sidebar.collapsed .badge { display: none; }

.sidebar-header {
  display: flex; align-items: center; justify-content: center;
  padding: .75rem 1rem 0; border-bottom: 1px solid rgba(255,255,255,.1);
  position: relative;
}
.logo { display: flex; flex-direction: column; align-items: center; gap: .4rem; color: #fff; font-weight: 700; font-size: .85rem; text-align: center; padding-bottom: .75rem; width: 100%; }
.logo i { font-size: 2.2rem; color: #818CF8; }
.sidebar-toggle { background: none; border: none; color: rgba(255,255,255,.5); cursor: pointer; font-size: 1rem; padding: .25rem; }
.sidebar-toggle:hover { color: #fff; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 1rem 0; }
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,.1); border-radius: 2px; }

.nav-section { margin-bottom: 1.5rem; }
.nav-label { font-size: .65rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 0 1rem .5rem; display: block; white-space: nowrap; }

.nav-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem 1rem; color: rgba(255,255,255,.65);
  text-decoration: none; font-size: .95rem; font-weight: 500;
  transition: all .15s; white-space: nowrap; position: relative;
  margin: .1rem .5rem; border-radius: var(--radius-sm);
}
.nav-item:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item i { font-size: .95rem; width: 18px; text-align: center; flex-shrink: 0; }

.badge { background: rgba(255,255,255,.2); color: #fff; font-size: .65rem; font-weight: 700; padding: .15rem .45rem; border-radius: 999px; margin-left: auto; }
.badge-warn { background: #F59E0B !important; }

.sidebar-footer { padding: 1rem; border-top: 1px solid rgba(255,255,255,.1); }
.user-info { display: flex; align-items: center; gap: .75rem; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700; flex-shrink: 0; }
.user-name { font-size: .8rem; font-weight: 600; color: #fff; }
.user-role { font-size: .7rem; color: rgba(255,255,255,.4); }

/* ─── MAIN ─── */
.main-content {
  margin-left: var(--sidebar-w); flex: 1;
  display: flex; flex-direction: column; min-height: 100vh;
  transition: margin-left .25s ease;
}
.main-content.expanded { margin-left: var(--sidebar-collapsed); }

/* ─── TOPBAR ─── */
.topbar {
  height: var(--topbar-h); background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 1.5rem; position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow);
}
.topbar-left { display: flex; align-items: center; gap: 1rem; }
.menu-btn { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; padding: .25rem; }
.page-title { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.search-box { display: flex; align-items: center; gap: .5rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .75rem; }
.search-box i { color: var(--text-muted); font-size: .85rem; }
.search-box input { border: none; background: none; font-size: .85rem; outline: none; width: 180px; color: var(--text); }
.icon-btn { background: none; border: 1px solid var(--border); border-radius: var(--radius-sm); width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); position: relative; }
.icon-btn:hover { background: var(--bg); color: var(--text); }
.notif-dot { position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; background: var(--red); border-radius: 50%; }
.user-avatar-top { width: 36px; height: 36px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; cursor: pointer; }

/* ─── PAGE CONTENT ─── */
.page-content { flex: 1; padding: 1.5rem; }
.page { display: none; animation: fadeIn .2s ease; }
.page.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ─── WELCOME BAR ─── */
.welcome-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.welcome-bar h2 { font-size: 1.3rem; font-weight: 700; }
.welcome-bar p { font-size: .85rem; color: var(--text-muted); margin-top: .2rem; }

/* ─── KPI GRID ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.5rem; }
.kpi-card { background: var(--card-bg); border-radius: var(--radius); padding: 1.25rem; display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow); border: 1px solid var(--border); }
.kpi-icon { width: 52px; height: 52px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; }
.kpi-value { font-size: 1.5rem; font-weight: 800; }
.kpi-label { font-size: .78rem; color: var(--text-muted); margin-top: .1rem; }
.kpi-trend { font-size: .72rem; font-weight: 600; margin-top: .4rem; display: flex; align-items: center; gap: .25rem; }
.kpi-trend.up { color: var(--green); }
.kpi-trend.down { color: var(--red); }
.kpi-trend.neutral { color: var(--text-muted); }
.kpi-blue .kpi-icon { background: var(--blue-light); color: var(--blue); }
.kpi-green .kpi-icon { background: var(--green-light); color: var(--green); }
.kpi-orange .kpi-icon { background: var(--orange-light); color: var(--orange); }
.kpi-purple .kpi-icon { background: var(--purple-light); color: var(--purple); }
.kpi-red .kpi-icon { background: var(--red-light); color: var(--red); }

/* ─── DASHBOARD GRID ─── */
.dashboard-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1.25rem; }
.tesouraria-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 1.25rem; }

/* ─── CARD ─── */
.card { background: var(--card-bg); border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); padding: 1.25rem; }
.card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.card-header h3 { font-size: .95rem; font-weight: 700; }
.link-sm { font-size: .78rem; color: var(--primary); text-decoration: none; font-weight: 500; }
.link-sm:hover { text-decoration: underline; }
.select-sm { font-size: .78rem; border: 1px solid var(--border); border-radius: 6px; padding: .25rem .5rem; color: var(--text); background: var(--bg); }
.badge-month { font-size: .72rem; background: var(--primary-light); color: var(--primary); padding: .2rem .6rem; border-radius: 999px; font-weight: 600; }

/* ─── BIRTHDAY LIST ─── */
.birthday-list { display: flex; flex-direction: column; gap: .6rem; }
.birthday-item { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: var(--radius-sm); }
.birthday-item:hover { background: var(--bg); }
.b-avatar { width: 36px; height: 36px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .72rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.b-name { font-size: .85rem; font-weight: 600; }
.b-date { font-size: .75rem; color: var(--text-muted); }
.b-today { font-size: .65rem; background: var(--orange); color: #fff; padding: .1rem .4rem; border-radius: 999px; font-weight: 700; }

/* ─── FINANCIAL SUMMARY ─── */
.fin-summary { display: grid; grid-template-columns: repeat(3,1fr); gap: .75rem; margin-top: 1rem; }
.fin-item { padding: .75rem; border-radius: var(--radius-sm); text-align: center; }
.fin-item span { display: block; font-size: .72rem; color: var(--text-muted); margin-bottom: .25rem; }
.fin-item strong { font-size: .95rem; font-weight: 700; }
.fin-item.green { background: var(--green-light); color: var(--green); }
.fin-item.green strong { color: var(--green); }
.fin-item.red { background: var(--red-light); color: var(--red); }
.fin-item.red strong { color: var(--red); }
.fin-item.blue { background: var(--blue-light); color: var(--blue); }
.fin-item.blue strong { color: var(--blue); }

/* ─── EVENTS LIST ─── */
.events-list { display: flex; flex-direction: column; gap: .6rem; }
.event-item { display: flex; align-items: center; gap: .75rem; padding: .6rem; border-radius: var(--radius-sm); border-left: 3px solid var(--primary); background: var(--primary-light); }
.event-date { text-align: center; min-width: 42px; }
.event-day { font-size: 1.1rem; font-weight: 800; color: var(--primary); line-height: 1; }
.event-month { font-size: .65rem; color: var(--primary); text-transform: uppercase; font-weight: 600; }
.event-info .e-title { font-size: .85rem; font-weight: 600; }
.event-info .e-time { font-size: .75rem; color: var(--text-muted); }

/* ─── PRAYER LIST ─── */
.prayer-list { display: flex; flex-direction: column; gap: .6rem; }
.prayer-item { padding: .75rem; border-radius: var(--radius-sm); background: var(--purple-light); border-left: 3px solid var(--purple); }
.prayer-item .p-name { font-size: .82rem; font-weight: 600; color: var(--purple); }
.prayer-item .p-text { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.prayer-item .p-meta { font-size: .7rem; color: var(--text-light); margin-top: .3rem; }

/* ─── NEW MEMBERS ─── */
.new-members-list { display: flex; flex-direction: column; gap: .5rem; }
.new-member-item { display: flex; align-items: center; gap: .75rem; padding: .5rem; border-radius: var(--radius-sm); }
.new-member-item:hover { background: var(--bg); }
.nm-name { font-size: .85rem; font-weight: 600; }
.nm-date { font-size: .75rem; color: var(--text-muted); }
.nm-dept { font-size: .68rem; background: var(--primary-light); color: var(--primary); padding: .15rem .5rem; border-radius: 999px; font-weight: 600; }

/* ─── PAGE HEADER ─── */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.3rem; font-weight: 700; }
.page-header p { font-size: .85rem; color: var(--text-muted); }
.header-actions { display: flex; gap: .75rem; }

/* ─── BUTTONS ─── */
.btn-primary { background: var(--primary); color: #fff; border: none; border-radius: var(--radius-sm); padding: .55rem 1.1rem; font-size: .85rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: .4rem; transition: background .15s; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: none; color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem 1.1rem; font-size: .85rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: .4rem; transition: all .15s; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--red); color: #fff; border: none; border-radius: var(--radius-sm); padding: .55rem 1.1rem; font-size: .85rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: .4rem; }
.btn-sm { background: var(--primary-light); color: var(--primary); border: none; border-radius: 6px; padding: .3rem .7rem; font-size: .75rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem; }
.btn-whatsapp { background: #25D366; color: #fff; border: none; border-radius: var(--radius-sm); padding: .6rem 1.2rem; font-size: .85rem; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: .4rem; width: 100%; justify-content: center; }

/* ─── FILTERS ─── */
.filters-bar { display: flex; gap: .75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.search-filter { display: flex; align-items: center; gap: .5rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .75rem; flex: 1; min-width: 200px; }
.search-filter i { color: var(--text-muted); }
.search-filter input { border: none; background: none; font-size: .85rem; outline: none; width: 100%; }
.filters-bar select { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .45rem .75rem; font-size: .85rem; background: var(--card-bg); color: var(--text); cursor: pointer; }

/* ─── TABLE ─── */
.data-table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.data-table th { text-align: left; padding: .6rem .75rem; font-size: .72rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 2px solid var(--border); background: var(--bg); }
.data-table td { padding: .75rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg); }
.data-table tr:last-child td { border-bottom: none; }
.member-cell { display: flex; align-items: center; gap: .6rem; }
.status-badge { font-size: .7rem; font-weight: 600; padding: .2rem .6rem; border-radius: 999px; }
.status-ativo { background: var(--green-light); color: var(--green); }
.status-inativo { background: var(--red-light); color: var(--red); }
.status-visitante { background: var(--orange-light); color: var(--orange); }
.action-btns { display: flex; gap: .4rem; }
.action-btn { background: none; border: 1px solid var(--border); border-radius: 6px; width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-muted); font-size: .8rem; }
.action-btn:hover { border-color: var(--primary); color: var(--primary); }
.action-btn.del:hover { border-color: var(--red); color: var(--red); }

/* ─── BADGE VARIANTS ─── */
.badge-blue { background: var(--blue-light) !important; color: var(--blue) !important; }
.badge-green { background: var(--green-light) !important; color: var(--green) !important; }

/* ─── STATS GRID ─── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.stat-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem 1.25rem; display: flex; align-items: center; gap: .85rem; }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; }
.stat-info .stat-value { font-size: 1.4rem; font-weight: 700; color: var(--text); line-height: 1; }
.stat-info .stat-label { font-size: .75rem; color: var(--text-muted); margin-top: .2rem; }

/* ─── TABS ─── */
.tabs { display: flex; gap: .25rem; margin-bottom: 1rem; background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .25rem; width: fit-content; }
.tab { background: none; border: none; border-radius: 6px; padding: .45rem 1rem; font-size: .85rem; font-weight: 500; cursor: pointer; color: var(--text-muted); transition: all .15s; }
.tab.active { background: var(--primary); color: #fff; }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ─── CALENDAR ─── */
.calendar-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.calendar-header button { background: none; border: 1px solid var(--border); border-radius: 6px; width: 32px; height: 32px; cursor: pointer; color: var(--text-muted); }
.calendar-header h3 { font-size: 1rem; font-weight: 700; }
.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-day-header { text-align: center; font-size: .72rem; font-weight: 700; color: var(--text-muted); padding: .4rem; text-transform: uppercase; }
.cal-day { min-height: 70px; border: 1px solid var(--border); border-radius: 6px; padding: .4rem; font-size: .8rem; cursor: pointer; transition: background .1s; }
.cal-day:hover { background: var(--primary-light); }
.cal-day.today { border-color: var(--primary); background: var(--primary-light); }
.cal-day.other-month { opacity: .4; }
.cal-day .day-num { font-weight: 700; font-size: .85rem; margin-bottom: .2rem; }
.cal-day.today .day-num { color: var(--primary); }
.cal-event { background: var(--primary); color: #fff; font-size: .65rem; padding: .1rem .3rem; border-radius: 3px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ─── PRESENÇA ─── */
.presenca-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.presenca-search { margin-bottom: 1rem; }
.presenca-search input { width: 100%; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .75rem; font-size: .85rem; outline: none; }
.presenca-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem; max-height: 400px; overflow-y: auto; }
.presenca-item { display: flex; align-items: center; gap: .6rem; padding: .6rem; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; transition: all .15s; }
.presenca-item.presente { border-color: var(--green); background: var(--green-light); }
.presenca-item .p-check { width: 20px; height: 20px; border: 2px solid var(--border); border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: .7rem; color: var(--green); flex-shrink: 0; }
.presenca-item.presente .p-check { border-color: var(--green); background: var(--green); color: #fff; }
.presenca-item .p-nm { font-size: .82rem; font-weight: 500; }

/* ─── DEPARTAMENTOS ─── */
.dept-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.dept-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.dept-icon { width: 48px; height: 48px; border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center; font-size: 1.3rem; margin-bottom: .75rem; }
.dept-card h4 { font-weight: 700; margin-bottom: .25rem; }
.dept-card p { font-size: .8rem; color: var(--text-muted); margin-bottom: .75rem; }
.dept-stats { display: flex; gap: 1rem; }
.dept-stat { font-size: .8rem; }
.dept-stat strong { display: block; font-size: 1.1rem; font-weight: 800; }

/* ─── PRAYER GRID ─── */
.prayer-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.prayer-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.prayer-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: .75rem; }
.prayer-card .pc-name { font-weight: 700; font-size: .9rem; }
.urgency { font-size: .68rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; }
.urgency-normal { background: var(--green-light); color: var(--green); }
.urgency-urgente { background: var(--orange-light); color: var(--orange); }
.urgency-muito { background: var(--red-light); color: var(--red); }
.prayer-card .pc-text { font-size: .82rem; color: var(--text-muted); line-height: 1.5; margin-bottom: .75rem; }
.prayer-card .pc-meta { display: flex; align-items: center; justify-content: space-between; font-size: .72rem; color: var(--text-light); }
.prayer-card .pc-actions { display: flex; gap: .4rem; margin-top: .75rem; }

/* ─── BIRTHDAYS ─── */
.month-tabs { display: flex; gap: .3rem; flex-wrap: wrap; }
.month-tab { padding: .3rem .7rem; border: 1px solid var(--border); border-radius: 999px; font-size: .78rem; cursor: pointer; background: var(--card-bg); transition: all .15s; }
.month-tab.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.birthday-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.birthday-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); display: flex; align-items: center; gap: .75rem; }
.birthday-card .bc-avatar { width: 48px; height: 48px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .85rem; font-weight: 700; color: #fff; flex-shrink: 0; }
.birthday-card .bc-name { font-weight: 700; font-size: .9rem; }
.birthday-card .bc-date { font-size: .8rem; color: var(--text-muted); }
.birthday-card .bc-age { font-size: .72rem; background: var(--orange-light); color: var(--orange); padding: .1rem .45rem; border-radius: 999px; font-weight: 600; margin-top: .2rem; display: inline-block; }

/* ─── LANÇAMENTOS ─── */
.lancamento-valor.entrada { color: var(--green); font-weight: 700; }
.lancamento-valor.saida { color: var(--red); font-weight: 700; }

/* ─── REPORTS ─── */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; }
.report-card { background: var(--card-bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); cursor: pointer; transition: all .15s; text-align: center; }
.report-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.report-card i { font-size: 2rem; color: var(--primary); margin-bottom: .75rem; }
.report-card h4 { font-weight: 700; margin-bottom: .4rem; }
.report-card p { font-size: .8rem; color: var(--text-muted); }

/* ─── COMUNICAÇÃO ─── */
.comm-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.comm-form { display: flex; flex-direction: column; gap: .75rem; }
.comm-form label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.comm-form input, .comm-form select, .comm-form textarea { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .75rem; font-size: .85rem; font-family: inherit; outline: none; width: 100%; }
.comm-form input:focus, .comm-form select:focus, .comm-form textarea:focus { border-color: var(--primary); }
.comm-history { display: flex; flex-direction: column; gap: .5rem; }
.comm-hist-item { padding: .65rem; border-radius: var(--radius-sm); border: 1px solid var(--border); font-size: .82rem; }
.comm-hist-item .ch-title { font-weight: 600; }
.comm-hist-item .ch-meta { color: var(--text-muted); font-size: .72rem; margin-top: .2rem; }

/* ─── CONFIGURAÇÕES ─── */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
.settings-grid .card:first-child { grid-column: 1 / -1; }
.settings-form { display: flex; flex-direction: column; gap: .75rem; }
.form-group { display: flex; flex-direction: column; gap: .3rem; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: .78rem; font-weight: 600; color: var(--text-muted); }
.form-group input, .form-group select, .form-group textarea { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: .55rem .75rem; font-size: .85rem; font-family: inherit; outline: none; }
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--primary); }
.settings-grid .card h3 { font-size: .95rem; font-weight: 700; margin-bottom: 1rem; }
.permissions-list { display: flex; flex-direction: column; gap: .65rem; }
.perm-item { display: flex; align-items: center; justify-content: space-between; padding: .65rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.perm-item strong { font-size: .85rem; }
.perm-item p { font-size: .75rem; color: var(--text-muted); }
.backup-options { display: flex; flex-direction: column; gap: .75rem; }
.backup-item { display: flex; align-items: center; gap: .75rem; padding: .75rem; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.backup-item > i { font-size: 1.2rem; color: var(--primary); }
.backup-item > div { flex: 1; }
.backup-item strong { font-size: .85rem; }
.backup-item p { font-size: .75rem; color: var(--text-muted); }
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: var(--border); border-radius: 999px; cursor: pointer; transition: .2s; }
.toggle span::before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + span { background: var(--primary); }
.toggle input:checked + span::before { transform: translateX(18px); }

/* ─── MODAL ─── */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 200; display: none; }
.modal-overlay.active { display: block; }
.modal { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(.95); background: var(--card-bg); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.2); z-index: 201; width: 90%; max-width: 600px; max-height: 90vh; overflow-y: auto; display: none; opacity: 0; transition: all .2s; }
.modal.active { display: block; opacity: 1; transform: translate(-50%, -50%) scale(1); }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--card-bg); z-index: 1; }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-header button { background: none; border: none; color: var(--text-muted); cursor: pointer; font-size: 1.1rem; }
.modal-body { padding: 1.5rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.modal-footer { padding: 1rem 1.5rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: .75rem; }

/* ─── TOAST ─── */
.toast { position: fixed; bottom: 1.5rem; right: 1.5rem; background: #1E293B; color: #fff; padding: .8rem 1.25rem; border-radius: var(--radius-sm); font-size: .85rem; font-weight: 500; z-index: 300; transform: translateY(100px); opacity: 0; transition: all .25s; box-shadow: var(--shadow-md); }
.toast.show { transform: none; opacity: 1; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ─── RESPONSIVE ─── */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .comm-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-grid .card:first-child { grid-column: auto; }
}

/* ─── MOBILE (≤768px) ─── */
@media (max-width: 768px) {
  /* Sidebar vira drawer deslizante */
  .sidebar {
    width: var(--sidebar-w) !important;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 300;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  /* Overlay escuro ao abrir sidebar */
  .sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 299;
  }
  .sidebar-overlay.active { display: block; }

  /* Textos da sidebar sempre visíveis no mobile */
  .sidebar .logo-text,
  .sidebar .nav-label,
  .sidebar .nav-item span,
  .sidebar .user-name,
  .sidebar .user-role { display: block !important; }
  .sidebar .nav-item { justify-content: flex-start !important; padding: .65rem 1rem !important; }
  .sidebar .badge { display: inline-block !important; }

  /* Main ocupa tela toda */
  .main-content { margin-left: 0 !important; width: 100vw !important; max-width: 100vw !important; min-width: 0 !important; overflow-x: hidden; flex-shrink: 1; }

  /* Topbar */
  .topbar { width: 100%; box-sizing: border-box; }
  .search-box { display: none; }
  .page-title { font-size: .95rem; }

  /* Gráficos não ultrapassam a tela */
  canvas { max-width: 100% !important; }
  .card { overflow: hidden; }

  /* KPIs em 2 colunas */
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: .6rem; width: 100%; }
  .kpi-card { padding: .85rem .75rem; gap: .6rem; min-width: 0; overflow: hidden; }
  .kpi-value { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kpi-info { min-width: 0; flex: 1; overflow: hidden; }
  .kpi-icon { width: 40px; height: 40px; font-size: 1rem; flex-shrink: 0; }

  /* Dashboard em coluna única */
  .dashboard-grid { grid-template-columns: 1fr; gap: .85rem; }
  .tesouraria-grid { grid-template-columns: 1fr; gap: .85rem; }

  /* Página */
  .page-content { padding: 1rem .85rem; }
  .page-header { flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }
  .page-header h2 { font-size: 1.1rem; }
  .header-actions { flex-wrap: wrap; gap: .4rem; }
  .welcome-bar { flex-wrap: wrap; gap: .6rem; margin-bottom: 1rem; }

  /* Formulários em coluna única */
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .form-group.full { grid-column: auto; }

  /* Tabelas viram cards no mobile */
  .card { padding: .5rem 0; }
  .data-table { min-width: unset; width: 100%; }
  .data-table thead { display: none; }
  .data-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    align-items: start;
    padding: .85rem 1rem;
    border-bottom: 1px solid var(--border);
    gap: .4rem .5rem;
    background: #fff;
  }
  .data-table tbody tr:last-child { border-bottom: none; }
  .data-table tbody tr:hover { background: var(--bg); }
  .data-table tbody tr:hover td { background: transparent; }
  .data-table td {
    display: none;
    border: none;
    padding: 0;
    font-size: .83rem;
    background: transparent;
  }
  /* col-main: linha 1 coluna 1 — nome/avatar */
  .data-table td.col-main {
    display: block;
    grid-column: 1;
    grid-row: 1;
  }
  /* col-pills-wrap: linha 2 coluna 1 — pílulas */
  .data-table td.col-pill {
    display: inline-block;
    font-size: .72rem;
    color: var(--text-muted);
    background: var(--bg);
    border: 1px solid var(--border);
    padding: .15rem .5rem;
    border-radius: 999px;
    line-height: 1.5;
    grid-column: 1;
    grid-row: 2;
  }
  /* Agrupa todas as pills na linha 2 */
  .data-table tr { position: relative; }
  .data-table td.col-pill ~ td.col-pill { margin-left: .25rem; }

  /* col-actions: coluna 2, abrange as 2 linhas */
  .data-table td.col-actions {
    display: flex;
    grid-column: 2;
    grid-row: 1 / 3;
    align-items: center;
    justify-content: flex-end;
  }
  /* col-hide: esconde */
  .data-table td.col-hide { display: none; }
  .data-table th.col-hide { display: none; }

  /* Tabela membros: esconde telefone, departamento e status no mobile */
  .data-table td.col-mobile-hide,
  .data-table th.col-mobile-hide { display: none; }

  /* Mostra tipo e status como pills abaixo do nome */
  .data-table td.col-tipo,
  .data-table td.col-status {
    display: inline-flex;
    grid-column: 1;
    grid-row: 2;
    font-size: .72rem;
    padding: 0;
    margin-right: .25rem;
  }

  .col-actions .action-btns { flex-direction: row; gap: .3rem; flex-wrap: wrap; justify-content: flex-end; }
  /* Member cell no mobile */
  .member-cell { gap: .5rem; }
  .member-cell .b-avatar { width: 36px; height: 36px; font-size: .72rem; }

  /* Modal ocupa tela toda */
  .modal {
    width: 100% !important;
    max-width: 100% !important;
    max-height: 100vh !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
    border-radius: var(--radius) var(--radius) 0 0 !important;
  }
  .modal.active { transform: none !important; }

  /* Outros grids */
  .turmas-grid { grid-template-columns: 1fr; }
  .chamada-grid { grid-template-columns: 1fr 1fr; }
  .prayer-grid { grid-template-columns: 1fr; }
  .dept-grid { grid-template-columns: 1fr; }
  .birthday-grid { grid-template-columns: 1fr; }
  .fin-summary { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .comm-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .filters-bar { flex-direction: column; }

  /* Toast no topo no mobile */
  .toast { bottom: auto; top: 1rem; right: 1rem; left: 1rem; text-align: center; }

  /* Tabs */
  .tabs { width: 100%; }
  .tab { flex: 1; text-align: center; font-size: .78rem; }
}

@media (max-width: 400px) {
  .kpi-grid { grid-template-columns: 1fr; }
  .chamada-grid { grid-template-columns: 1fr; }
  .report-grid { grid-template-columns: 1fr; }
}

/* ─── ESCOLA BÍBLICA ─── */
.turmas-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.turma-card { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 1.25rem; transition: transform .15s, box-shadow .15s; }
.turma-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.turma-card-new { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; color: var(--text-muted); border: 2px dashed var(--border); text-decoration: none; min-height: 160px; }
.turma-card-new:hover { color: var(--primary); border-color: var(--primary); }
.turma-card-new i { font-size: 2rem; }
.turma-card-header { display: flex; align-items: center; gap: .75rem; margin-bottom: .75rem; }
.turma-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.turma-nome { font-weight: 700; font-size: .95rem; }
.turma-faixa { font-size: .75rem; color: var(--text-muted); }
.turma-info-row { font-size: .78rem; color: var(--text-secondary); display: flex; align-items: center; gap: .4rem; margin-bottom: .3rem; }
.turma-stats { display: flex; gap: 1rem; margin: .75rem 0; padding: .75rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.turma-stat { text-align: center; flex: 1; }
.turma-stat strong { display: block; font-size: 1.1rem; font-weight: 700; }
.turma-stat span { font-size: .72rem; color: var(--text-muted); }
.progress-bar-wrap { height: 6px; background: var(--border); border-radius: 999px; margin: .5rem 0; overflow: hidden; }
.progress-bar { height: 100%; border-radius: 999px; transition: width .4s ease; }
.turma-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .75rem; }
.btn-sm { padding: .3rem .65rem; font-size: .75rem; font-weight: 600; border-radius: 6px; background: var(--bg); border: 1px solid var(--border); color: var(--text); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: .3rem; transition: background .12s; }
.btn-sm:hover { background: var(--border); }
.icon-picker { display: flex; flex-wrap: wrap; gap: .5rem; }
.icon-opt { width: 40px; height: 40px; border-radius: 8px; border: 2px solid var(--border); display: flex; align-items: center; justify-content: center; font-size: 1rem; cursor: pointer; transition: all .12s; color: var(--text-muted); }
.icon-opt:hover, .icon-opt.selected { border-color: var(--primary); color: var(--primary); background: #EEF2FF; }

/* Chamada */
.chamada-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .75rem; }
.chamada-card { background: var(--card-bg); border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem; display: flex; align-items: center; gap: .75rem; transition: all .12s; user-select: none; }
.chamada-card:hover { border-color: #CBD5E1; }
.chamada-card.presente { border-color: #10B981; background: #F0FDF4; }
.chamada-card.ausente  { border-color: #EF4444; background: #FEF2F2; }
.chamada-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #fff; flex-shrink: 0; }
.chamada-info { flex: 1; min-width: 0; }
.chamada-nome { font-weight: 600; font-size: .85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chamada-detalhe { font-size: .72rem; color: var(--text-muted); }
.chamada-status { flex-shrink: 0; }
