.church-dashboard-module {
  width: min(1760px, calc(100vw - 2rem));
  min-height: calc(100vh - 7rem);
  margin: .8rem auto 2rem;
  padding: clamp(.8rem, 1.6vw, 1.5rem);
  border: 1px solid var(--ui-border, rgba(231, 240, 236, .1));
  border-radius: 28px;
  color: var(--ui-text, #f2f6f3);
  background: radial-gradient(circle at 12% -10%, color-mix(in srgb, var(--ui-accent, #9fba45) 9%, transparent), transparent 34rem), rgba(12, 19, 27, .96);
  box-shadow: 0 26px 70px rgba(0, 0, 0, .28);
}

.church-dashboard-module.hide { display: none !important; }

.church-dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.2rem;
  padding: .25rem .2rem;
}

.church-dashboard-eyebrow,
.church-dashboard-card-heading span {
  margin: 0 0 .28rem;
  color: var(--ui-accent-strong, #b9d469);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.church-dashboard-header h1 { font-size: clamp(1.75rem, 3vw, 2.55rem); line-height: 1.08; }
.church-dashboard-header p:last-child { margin: .42rem 0 0; color: var(--ui-muted, #8d9993); }

.church-dashboard-header-actions {
  display: flex;
  align-items: center;
  gap: .85rem;
  color: var(--ui-muted, #8d9993);
  font-size: .78rem;
}

.church-dashboard-header-actions .btn { display: inline-flex; align-items: center; gap: .45rem; }
.church-dashboard-header-actions svg,
.church-kpi-icon svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.church-dashboard-message {
  display: none;
  margin: 0 0 1rem;
  padding: .85rem 1rem;
  border: 1px solid var(--ui-border-strong, rgba(255, 255, 255, .15));
  border-radius: 14px;
  color: var(--ui-text-soft, #c5cec9);
  background: var(--ui-surface, #121b24);
}

.church-dashboard-message:not(:empty) { display: block; }
.church-dashboard-message.error { color: #ffaaa2; border-color: rgba(240, 120, 109, .35); background: rgba(240, 120, 109, .08); }

.church-dashboard-primary,
.church-dashboard-middle {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(330px, .85fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.church-dashboard-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }

.church-kpi-card,
.church-dashboard-card {
  min-width: 0;
  border: 1px solid var(--ui-border, rgba(231, 240, 236, .1));
  border-radius: 22px;
  background: color-mix(in srgb, var(--ui-surface, #121b24) 90%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .018);
}

.church-kpi-card {
  min-height: 178px;
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform .18s ease, border-color .18s ease, background-color .18s ease;
}

.church-kpi-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--ui-accent, #9fba45) 30%, var(--ui-border));
  background: color-mix(in srgb, var(--ui-surface-raised, #17212b) 92%, transparent);
}

.church-kpi-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  color: var(--ui-muted, #8d9993);
  font-size: .92rem;
}

.church-kpi-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  color: var(--ui-accent-strong, #b9d469);
  background: var(--ui-accent-soft, rgba(159, 186, 69, .15));
}

.church-kpi-card > strong {
  display: block;
  margin: .35rem 0 .15rem;
  color: var(--ui-text, #f2f6f3);
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 3.2vw, 3rem);
  letter-spacing: -.055em;
  line-height: 1;
}

.church-kpi-card small,
.church-dashboard-card-heading small,
.church-health-grid small,
.church-alerts-grid small { color: var(--ui-muted, #8d9993); }
.church-kpi-card small.positive { color: var(--ui-success, #61c79c); }
.church-kpi-card small.negative { color: var(--ui-danger, #f0786d); }

.church-dashboard-card { padding: 1.25rem; }
.church-dashboard-card-heading {
  min-height: 44px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: .9rem;
}

.church-dashboard-card-heading h2 { font-size: 1.08rem; line-height: 1.25; }
.church-dashboard-card-heading > strong { color: var(--ui-accent-strong, #b9d469); font-family: "Space Grotesk", sans-serif; font-size: 1.45rem; }

.church-dashboard-link {
  min-height: 34px;
  padding: .35rem .55rem;
  border: 0;
  border-radius: 9px;
  color: var(--ui-accent-strong, #b9d469);
  background: transparent;
  font: inherit;
  font-size: .76rem;
  font-weight: 700;
  cursor: pointer;
}

.church-dashboard-link:hover { background: var(--ui-accent-soft, rgba(159, 186, 69, .15)); }
.church-dashboard-list { display: grid; }

.church-dashboard-list-item {
  min-width: 0;
  padding: .82rem 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  border-top: 1px solid var(--ui-border, rgba(231, 240, 236, .1));
}

.church-dashboard-list-item:first-child { border-top: 0; }
.church-dashboard-list-item strong { display: block; overflow: hidden; font-size: .9rem; text-overflow: ellipsis; white-space: nowrap; }
.church-dashboard-list-item small { display: block; margin-top: .25rem; color: var(--ui-muted, #8d9993); font-size: .75rem; }
.church-dashboard-list-item b { color: var(--ui-text-soft, #c5cec9); font-size: .86rem; white-space: nowrap; }
.church-dashboard-list-item time { color: var(--ui-accent-strong, #b9d469); font-size: .78rem; font-weight: 700; white-space: nowrap; }

.church-dashboard-empty { margin: 0; padding: 1.5rem .4rem; color: var(--ui-muted, #8d9993); font-size: .84rem; text-align: center; }
.church-dashboard-empty.hide { display: none; }
.church-recent-income-card { min-height: 372px; }
.church-upcoming-card { min-height: 320px; }
.church-attendance-card { min-height: 320px; }
.church-dashboard-chart-wrap { position: relative; height: 220px; }
.church-health-card,
.church-alerts-card { margin-bottom: 1rem; }

.church-health-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .7rem; }
.church-health-grid article {
  min-width: 0;
  padding: 1rem;
  display: grid;
  gap: .32rem;
  border: 1px solid var(--ui-border, rgba(231, 240, 236, .1));
  border-radius: 15px;
  background: var(--ui-surface-raised, #17212b);
}

.church-health-grid span { color: var(--ui-muted, #8d9993); font-size: .76rem; }
.church-health-grid strong { overflow: hidden; color: var(--ui-text, #f2f6f3); font-family: "Space Grotesk", sans-serif; font-size: 1.35rem; text-overflow: ellipsis; white-space: nowrap; }
.church-health-grid small { overflow: hidden; font-size: .72rem; text-overflow: ellipsis; white-space: nowrap; }

.church-alerts-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem; }
.church-alerts-grid article {
  min-width: 0;
  padding: .95rem 1rem;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: .8rem;
  border: 1px solid var(--ui-border, rgba(231, 240, 236, .1));
  border-radius: 15px;
  background: var(--ui-surface-raised, #17212b);
}

.church-alerts-grid strong,
.church-alerts-grid small { display: block; }
.church-alerts-grid strong { font-size: .88rem; }
.church-alerts-grid small { margin-top: .2rem; font-size: .74rem; }
.church-alerts-grid b { color: var(--ui-text-soft, #c5cec9); font-size: .88rem; white-space: nowrap; }
.church-alert-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 5px rgba(255, 255, 255, .04); }
.church-alert-dot.danger { background: var(--ui-danger, #f0786d); }
.church-alert-dot.warning { background: var(--ui-warning, #e7b75e); }

.church-dashboard-module [data-module].module-unavailable { opacity: .48; }
.church-dashboard-module [data-module].module-unavailable strong { color: var(--ui-muted, #8d9993); }

.church-dashboard-module.is-loading .church-kpi-card > strong,
.church-dashboard-module.is-loading .church-health-grid strong {
  width: 55%;
  min-height: 1em;
  border-radius: 8px;
  color: transparent;
  background: linear-gradient(90deg, var(--ui-surface-soft, #1b2631), var(--ui-surface-raised, #17212b), var(--ui-surface-soft, #1b2631));
  background-size: 200% 100%;
  animation: church-dashboard-shimmer 1.3s linear infinite;
}

@keyframes church-dashboard-shimmer { to { background-position: -200% 0; } }

@media (max-width: 1100px) {
  .church-dashboard-primary,
  .church-dashboard-middle { grid-template-columns: 1fr; }
  .church-health-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .church-recent-income-card { min-height: 0; }
}

@media (max-width: 720px) {
  .church-dashboard-module { width: calc(100vw - 1rem); min-height: 0; margin: .5rem auto 1rem; padding: .65rem; border-radius: 20px; }
  .church-dashboard-header { align-items: stretch; flex-direction: column; padding: .65rem .45rem .35rem; }
  .church-dashboard-header h1 { font-size: 1.75rem; }
  .church-dashboard-header-actions { justify-content: space-between; }
  .church-dashboard-header-actions .btn { width: auto; min-height: 40px; }
  .church-dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .church-dashboard-primary,
  .church-dashboard-middle { gap: .65rem; margin-bottom: .65rem; }
  .church-kpi-card { min-height: 142px; padding: .9rem; border-radius: 17px; }
  .church-kpi-topline { align-items: flex-start; font-size: .75rem; }
  .church-kpi-icon { width: 32px; height: 32px; flex-basis: 32px; border-radius: 10px; }
  .church-kpi-icon svg { width: 16px; height: 16px; }
  .church-kpi-card > strong { font-size: clamp(1.55rem, 8vw, 2.2rem); }
  .church-kpi-card small { font-size: .68rem; line-height: 1.35; }
  .church-dashboard-card { padding: 1rem; border-radius: 17px; }
  .church-dashboard-card-heading { min-height: 0; }
  .church-dashboard-card-heading h2 { font-size: 1rem; }
  .church-dashboard-chart-wrap { height: 190px; }
  .church-health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
  .church-health-grid article { padding: .8rem; }
  .church-health-grid strong { font-size: 1.08rem; }
  .church-alerts-grid { grid-template-columns: 1fr; }
  .church-dashboard-list-item { padding-block: .75rem; }
}

@media (max-width: 390px) {
  .church-dashboard-kpis,
  .church-health-grid { grid-template-columns: 1fr; }
  .church-kpi-card { min-height: 132px; }
}

@media (prefers-reduced-motion: reduce) {
  .church-kpi-card { transition: none; }
  .church-dashboard-module.is-loading .church-kpi-card > strong,
  .church-dashboard-module.is-loading .church-health-grid strong { animation: none; }
}
