:root {
  --bg: #f4f1ea;
  --bg-2: #e7f0f1;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #51606b;
  --primary: #0f766e;
  --primary-strong: #0b4f4a;
  --accent: #f59e0b;
  --danger: #dc2626;
  --border: #d8e1e8;
  --shadow: rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", "Noto Sans", sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background-image:
    radial-gradient(1200px 420px at 8% -10%, #d8efe8 0%, transparent 60%),
    radial-gradient(900px 520px at 90% 0%, #f7e8d1 0%, transparent 55%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.96));
  background-attachment: fixed;
}

img,
video {
  max-width: 100%;
  height: auto;
}

.page-tree,
.page-tree-v2 {
  height: 100vh;
  overflow: hidden;
}

.page-tree .app-shell,
.page-tree .app-main,
.page-tree-v2 .app-shell,
.page-tree-v2 .app-main {
  height: 100%;
  overflow: hidden;
}

.page-tree .container,
.page-tree-v2 .container {
  height: 100%;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-discipleship-groups-list,
.page-discipleship-people-list,
.page-discipleship-table-scroll {
  height: 100vh;
  overflow: hidden;
}

.page-member-table-scroll {
  height: 100vh;
  overflow: hidden;
}

.page-member-families-scroll {
  height: 100vh;
  overflow: hidden;
}

.page-discipleship-groups-list .app-shell,
.page-discipleship-people-list .app-shell,
.page-discipleship-table-scroll .app-shell,
.page-discipleship-groups-list .app-main,
.page-discipleship-people-list .app-main,
.page-discipleship-table-scroll .app-main {
  height: 100%;
  overflow: hidden;
}

.page-member-table-scroll .app-shell,
.page-member-table-scroll .app-main {
  height: 100%;
  overflow: hidden;
}

.page-member-families-scroll .app-shell,
.page-member-families-scroll .app-main {
  height: 100%;
  overflow: hidden;
}

.page-discipleship-groups-list .container,
.page-discipleship-people-list .container,
.page-discipleship-table-scroll .container {
  height: 100%;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-member-table-scroll .container {
  height: 100%;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-member-families-scroll .container {
  height: 100%;
  margin: 0 auto;
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-discipleship-groups-list .container > h1,
.page-discipleship-people-list .container > h1 {
  margin: 0;
}

.discipleship-page-head {
  margin-bottom: 8px;
}

.discipleship-page-head h1 {
  margin: 0;
}

.page-discipleship-groups-list .discipleship-list-card,
.page-discipleship-people-list .discipleship-list-card {
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-discipleship-groups-list .discipleship-list-card .table-wrap,
.page-discipleship-people-list .discipleship-list-card .table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
  position: relative;
}

.page-discipleship-table-scroll .table-card-plain {
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-discipleship-table-scroll .table-card-plain .table-wrap {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.page-discipleship-groups-list .discipleship-list-card .table thead th,
.page-discipleship-people-list .discipleship-list-card .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f8fafc;
  box-shadow: inset 0 -1px 0 var(--border);
}

.page-discipleship-table-scroll .table-card-plain .table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.page-discipleship-groups-list .discipleship-list-card .dg-recap-pagination-row,
.page-discipleship-people-list .discipleship-list-card .dg-recap-pagination-row {
  margin-top: 10px;
}

.page-member-table-scroll .members-main-table {
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-member-table-scroll .member-completeness-main-table {
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-member-table-scroll .members-main-table .table-wrap {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}

.page-member-table-scroll .member-completeness-main-table .table-wrap {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}

.page-member-table-scroll .members-main-table .table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.page-member-table-scroll .member-completeness-main-table .table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.page-member-families-scroll .member-families-main-table {
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-member-families-scroll .member-families-main-table .table-wrap {
  flex: 1;
  min-height: 0;
  height: auto;
  max-height: none;
  overflow: auto;
}

.page-member-families-scroll .member-families-main-table .table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.page-member-table-scroll .member-left-archive {
  margin-bottom: 0;
}

.page-member-table-scroll .member-left-archive .member-left-archive-wrap {
  height: 340px;
  max-height: 340px;
  overflow: auto;
}

.page-member-table-scroll .member-left-archive .member-left-archive-wrap .table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
}

h1,
h2,
h3 {
  font-family: "Fraunces", serif;
  letter-spacing: 0.2px;
}

h1 {
  margin: 8px 0 20px;
  font-size: 28px;
}

h2 {
  margin: 0 0 8px;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar-toggle {
  display: none;
}

.sidebar-backdrop {
  display: none;
}

.sidebar {
  width: 240px;
  background: linear-gradient(180deg, #0b1220, #111c2f);
  color: #e2e8f0;
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.sidebar::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sidebar-brand .brand {
  font-family: "Fraunces", serif;
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
}

.brand-sub {
  font-size: 12px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: rgba(226, 232, 240, 0.6);
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-label {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 11px;
  color: rgba(226, 232, 240, 0.6);
}

.sidebar-nav,
.sidebar-subnav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-group summary {
  list-style: none;
  cursor: pointer;
}

.nav-group summary::-webkit-details-marker {
  display: none;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-decoration: none;
  color: #e2e8f0;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.04);
  font-weight: 600;
  gap: 8px;
}

button.nav-item {
  width: 100%;
  border: none;
  background: rgba(255, 255, 255, 0.04);
  cursor: pointer;
  text-align: left;
  font: inherit;
}

.nav-item.active {
  background: linear-gradient(135deg, #f59e0b, #fbbf24);
  color: #111827;
}

.nav-item.disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.nav-item .badge {
  font-size: 10px;
  padding: 3px 6px;
}

.chevron {
  font-size: 11px;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.nav-group[open] .chevron {
  transform: rotate(180deg);
}

.nav-sub {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-left: 10px;
  padding-left: 8px;
  border-left: 1px dashed rgba(255, 255, 255, 0.12);
}

.nav-sub .nav-item {
  background: rgba(255, 255, 255, 0.02);
  font-weight: 500;
}

.nav-sub .nav-item.active {
  background: rgba(255, 255, 255, 0.06);
  color: #fbbf24;
}

.page-login .container {
  max-width: 420px;
  margin: 80px auto;
}

.page-public-links .container {
  max-width: 560px;
  margin: 56px auto;
}

.page-file-preview-standalone {
  background: #111827;
}

.page-file-preview-standalone .container {
  max-width: none;
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100vh;
}

.page-file-preview-standalone .file-page-embed {
  display: block;
  width: 100%;
  height: 100vh;
  border: 0;
  background: #111827;
}

.page-public-links {
  background-color: #0b1220;
  background-image:
    linear-gradient(160deg, rgba(7, 13, 23, 0.72), rgba(7, 13, 23, 0.58)),
    linear-gradient(0deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08)),
    url("public-bg-rec-kutisari.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  background-attachment: fixed;
}

.public-links-card {
  padding: 24px;
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow: 0 18px 34px rgba(2, 8, 23, 0.3);
  backdrop-filter: blur(4px);
}

.public-links-head {
  text-align: center;
  margin-bottom: 16px;
}

.public-links-logo {
  margin-bottom: 10px;
}

.public-links-logo img {
  width: 84px;
  height: auto;
  display: inline-block;
}

.public-links-title {
  font-family: "Fraunces", serif;
  font-size: 30px;
  font-weight: 700;
  line-height: 1.2;
}

.public-links-sub {
  margin-top: 6px;
  color: var(--muted);
  font-size: 14px;
}

.public-links-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.public-link-list {
  display: grid;
  gap: 10px;
}

.public-link-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  text-decoration: none;
  color: var(--text);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.public-link-preview {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  background: #f0fdfa;
  color: #0f766e;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 40px;
}

.public-link-preview svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.public-link-content {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.public-link-item:hover {
  transform: translateY(-1px);
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 14px 22px rgba(15, 23, 42, 0.12);
}

.public-link-item-title {
  font-weight: 700;
}

.public-link-item-desc {
  font-size: 13px;
  color: var(--muted);
}

.page-dg-public .container {
  max-width: 1080px;
}

.public-branch-select-card {
  padding: 24px;
}

.public-branch-head {
  margin-bottom: 18px;
}

.public-branch-title-row {
  margin-bottom: 10px;
  align-items: flex-start;
}

.public-branch-title-wrap {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.public-branch-title-wrap h2 {
  margin: 0;
}

.public-branch-subtitle {
  margin: 0;
  max-width: 64ch;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.public-branch-meta {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.public-branch-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  background: rgba(15, 118, 110, 0.08);
  color: #0f766e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.25px;
}

.public-branch-divider {
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: rgba(71, 85, 105, 0.5);
  flex: 0 0 5px;
}

.public-branch-guide {
  color: #475569;
  font-size: 13px;
  font-weight: 600;
}

.public-branch-fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.public-branch-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 15px;
}

.public-branch-link-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  text-align: left;
  gap: 8px;
  min-height: 142px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #ffffff;
  padding: 18px 17px;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease, background-color 0.14s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  overflow: hidden;
}

.public-branch-link-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #0f766e, #14b8a6);
  opacity: 0.86;
}

.public-branch-card-eyebrow {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #0f766e;
  font-weight: 700;
}

.public-branch-link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.12);
}

.public-branch-card-title {
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1.12;
  font-weight: 700;
  color: var(--text);
}

.public-branch-card-cta {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0f766e;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.public-branch-card-cta svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.14s ease;
}

.public-branch-link-card:hover .public-branch-card-cta svg {
  transform: translateX(1px);
}

.public-branch-link-card:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.36);
  outline-offset: 1px;
}

.public-branch-actions {
  margin-top: 22px;
  justify-content: flex-end;
}

@media (max-width: 980px) {
  .public-branch-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .public-branch-select-card {
    padding: 18px;
  }

  .public-branch-subtitle {
    font-size: 13px;
  }

  .public-branch-divider {
    display: none;
  }

  .public-branch-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .public-branch-link-card {
    min-height: 124px;
    padding: 16px 15px;
  }
}

.public-social-wrap {
  margin-top: 12px;
  text-align: center;
}

.public-social-label {
  margin-bottom: 4px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
}

.public-social-row {
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
}

.public-social-link {
  display: inline-flex;
  align-items: center;
  min-height: 0;
  padding: 0;
  border-radius: 0;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.9);
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.1px;
  transition: color 0.14s ease, opacity 0.14s ease, text-decoration-color 0.14s ease;
  line-height: 1.2;
  opacity: 0.92;
}

.public-social-link:hover {
  color: #ffffff;
  opacity: 1;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(255, 255, 255, 0.8);
}

.public-social-link.is-instagram {
  border: 0;
  background: transparent;
}

.public-social-link.is-youtube {
  border: 0;
  background: transparent;
}

.public-social-sep {
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.5);
  display: inline-block;
  flex: 0 0 4px;
}

.public-login-fab {
  position: fixed;
  right: calc(18px + env(safe-area-inset-right));
  bottom: calc(18px + env(safe-area-inset-bottom));
  width: 54px;
  height: 54px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.35);
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #ffffff;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
  z-index: 30;
  transition: transform 0.14s ease, box-shadow 0.14s ease;
}

.public-login-fab-icon {
  width: 22px;
  height: 22px;
  display: inline-flex;
}

.public-login-fab-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.public-login-fab:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.3);
}

.login-card {
  padding: 24px;
}

.login-head {
  margin-bottom: 12px;
}

.login-title {
  font-family: "Fraunces", serif;
  font-size: 24px;
  font-weight: 700;
}

.login-sub {
  color: var(--muted);
  font-size: 14px;
}

.login-form {
  grid-template-columns: 1fr;
}

.app-main {
  flex: 1;
  min-width: 0;
}

.topbar {
  background: linear-gradient(120deg, #0b1220, #111c2f);
  color: #f8fafc;
  padding: 16px 24px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  font-family: "Fraunces", serif;
  font-size: 18px;
  font-weight: 700;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  color: #e2e8f0;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 500;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.container {
  max-width: 1200px;
  margin: 32px auto 64px;
  padding: 0 28px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 14px 30px var(--shadow);
}

.card.table-card-plain {
  --plain-table-border: rgba(148, 163, 184, 0.42);
  --plain-table-head-bg: linear-gradient(180deg, rgba(241, 245, 249, 0.95), rgba(226, 232, 240, 0.86));
  --plain-table-row-odd: rgba(255, 255, 255, 0.22);
  --plain-table-row-even: rgba(255, 255, 255, 0.12);
  --plain-table-row-hover: rgba(15, 118, 110, 0.14);
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  padding: 0;
}

.card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stats.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 12px 0 6px;
}

.stat {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.stats.compact .stat {
  min-height: 128px;
  padding: 16px 14px;
}

.stat-label {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  margin-top: 4px;
}

.stat-sub {
  margin-top: 4px;
  font-size: 11px;
  color: var(--muted);
}

.stats .stat {
  --stat-accent: #0f766e;
  --stat-glow: rgba(15, 118, 110, 0.14);
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
  align-items: start;
  text-align: center;
  gap: 6px;
  min-height: 146px;
  padding: 18px 16px;
  border: 1px solid #d7e0ea;
  border-radius: 16px;
  background: linear-gradient(160deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.stats .stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 28px rgba(15, 23, 42, 0.11);
}

.stats .stat::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--stat-accent), #ffffff);
}

.stats .stat::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  right: -58px;
  top: -74px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--stat-glow) 0%, rgba(255, 255, 255, 0) 72%);
  pointer-events: none;
}

.stats .stat:nth-child(1) {
  --stat-accent: #0284c7;
  --stat-glow: rgba(2, 132, 199, 0.18);
}

.stats .stat:nth-child(2) {
  --stat-accent: #0f766e;
  --stat-glow: rgba(15, 118, 110, 0.16);
}

.stats .stat:nth-child(3) {
  --stat-accent: #d97706;
  --stat-glow: rgba(217, 119, 6, 0.17);
}

.stats .stat:nth-child(4) {
  --stat-accent: #16a34a;
  --stat-glow: rgba(22, 163, 74, 0.16);
}

.stats .stat:nth-child(5) {
  --stat-accent: #dc2626;
  --stat-glow: rgba(220, 38, 38, 0.14);
}

.stats .stat-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.4px;
  color: #64748b;
}

.stats .stat-value {
  align-self: center;
  margin-top: 2px;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-size: clamp(32px, 2.1vw, 42px);
  overflow-wrap: normal;
  text-wrap: balance;
  color: #0f172a;
}

.stats .stat-value.stat-value-with-target {
  display: inline-flex;
  align-items: baseline;
  justify-content: center;
  gap: 8px;
  letter-spacing: 0;
}

.stats .stat-value.stat-value-with-target .stat-current {
  font-size: 1em;
  font-weight: 800;
  color: #0f172a;
}

.stats .stat-value.stat-value-with-target .stat-divider {
  font-size: 0.72em;
  font-weight: 700;
  color: #94a3b8;
  transform: translateY(-1px);
}

.stats .stat-value.stat-value-with-target .stat-target {
  display: inline-block;
  font-size: 0.78em;
  font-weight: 700;
  line-height: 1;
  color: #64748b;
  background: rgba(148, 163, 184, 0.18);
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 999px;
  padding: 7px 12px;
  transform: translateY(-1px);
}

.stats .stat-sub.stat-sub-target {
  margin-top: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: #94a3b8;
}

.stats .stat-sub {
  align-self: end;
  margin-top: 0;
  font-size: 13px;
  color: #475569;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table-wrap {
  overflow-x: auto;
}

.inventory-master-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 20px;
  align-items: start;
}

.inventory-master-grid .card {
  margin-bottom: 0;
}

.table th,
.table td {
  border-bottom: 1px solid var(--border);
  padding: 10px 8px;
  text-align: left;
}

.table th {
  background: #f8fafc;
  font-weight: 600;
}

.table tr.row-highlight td {
  background: rgba(15, 118, 110, 0.08);
}

.card.table-card-plain .table-wrap {
  position: relative;
  max-height: min(68vh, 760px);
  overflow: auto;
  border: 1px solid var(--plain-table-border);
  border-radius: 16px;
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.46), rgba(241, 245, 249, 0.26));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.64),
    0 10px 22px rgba(15, 23, 42, 0.05);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.card.table-card-plain .table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.card.table-card-plain .table-wrap::-webkit-scrollbar-track {
  background: rgba(148, 163, 184, 0.18);
  border-radius: 999px;
}

.card.table-card-plain .table-wrap::-webkit-scrollbar-thumb {
  background: rgba(71, 85, 105, 0.55);
  border-radius: 999px;
}

.card.table-card-plain .table-wrap::-webkit-scrollbar-thumb:hover {
  background: rgba(51, 65, 85, 0.7);
}

.card.table-card-plain .table {
  border-collapse: separate;
  border-spacing: 0;
}

.card.table-card-plain .table th,
.card.table-card-plain .table td {
  padding: 11px 12px;
  border-bottom-color: rgba(148, 163, 184, 0.34);
}

.card.table-card-plain .table th {
  background: var(--plain-table-head-bg);
  color: #334155;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.card.table-card-plain .table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
}

.card.table-card-plain .table thead th:first-child {
  border-top-left-radius: 14px;
}

.card.table-card-plain .table thead th:last-child {
  border-top-right-radius: 14px;
}

.card.table-card-plain .table tbody tr:nth-child(odd) td {
  background: var(--plain-table-row-odd);
}

.card.table-card-plain .table tbody tr:nth-child(even) td {
  background: var(--plain-table-row-even);
}

.card.table-card-plain .table tbody tr:hover td {
  background: var(--plain-table-row-hover);
}

.card.table-card-plain .table tbody tr.row-highlight td {
  background: rgba(15, 118, 110, 0.18);
}

.card.table-card-plain .table tbody tr:last-child td {
  border-bottom: 0;
}

.card.table-card-plain .table tbody td:first-child {
  font-weight: 600;
  color: #0f172a;
}

.card.table-card-plain .table td.actions {
  white-space: nowrap;
}

.page-discipleship-groups-list .discipleship-list-card.table-card-plain .table thead th,
.page-discipleship-people-list .discipleship-list-card.table-card-plain .table thead th {
  background: var(--plain-table-head-bg);
  box-shadow: inset 0 -1px 0 rgba(148, 163, 184, 0.4);
}

.page-discipleship-groups-list .discipleship-list-card.table-card-plain .table-wrap,
.page-discipleship-people-list .discipleship-list-card.table-card-plain .table-wrap,
.page-discipleship-table-scroll .table-card-plain .table-wrap,
.page-member-table-scroll .members-main-table .table-wrap,
.page-member-table-scroll .member-completeness-main-table .table-wrap,
.page-member-families-scroll .member-families-main-table .table-wrap {
  max-height: none;
  height: 100%;
}

.journey-name-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.journey-name-main {
  font-weight: 600;
}

.journey-name-badges,
.journey-inline-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

#spiritual-journey-table td.actions {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
}

#spiritual-journey-table td.actions > * {
  margin-right: 0;
}

#spiritual-journey-table {
  table-layout: fixed;
}

#spiritual-journey-table .journey-col-name {
  width: 30%;
}

#spiritual-journey-table .journey-col-msk {
  width: 20%;
}

#spiritual-journey-table .journey-col-dg {
  width: 20%;
}

#spiritual-journey-table .journey-col-leader {
  width: 20%;
}

#spiritual-journey-table .journey-col-action {
  width: 10%;
}

#spiritual-journey-table th,
#spiritual-journey-table td {
  vertical-align: middle;
}

#spiritual-journey-table th:not(:first-child),
#spiritual-journey-table td:not(:first-child) {
  text-align: center;
}

#spiritual-journey-table .journey-inline-badges {
  justify-content: center;
  flex-wrap: wrap;
}

#spiritual-journey-table .journey-inline-badges .badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

#spiritual-journey-table td.actions > .btn {
  margin: 0;
}

@media (max-width: 900px) {
  #spiritual-journey-table {
    table-layout: auto;
    min-width: 760px;
  }

  #spiritual-journey-table .journey-col-name,
  #spiritual-journey-table .journey-col-msk,
  #spiritual-journey-table .journey-col-dg,
  #spiritual-journey-table .journey-col-leader,
  #spiritual-journey-table .journey-col-action {
    width: auto;
  }

  #spiritual-journey-table th,
  #spiritual-journey-table td {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  #spiritual-journey-table .journey-inline-badges {
    justify-content: flex-start;
  }

  #spiritual-journey-table td.actions {
    white-space: normal;
  }
}

.page-member-families .member-family-tools {
  align-items: center;
  gap: 8px;
}

.page-member-completeness .container {
  gap: 10px;
}

.page-member-completeness .discipleship-page-head {
  margin-bottom: 0;
}

.page-member-completeness .member-completeness-filter-form {
  gap: 8px;
}

.member-completeness-filter-select {
  width: 220px;
  min-width: 180px;
}

.member-completeness-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px;
}

.member-completeness-missing {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.page-member-families #member-families-table th {
  white-space: nowrap;
}

.member-family-note-strong {
  font-weight: 700;
  color: var(--text);
}

.member-family-divider td {
  background: #f8fafc;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
}

.member-family-row.is-linked {
  background: linear-gradient(90deg, rgba(209, 250, 229, 0.45), transparent 46%);
}

.member-family-row.is-single {
  background: linear-gradient(90deg, rgba(229, 231, 235, 0.5), transparent 46%);
}

.member-family-index {
  color: var(--muted);
  font-weight: 700;
}

.member-family-title {
  font-weight: 700;
}

.member-family-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  font-weight: 700;
}

.member-family-members,
.member-family-contacts {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.member-family-member,
.member-family-contact {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(15, 118, 110, 0.25);
  background: #f0fdfa;
  color: #0b4f4a;
  font-size: 12px;
  line-height: 1.35;
  text-decoration: none;
  font-weight: 600;
}

.member-family-contact {
  border-color: rgba(59, 130, 246, 0.28);
  background: #eff6ff;
  color: #1e3a8a;
}

a.member-family-member.note-link,
a.member-family-contact.note-link {
  text-decoration: none;
}

a.member-family-member.note-link {
  color: #0b4f4a;
}

a.member-family-contact.note-link {
  color: #1e3a8a;
}

.member-family-member:hover,
.member-family-contact:hover {
  filter: brightness(0.98);
}

a.member-family-member.note-link:hover,
a.member-family-contact.note-link:hover {
  text-decoration: none;
}

.member-family-empty {
  color: var(--muted);
}

.cash-ledger .cash-amount {
  text-align: right;
  white-space: nowrap;
}

.cash-row-opening {
  background: #f7e3c4;
}

.cash-row-in {
  background: #e8f5e3;
}

.cash-row-out {
  background: #edf4f8;
}

.note-link {
  color: var(--primary-strong);
  text-decoration: none;
  font-weight: 600;
}

.note-link:hover {
  text-decoration: underline;
}

.file-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background-color 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}

.file-cell-link {
  display: block;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  text-decoration: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.file-cell-link:hover .file-title {
  text-decoration: underline;
}

.file-cell-link:hover .file-cell {
  background: #f0fdfa;
  border-color: rgba(15, 118, 110, 0.26);
}

.file-cell-link:focus-visible {
  outline: 2px solid rgba(15, 118, 110, 0.35);
  outline-offset: 2px;
  border-radius: 8px;
}

.file-cell-link:focus-visible .file-cell {
  background: #f0fdfa;
  border-color: rgba(15, 118, 110, 0.36);
}

.file-cell-link:active .file-cell {
  background: #ccfbf1;
  border-color: rgba(13, 148, 136, 0.42);
  transform: translateY(1px);
}

.file-title {
  min-width: 0;
  word-break: break-word;
}

.file-preview {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  line-height: 1;
  background: #f8fafc;
  color: #334155;
  overflow: hidden;
}

.file-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.file-preview.is-image {
  background: #eef2ff;
  border-color: #c7d2fe;
}

.file-preview.is-pdf {
  background: #fef2f2;
  border-color: #fecaca;
  color: #b91c1c;
}

.file-preview.is-word {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.file-preview.is-sheet {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}

.file-preview.is-folder {
  background: #eff6ff;
  border-color: #bfdbfe;
  color: #1d4ed8;
}

.file-preview.is-slide {
  background: #fff7ed;
  border-color: #fed7aa;
  color: #c2410c;
}

.file-preview.is-archive {
  background: #faf5ff;
  border-color: #e9d5ff;
  color: #7e22ce;
}

.file-preview.is-text {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #475569;
}

.file-preview.is-generic {
  background: #f8fafc;
  border-color: #cbd5e1;
  color: #334155;
}

.folder-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 2px;
  margin-bottom: 10px;
}

.folder-path-heading {
  margin: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-family: "Manrope", "Noto Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.folder-path-link {
  text-decoration: none;
  color: var(--primary-strong);
}

.folder-path-link:hover {
  text-decoration: underline;
}

.folder-path-link.is-current {
  color: var(--text);
}

.folder-path-sep,
.folder-path-ellipsis {
  color: #94a3b8;
  font-size: 12px;
  font-weight: 600;
}

.folder-crumb {
  text-decoration: none;
  color: var(--primary-strong);
  font-weight: 600;
  font-size: 13px;
}

.folder-crumb.is-current {
  color: var(--text);
  pointer-events: none;
}

.folder-sep {
  color: #94a3b8;
  font-size: 12px;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  margin-top: 8px;
  margin-bottom: 12px;
}

.folder-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  background: #f8fafc;
  color: inherit;
}

.folder-item:hover {
  border-color: rgba(15, 118, 110, 0.38);
  background: #f0fdfa;
}

.folder-item-title {
  font-weight: 700;
  font-size: 14px;
  word-break: break-word;
}

.folder-item-meta {
  color: var(--muted);
  font-size: 12px;
}

.folder-create-form {
  align-items: flex-end;
}

.file-move-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  vertical-align: middle;
}

.file-folder-select {
  height: 28px;
  min-width: 140px;
  max-width: 220px;
  padding: 2px 6px;
  border: 1px solid #d1d9e2;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
}

.cash-receipt-current {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.cash-receipt-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cash-receipt-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.cash-receipt-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.member-photo-current {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.member-photo-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.member-photo-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.member-photo-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.documentation-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 14px;
  margin-top: 10px;
}

.documentation-album {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 100%;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
  transition: transform 0.16s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.documentation-album:hover {
  transform: translateY(-2px);
  border-color: #cbd5e1;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.1);
}

.documentation-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.documentation-head > div {
  min-width: 0;
}

.documentation-head .chip {
  align-self: flex-start;
  background: #eef2ff;
  border-color: #dbeafe;
  color: #1e3a8a;
}

.documentation-title {
  font-size: 16px;
  font-weight: 700;
  color: #111827;
  line-height: 1.3;
  word-break: break-word;
}

.documentation-date {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.documentation-desc {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.45;
}

.documentation-photos {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  justify-items: start;
}

.documentation-photos-all {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-items: stretch;
}

.documentation-photo {
  display: block;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  aspect-ratio: 4 / 3;
  background: #f8fafc;
  width: min(100%, 220px);
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.08);
  transition: transform 0.16s ease, box-shadow 0.2s ease;
}

.documentation-photo:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.14);
}

.documentation-photos-all .documentation-photo {
  width: 100%;
}

.documentation-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.documentation-actions {
  margin-top: auto;
  display: flex;
  gap: 8px;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding-top: 2px;
}

.documentation-actions .btn.tiny {
  border-radius: 999px;
  padding: 5px 11px;
}

.documentation-more {
  margin-top: -4px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.documentation-pagination {
  margin-top: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  justify-content: center;
}

.documentation-page-gap {
  color: var(--muted);
  padding: 0 2px;
}

.cash-filter-form {
  gap: 8px;
}

.cash-filter-form label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
}


.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.form-grid.worship-attendance-form {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 8px;
}

.form-grid label,
.form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.form-row {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

input,
select,
textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  background: #fff;
}

input:not([type="checkbox"]):not([type="radio"]),
select,
textarea {
  width: 100%;
  max-width: 100%;
}

input[type="checkbox"] {
  width: 18px;
  height: 18px;
  padding: 0;
  border-radius: 4px;
  accent-color: var(--primary);
}

.form-grid label.check-label,
.form-row label.check-label {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
}

.dg-checklist {
  margin: 0;
  padding: 14px 14px 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dg-panel {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dg-checklist legend {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  padding: 0 6px;
}

.dg-checklist label.check-label {
  font-weight: 500;
  line-height: 1.45;
  align-items: flex-start;
}

.dg-checklist label.check-label input[type="checkbox"] {
  margin-top: 2px;
  flex: 0 0 auto;
}

.dg-rating {
  margin: 0;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dg-rating legend {
  font-size: 14px;
  font-weight: 700;
  color: #111827;
  padding: 0 6px;
}

.dg-rating-hint {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dg-rating-hint span:last-child {
  text-align: right;
}

.dg-rating-scale {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 8px;
}

.dg-rating-option {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}

.dg-rating-option input[type="radio"] {
  margin: 0;
}

.dg-rating-option span {
  line-height: 1;
}

.dg-absence-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dg-absence-reason {
  margin-top: 4px;
}

.dg-question {
  font-weight: 700;
  color: #111827;
}

.dg-question select,
.dg-question input,
.dg-question textarea {
  font-weight: 400;
}

.form-grid label.dg-member-item {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 8px;
  color: var(--text);
  font-weight: 500;
  margin: 0;
}

.form-grid label.dg-member-item input[type="checkbox"] {
  margin-top: 2px;
  flex: 0 0 auto;
}

.dg-recap-table td {
  vertical-align: top;
}

.dg-recap-text {
  min-width: 180px;
  line-height: 1.45;
}

.dg-recap-subtext {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

.dg-recap-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dg-recap-photo-links {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dg-recap-category + .dg-recap-category {
  margin-top: 14px;
}

.dg-recap-category-title {
  margin: 0 0 8px;
  font-size: 16px;
  color: #111827;
}

.dg-recap-pagination-row {
  margin-top: 10px;
}

.dg-recap-pagination {
  align-items: center;
}

.dg-recap-page-current {
  font-size: 12px;
  color: var(--muted);
  padding: 4px 2px;
}

#dg-recap-report-list .dg-recap-report-tools {
  display: flex;
  flex: 0 1 auto;
  margin-left: auto;
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

#dg-recap-report-list > .card-row {
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.dg-recap-report-tools {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.dg-recap-filter {
  display: flex;
  flex: 1 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.dg-recap-filter .search {
  flex: 1 1 240px;
  width: 240px;
  min-width: 180px;
}

.dg-recap-report-search {
  flex: 0 1 240px;
  width: 240px;
  min-width: 180px;
  margin-left: auto;
}

#dg-recap-report-list .dg-recap-filter {
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
  flex-wrap: nowrap;
  align-items: center;
  gap: 10px;
  margin: 0;
}

#dg-recap-report-list .dg-recap-filter .search {
  flex: 0 1 190px;
  width: 190px;
  min-width: 160px;
}

#dg-recap-report-list .dg-recap-report-search {
  flex: 0 1 190px;
  width: 190px;
  min-width: 160px;
  margin-left: 0;
}

.dg-recap-filter .search,
.dg-recap-report-search {
  height: 40px;
  line-height: 1.2;
}

#dg-recap-report-list .dg-recap-filter .search,
#dg-recap-report-list .dg-recap-report-search {
  height: 36px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
}

.central-rekap-toolbar {
  margin: 0 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  height: auto;
  min-height: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.98)),
    radial-gradient(180px 80px at 10% 0%, rgba(245, 158, 11, 0.18), transparent 70%);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.app-page.is-central-readonly .container > .central-rekap-toolbar {
  margin: 0 0 16px;
}

.app-page.is-central-readonly .container > .central-rekap-toolbar + .card-row.discipleship-page-head {
  margin: 0 0 10px;
}

.app-page.is-central-readonly .container > .central-rekap-toolbar + h1 {
  margin: 0 0 10px;
}

.central-rekap-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.central-rekap-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.central-rekap-current {
  font-size: 13px;
  color: var(--muted);
}

.central-rekap-current strong {
  color: var(--text);
  font-weight: 700;
}

.central-rekap-quick {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.central-rekap-chip {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #334155;
  font-size: 12px;
  font-weight: 700;
}

.central-rekap-chip:hover {
  border-color: #fbbf24;
  background: #fffbeb;
  color: #92400e;
}

.central-rekap-chip.active {
  border-color: #fbbf24;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  color: #78350f;
}

.app-page.is-central-readonly .container {
  margin-top: 0;
  padding-top: 24px;
}

.app-page.is-central-readonly .container > .card-row.discipleship-page-head {
  margin-top: 0;
}

.app-page.is-central-readonly.page-discipleship-groups-list .container > .central-rekap-toolbar,
.app-page.is-central-readonly.page-discipleship-people-list .container > .central-rekap-toolbar,
.app-page.is-central-readonly.page-discipleship-table-scroll .container > .central-rekap-toolbar,
.app-page.is-central-readonly.page-member-table-scroll .container > .central-rekap-toolbar,
.app-page.is-central-readonly.page-member-families-scroll .container > .central-rekap-toolbar {
  margin-bottom: 0;
}

#discipleship-dashboard-groups .dg-recap-filter.dashboard-search-compact,
#discipleship-dashboard-people .dg-recap-filter.dashboard-search-compact {
  flex: 0 1 auto;
  align-self: flex-start;
  margin-bottom: 8px;
}

#discipleship-dashboard-groups .dg-recap-filter.dashboard-search-compact .search,
#discipleship-dashboard-people .dg-recap-filter.dashboard-search-compact .search {
  flex: 0 1 200px;
  width: 200px;
  min-width: 150px;
  height: 34px;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 13px;
}

.btn.is-disabled {
  opacity: 0.6;
  pointer-events: none;
}

textarea {
  resize: vertical;
}

.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.member-form-actions.is-right {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.msk-form-actions.is-right {
  grid-column: 1 / -1;
  justify-content: flex-end;
}

.btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  text-decoration: none;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 8px 20px rgba(15, 118, 110, 0.22);
}

.btn.secondary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #111827;
}

.btn.ghost {
  background: #eef2f7;
  color: #111827;
  box-shadow: none;
}

.btn.danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
}

.btn.tiny {
  padding: 4px 8px;
  font-size: 12px;
  box-shadow: none;
}

.btn.disabled {
  opacity: 0.55;
  cursor: not-allowed;
  pointer-events: none;
}

.actions:not(td) {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.table td.actions {
  display: table-cell;
  text-align: center;
  vertical-align: middle;
  white-space: nowrap;
  min-width: 172px;
}

.table td.actions > * {
  display: inline-block;
  vertical-align: middle;
  margin: 2px 5px 2px 0;
}

.table td.actions > .btn,
.table td.actions > .inline .btn {
  display: inline-flex;
}

.table td.actions > .inline {
  display: inline-block;
}

.table td.actions > *:last-child {
  margin-right: 0;
}

.table th.actions-head {
  text-align: center;
  white-space: nowrap;
  min-width: 172px;
}

.table th.select-head,
.table td.select-cell {
  text-align: center;
}

.table td.select-cell {
  width: 56px;
}

#church-files-table td.actions {
  display: table-cell;
  text-align: left;
  vertical-align: middle;
}

#church-files-table td.actions > * {
  display: inline-block;
  vertical-align: middle;
  margin: 2px 6px 2px 0;
}

#church-files-table td.actions > .btn,
#church-files-table td.actions > .inline .btn {
  display: inline-flex;
}

#church-files-table td.actions > .inline {
  display: inline-block;
}

#church-files-table td.actions > .file-move-form {
  display: inline-flex;
  margin: 2px 6px 2px 0;
}

#church-files-table td.actions > *:last-child {
  margin-right: 0;
}

.file-actions-menu {
  position: relative;
  display: inline-block;
}

.file-actions-menu[open] {
  z-index: 4;
}

.file-actions-menu > summary {
  list-style: none;
}

.file-actions-menu > summary::-webkit-details-marker {
  display: none;
}

.file-actions-list {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 0;
  width: max-content;
  max-width: 320px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.16);
  padding: 8px;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.file-actions-group {
  display: inline-flex;
  align-items: center;
  width: auto;
}

.file-actions-group .btn {
  display: inline-flex;
  width: auto;
  justify-content: center;
}

.file-actions-list .file-move-form {
  display: flex;
  gap: 6px;
  align-items: center;
}

.file-actions-list .file-folder-select {
  flex: 1 1 auto;
  min-width: 0;
  max-width: none;
}

.file-create-actions {
  min-width: 210px;
  width: 210px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
}

.file-create-actions .file-actions-group {
  width: 100%;
}

.file-create-actions .file-actions-group .btn {
  width: 100%;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  font-weight: 600;
  border-radius: 9px;
}

.file-row-actions {
  min-width: 210px;
  width: 210px;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  padding: 10px;
}

.file-row-actions .file-actions-group {
  width: 100%;
}

.file-row-actions .file-actions-group .btn {
  width: 100%;
  justify-content: center;
  min-height: 34px;
  padding: 7px 12px;
  font-weight: 600;
  border-radius: 9px;
}

.storage-summary-card-wrap {
  margin-bottom: 12px;
}

.storage-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.storage-summary-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.storage-summary-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.storage-summary-value {
  font-size: clamp(20px, 2.2vw, 28px);
  font-weight: 800;
  color: #0f172a;
  line-height: 1.15;
}

.storage-summary-value.is-smaller {
  font-size: clamp(17px, 1.8vw, 21px);
}

.storage-summary-sub {
  font-size: 12px;
  color: var(--muted);
}

.storage-usage-table td code {
  font-size: 12px;
  color: #1f2937;
  background: #f3f4f6;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 2px 7px;
}

.storage-share {
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.storage-share-label {
  font-size: 12px;
  color: #111827;
  font-weight: 600;
}

.storage-share-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.storage-share-fill {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5e9, #0f766e);
}

.inline {
  display: inline;
}

.search {
  width: min(100%, 240px);
  max-width: 100%;
}

.table-tools,
.msk-table-tools,
.members-table-tools,
.items-table-tools,
.worship-table-tools,
.cash-table-tools {
  align-items: center;
}

.msk-table-tools .msk-table-search {
  width: 240px;
  min-width: 180px;
}

.members-table-tools .members-table-search {
  width: 240px;
  min-width: 180px;
}

.items-table-tools .items-table-search {
  width: 240px;
  min-width: 180px;
}

.worship-table-tools .worship-table-search {
  width: 240px;
  min-width: 180px;
}

.cash-table-tools .cash-table-search {
  width: 240px;
  min-width: 180px;
}

.msk-table-tools .msk-batch-select {
  width: 200px;
  min-width: 170px;
}

@media (min-width: 721px) {
  .card-row .actions.table-tools,
  .card-row .actions.msk-table-tools,
  .card-row .actions.members-table-tools,
  .card-row .actions.items-table-tools,
  .card-row .actions.worship-table-tools,
  .card-row .actions.cash-table-tools {
    flex: 0 0 auto;
    margin-left: auto;
    min-width: 0;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: flex-end;
  }
  .card-row .actions.msk-table-tools .cash-filter-form {
    flex: 0 0 auto;
    margin-left: 0;
  }
  .card-row .actions.msk-table-tools .msk-table-search {
    flex: 0 1 240px;
    width: 240px;
    margin-left: 0;
  }
  .card-row .actions.members-table-tools .members-table-search {
    flex: 0 1 240px;
    width: 240px;
    margin-left: 0;
  }
  .card-row .actions.items-table-tools .items-table-search {
    flex: 0 1 240px;
    width: 240px;
    margin-left: 0;
  }
  .card-row .actions.worship-table-tools .worship-table-search {
    flex: 0 1 240px;
    width: 240px;
    margin-left: 0;
  }
  .card-row .actions.cash-table-tools .cash-table-search {
    flex: 0 1 240px;
    width: 240px;
    margin-left: 0;
  }
}

.multi-select {
  min-height: 160px;
}

.tree {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tree-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  margin-bottom: 0;
}

.tree-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding-right: 6px;
  padding-bottom: 12px;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.tree-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.zoom-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.04);
}

.zoom-value {
  font-size: 12px;
  color: var(--muted);
  min-width: 44px;
  text-align: center;
}

.tree-zoom {
  transform-origin: top left;
}

.drag-scroll {
  cursor: grab;
}

.drag-scroll.is-dragging {
  cursor: grabbing;
  user-select: none;
}

.tree ul {
  list-style: none;
  margin: 0;
  padding-left: 18px;
  border-left: 1px dashed var(--border);
}

.tree li {
  margin: 8px 0;
}

.tree.horizontal {
  overflow: visible;
  padding-bottom: 6px;
}

.tree.horizontal ul {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: none;
}

.tree.horizontal > ul {
  min-width: max-content;
}

.tree.horizontal .tree-row {
  --row-gap: 12px;
  display: flex;
  align-items: flex-start;
  gap: var(--row-gap);
  margin: 8px 0;
}

.tree.horizontal .tree-row.has-children {
  align-items: stretch;
}

.tree.horizontal .tree-row.has-children > .tree-node {
  align-self: center;
}

.tree.horizontal .tree-row.is-group-leader {
  position: relative;
  padding-top: 12px;
  padding-bottom: 12px;
}

.tree.horizontal ul > .tree-row.is-group-leader::before,
.tree.horizontal ul > .tree-row.is-group-leader::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  border-top: 1.5px dashed rgba(71, 85, 105, 0.48);
}

.tree.horizontal ul > .tree-row.is-group-leader::before {
  top: 0;
}

.tree.horizontal ul > .tree-row.is-group-leader::after {
  bottom: 0;
}

.tree.horizontal ul > .tree-row.is-group-leader + .tree-row.is-group-leader::before {
  display: none;
}


.tree.horizontal .tree-row > ul:not(.group-list) {
  margin: 0;
  padding-left: 18px;
  border-left: 1px dashed var(--border);
}

.group-list {
  list-style: none;
  margin: 0;
  padding-left: 18px;
  position: relative;
  margin-left: 0;
}


.group-node {
  margin: 8px 0;
}

.group-card {
  min-width: 170px;
  background: linear-gradient(135deg, var(--group-bg1, #fef3c7), var(--group-bg2, #fef9e7));
  border: 1px solid var(--group-border, rgba(245, 158, 11, 0.2));
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08);
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  position: relative;
}


.group-node.is-ungrouped .group-card {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.3);
}

.group-title {
  font-weight: 700;
  font-size: 12px;
}

.group-meta {
  font-size: 11px;
  color: var(--muted);
}

.group-progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.group-progress.muted {
  color: var(--muted);
}

.progress-track {
  height: 6px;
  background: rgba(15, 23, 42, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(135deg, var(--group-accent, #10b981), var(--group-accent-2, #22c55e));
}

.group-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.group-members {
  list-style: none;
  margin: 6px 0 0;
  padding-left: 0;
}

.group-members .tree-row {
  --row-gap: 12px;
  display: flex;
  align-items: flex-start;
  gap: var(--row-gap);
  margin: 8px 0;
}

.group-members .tree-row.has-children {
  align-items: center;
}

.group-members .tree-row > ul {
  margin: 0;
  padding-left: 18px;
  border-left: none;
}


.tree.horizontal .tree-node {
  width: 190px;
  padding: 8px 10px;
}

.tree-node {
  background: linear-gradient(135deg, #ffffff, #f1f5f9);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 12px;
  padding: 10px 12px;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.08);
}

.tree-node.is-selected {
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.2), 0 12px 22px rgba(15, 23, 42, 0.12);
}

.tree-title {
  font-weight: 700;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 4px;
}

.tree-actions {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.tree-actions .btn.tiny {
  padding: 3px 6px;
  font-size: 11px;
}

.tree-v2-intro {
  margin-bottom: 0;
  padding: 12px 14px;
  background: linear-gradient(140deg, rgba(255, 255, 255, 0.96), rgba(241, 245, 249, 0.9));
}

.tree-v2-intro-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tree-v2-intro-note {
  margin-top: 8px;
  font-size: 12px;
  color: #64748b;
}

.tree-v2-legend-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 700;
  border: 1px solid transparent;
}

.tree-v2-legend-chip.person {
  background: #e0ecff;
  color: #1e3a8a;
  border-color: #bfdbfe;
}

.tree-v2-legend-chip.group {
  background: #fef3c7;
  color: #92400e;
  border-color: #fcd34d;
}

.tree-v2-legend-chip.ungrouped {
  background: #fee2e2;
  color: #9f1239;
  border-color: #fca5a5;
}

.tree-v2-card {
  margin-bottom: 0;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 14px;
  background:
    radial-gradient(780px 260px at 50% -120px, rgba(59, 130, 246, 0.12), transparent 65%),
    radial-gradient(620px 300px at 95% 18%, rgba(245, 158, 11, 0.1), transparent 72%),
    linear-gradient(180deg, rgba(248, 250, 252, 0.96), rgba(241, 245, 249, 0.9));
}

.tree-v2-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 8px;
  scrollbar-width: thin;
}

.tree-v2-zoom {
  transform-origin: top center;
  width: max-content;
  min-width: 100%;
}

.tree-v2-graph {
  --tree-v2-node-width: 206px;
  --tree-v2-node-height: 92px;
  min-width: max-content;
  padding: 10px 24px 24px;
}

.tree-v2-root,
.tree-v2-children {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tree-v2-root {
  display: flex;
  justify-content: center;
}

.tree-v2-item {
  position: relative;
  list-style: none;
  text-align: center;
  padding: 0;
}

.tree-v2-node {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  width: var(--tree-v2-node-width);
  min-width: var(--tree-v2-node-width);
  max-width: var(--tree-v2-node-width);
  height: var(--tree-v2-node-height);
  padding: 8px 10px;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.1);
  text-align: left;
  overflow: hidden;
}

.tree-v2-node.is-actionable {
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, border-color 0.14s ease;
}

.tree-v2-node.is-actionable:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 24px rgba(15, 23, 42, 0.16);
}

.tree-v2-node.is-actionable:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

.tree-v2-person {
  background: linear-gradient(150deg, #ffffff, #f8fafc);
  border-color: #dbe3ee;
}

.tree-v2-person.is-male {
  background: linear-gradient(150deg, #eff6ff, #dbeafe);
  border-color: #93c5fd;
}

.tree-v2-person.is-female {
  background: linear-gradient(150deg, #fdf2f8, #fce7f3);
  border-color: #f9a8d4;
}

.tree-v2-person.is-root {
  background: linear-gradient(150deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
  box-shadow: 0 12px 24px rgba(194, 65, 12, 0.16);
}

.tree-v2-group {
  background: linear-gradient(150deg, #fefce8, #fef3c7);
  border-color: #fcd34d;
}

.tree-v2-group.is-dg1 {
  background: linear-gradient(150deg, #fff7ed, #ffedd5);
  border-color: #fdba74;
}

.tree-v2-group.is-dg2 {
  background: linear-gradient(150deg, #f0fdf4, #dcfce7);
  border-color: #86efac;
}

.tree-v2-group.is-dg3 {
  background: linear-gradient(150deg, #faf5ff, #f3e8ff);
  border-color: #d8b4fe;
}

.tree-v2-item-group.is-ungrouped > .tree-v2-group {
  background: linear-gradient(150deg, #fff1f2, #ffe4e6);
  border-color: #fda4af;
}

.tree-v2-node-head {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 8px;
}

.tree-v2-node-head .badge {
  flex: 0 0 auto;
  white-space: nowrap;
  font-size: 10px;
  padding: 3px 7px;
}

.tree-v2-name {
  display: block;
  width: 100%;
  min-width: 0;
  font-weight: 700;
  font-size: 13px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tree-v2-meta {
  width: 100%;
  font-size: 11px;
  color: #475569;
  line-height: 1.3;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.tree-v2-empty {
  margin-top: 8px;
  font-size: 11px;
  color: #64748b;
}

.tree-v2-children {
  --tree-v2-gap: 16px;
  --tree-v2-connector: 18px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--tree-v2-gap);
  margin-top: 16px;
  padding-top: var(--tree-v2-connector);
}

.tree-v2-children::before {
  content: "";
  position: absolute;
  top: calc(var(--tree-v2-connector) * -1);
  left: 50%;
  height: var(--tree-v2-connector);
  border-left: 2px solid #c7d3e0;
  transform: translateX(-50%);
}

.tree-v2-children > .tree-v2-item::before,
.tree-v2-children > .tree-v2-item::after {
  content: "";
  position: absolute;
  top: calc(var(--tree-v2-connector) * -1);
}

.tree-v2-children > .tree-v2-item::before {
  left: 50%;
  height: var(--tree-v2-connector);
  border-left: 2px solid #c7d3e0;
  transform: translateX(-50%);
}

.tree-v2-children > .tree-v2-item::after {
  left: calc(var(--tree-v2-gap) * -0.5);
  right: calc(var(--tree-v2-gap) * -0.5);
  border-top: 2px solid #c7d3e0;
}

.tree-v2-children > .tree-v2-item:first-child::after {
  left: 50%;
}

.tree-v2-children > .tree-v2-item:last-child::after {
  right: 50%;
}

.tree-v2-children > .tree-v2-item:only-child::after {
  display: none;
}

.tree-v2-level-members {
  --tree-v2-gap: 12px;
  gap: var(--tree-v2-gap);
}

.tree-v2-level-members > .tree-v2-item > .tree-v2-person:not(.is-male):not(.is-female) {
  background: linear-gradient(150deg, #ffffff, #f8fafc);
  border-color: #dbe3ee;
}

.tree-v2-level-members .tree-v2-level-groups {
  --tree-v2-gap: 12px;
  gap: var(--tree-v2-gap);
}

.tree-v2-action-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.tree-v2-action-modal-card .modal-note {
  margin-bottom: 10px;
}

@media (max-width: 640px) {
  .tree-v2-action-buttons {
    grid-template-columns: 1fr;
  }
}

.icon-btn {
  padding: 4px;
  width: 28px;
  height: 28px;
  justify-content: center;
}

.btn.secondary.icon-btn {
  color: #fff;
}

.icon-btn .icon {
  width: 16px;
  height: 16px;
  display: block;
}

.icon-btn .icon path,
.icon-btn .icon circle {
  stroke-width: 2.2;
}

.table-details summary {
  cursor: pointer;
  font-weight: 600;
  margin-bottom: 10px;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
  z-index: 9999;
}

.modal.is-open {
  display: flex;
}

.modal-card {
  background: #ffffff;
  border-radius: 16px;
  width: min(560px, 92vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.2);
  border: 1px solid rgba(15, 23, 42, 0.08);
  padding: 0;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  position: sticky;
  top: 0;
  z-index: 5;
  background: #fff;
  padding: 16px;
  margin: 0;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
}

.modal-title {
  font-weight: 700;
  font-size: 16px;
}

.modal-body {
  margin-top: 0;
  padding: 12px 16px 16px;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.modal-form {
  display: grid;
  gap: 10px;
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.modal-note {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  color: #9a3412;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
}

.member-view-modal-card {
  width: min(920px, 96vw);
}

.member-view-table-wrap {
  max-height: 66vh;
  overflow: auto;
}

.file-text-editor {
  min-height: 240px;
  resize: vertical;
  font-family: "Courier New", Courier, monospace;
  line-height: 1.45;
}

.file-view-modal-card {
  width: min(860px, 94vw);
}

.file-view-body {
  display: grid;
  gap: 10px;
}

.file-view-text {
  margin: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  color: #0f172a;
  padding: 12px;
  min-height: 220px;
  max-height: 62vh;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: "Courier New", Courier, monospace;
  font-size: 13px;
  line-height: 1.45;
}

.file-view-image-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 10px;
  min-height: 220px;
  max-height: 70vh;
  overflow: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-view-image {
  max-width: 100%;
  max-height: 66vh;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  border-radius: 8px;
}

.file-view-embed-wrap {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 8px;
}

.file-view-embed {
  width: 100%;
  min-height: 62vh;
  border: 0;
  border-radius: 8px;
  background: #fff;
}

.modal.is-fullres .file-view-modal-card {
  width: min(1280px, 98vw);
  max-height: 96vh;
  overflow: hidden;
}

.modal.is-fullres .file-view-image-wrap {
  max-height: calc(96vh - 170px);
  min-height: 0;
  padding: 0;
  background: #fff;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.modal.is-fullres .file-view-image {
  max-width: 100%;
  max-height: calc(96vh - 180px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0;
}

.modal.is-fullres .file-view-embed {
  min-height: 82vh;
}

.file-sheet-modal-card {
  width: min(1080px, 96vw);
}

.file-sheet-toolbar {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.file-sheet-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 2px;
}

.file-sheet-formula-help {
  font-size: 12px;
  color: var(--muted);
}

.file-sheet-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  padding: 8px;
  max-height: 58vh;
}

.file-sheet-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: #fff;
}

.file-sheet-table th,
.file-sheet-table td {
  border: 1px solid var(--border);
  padding: 4px;
}

.file-sheet-table td {
  min-width: 170px;
}

.file-sheet-table th {
  background: #eef2f7;
  text-align: center;
  font-weight: 700;
  color: #334155;
}

.file-sheet-table th.sheet-num {
  min-width: 118px;
  width: 118px;
}

.file-sheet-table tr.sheet-row-frozen > th.sheet-num,
.file-sheet-table tr.sheet-row-frozen > td {
  background: #fff7ed;
}

.file-sheet-table .sheet-row-head {
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.file-sheet-table .sheet-row-freeze {
  border: 1px solid #d1d9e2;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  cursor: pointer;
}

.file-sheet-table .sheet-row-freeze:hover {
  background: #f1f5f9;
}

.file-sheet-table .sheet-row-freeze.is-active {
  border-color: #f59e0b;
  color: #b45309;
  background: #fff7ed;
}

.file-sheet-table .sheet-row-freeze:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.file-sheet-table .sheet-col-head {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.file-sheet-table .sheet-col-sort,
.file-sheet-table .sheet-col-style,
.file-sheet-table .sheet-row-style {
  border: 1px solid #d1d9e2;
  border-radius: 6px;
  background: #fff;
  color: #475569;
  font-size: 10px;
  line-height: 1;
  padding: 2px 4px;
  min-width: 20px;
  text-align: center;
  cursor: pointer;
}

.file-sheet-table .sheet-col-sort:hover,
.file-sheet-table .sheet-col-style:hover,
.file-sheet-table .sheet-row-style:hover {
  background: #f1f5f9;
}

.file-sheet-table .sheet-col-sort.is-active,
.file-sheet-table .sheet-col-style.is-active,
.file-sheet-table .sheet-row-style.is-active {
  border-color: var(--primary);
  color: var(--primary);
  background: #f0fdfa;
}

.file-sheet-table .sheet-col-sort:disabled,
.file-sheet-table .sheet-col-style:disabled,
.file-sheet-table .sheet-row-style:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.file-sheet-table td input {
  width: 140px;
  min-width: 100px;
  border: 1px solid #d1d9e2;
  border-radius: 7px;
  padding: 6px 8px;
  font: inherit;
  color: #0f172a;
  background: #fff;
}

.file-sheet-table .sheet-cell-wrap {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}

.file-sheet-table .sheet-cell-wrap input[data-sheet-cell] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding-right: 54px;
}

.file-sheet-table .sheet-cell-preview {
  position: absolute;
  top: 7px;
  right: 8px;
  font-size: 10px;
  color: #475569;
  line-height: 1;
  max-width: 48px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 4px;
  padding: 1px 3px;
}

.file-sheet-table td input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(15, 118, 110, 0.15);
}

.file-sheet-table td input.sheet-formula-cell {
  border-color: #86efac;
  background: #f0fdf4;
}

.file-view-sheet-wrap {
  max-height: 62vh;
}

.file-view-sheet-table td {
  min-width: 120px;
  vertical-align: top;
  white-space: pre-wrap;
  word-break: break-word;
}

.file-view-sheet-table td.sheet-formula-result {
  background: #ecfdf5;
  font-weight: 600;
}

.file-view-sheet-table .sheet-empty {
  text-align: center;
  color: var(--muted);
  font-style: italic;
}

.is-hidden {
  display: none;
}

body.modal-open {
  overflow: hidden;
}

body.sidebar-open {
  overflow: hidden;
}

.alert {
  transition: opacity 0.2s ease, transform 0.2s ease;
  position: fixed;
  top: 24px;
  right: 24px;
  padding: 12px 16px;
  border-radius: 12px;
  z-index: 9999;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.2);
  animation: toast-in 0.25s ease-out;
  max-width: min(320px, calc(100vw - 48px));
}

.alert.is-closing {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.alert.danger {
  background: linear-gradient(135deg, #fee2e2, #fecaca);
  color: #991b1b;
  border: 1px solid #fecaca;
}

.alert.success {
  background: linear-gradient(135deg, #dcfce7, #bbf7d0);
  color: #166534;
  border: 1px solid #86efac;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
  gap: 24px;
  padding: 22px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid var(--border);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.12);
  animation: rise 0.7s ease-out both;
}

.hero-copy h1 {
  font-size: clamp(28px, 3.5vw, 42px);
  margin: 6px 0 10px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 2px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.lead {
  font-size: 16px;
  line-height: 1.6;
  color: var(--muted);
  margin: 0 0 16px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.hero-panel {
  background: linear-gradient(160deg, #ffffff, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.8);
}

.panel-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.panel-note {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.panel-note.status-done {
  color: #166534;
}

.panel-note.status-upcoming {
  color: #a16207;
}

.panel-note.status-pending {
  color: #b91c1c;
}

.panel-divider {
  border-top: 1px solid rgba(148, 163, 184, 0.35);
  margin-top: 10px;
  padding-top: 2px;
}

.feature-section {
  margin-top: 26px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.section-head p {
  color: var(--muted);
  margin: 0;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.feature-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-height: 190px;
  box-shadow: 0 12px 24px rgba(15, 23, 42, 0.08);
  animation: rise 0.7s ease-out both;
}

.feature-card:nth-child(2) {
  animation-delay: 0.08s;
}

.feature-card:nth-child(3) {
  animation-delay: 0.16s;
}

.feature-card:nth-child(4) {
  animation-delay: 0.24s;
}

.feature-card.is-active {
  border-color: rgba(15, 118, 110, 0.35);
  box-shadow: 0 18px 28px rgba(15, 118, 110, 0.18);
}

.feature-card.is-disabled {
  opacity: 0.6;
  filter: grayscale(0.15);
  cursor: not-allowed;
}

.feature-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: #e6f2ef;
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
  font-weight: 700;
  color: var(--primary);
}

.feature-icon.muted {
  background: #eef2f7;
  color: #6b7280;
}

.icon-ring {
  position: absolute;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 2px solid rgba(15, 118, 110, 0.18);
}

.feature-icon.muted .icon-ring {
  border-color: rgba(107, 114, 128, 0.25);
}

.icon-mark {
  position: relative;
  font-size: 12px;
  letter-spacing: 1px;
}

.feature-title {
  font-weight: 700;
  font-size: 16px;
}

.feature-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.feature-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.feature-stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  border-top: 1px dashed rgba(148, 163, 184, 0.35);
  padding-top: 6px;
}

.feature-stat:first-child {
  border-top: none;
  padding-top: 0;
}

.feature-stat strong {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
}

.feature-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.badge {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid #a7f3d0;
  background: #d1fae5;
  color: #065f46;
  font-weight: 600;
}

.badge.muted {
  border-color: #d1d5db;
  background: #e5e7eb;
  color: #6b7280;
}

.badge.success {
  border-color: #a7f3d0;
  background: #d1fae5;
  color: #065f46;
}

.badge.warning {
  border-color: #fde68a;
  background: #fef3c7;
  color: #92400e;
}

.chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
  font-weight: 600;
}

.chart-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: stretch;
  margin-bottom: 20px;
}

.chart-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
}

.chart-card.span-2 {
  grid-column: 1 / -1;
}

.chart-stage {
  position: relative;
  overflow-x: auto;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding-bottom: 2px;
  flex: 1 1 auto;
  min-height: 0;
  scrollbar-width: thin;
  scrollbar-color: #8a8a8a #e5e7eb;
}

.chart-stage::-webkit-scrollbar {
  height: 12px;
}

.chart-stage::-webkit-scrollbar-track {
  background: #e5e7eb;
  border-radius: 999px;
}

.chart-stage::-webkit-scrollbar-thumb {
  background: #8a8a8a;
  border-radius: 999px;
}

.chart-svg {
  display: block;
  width: 100%;
  min-width: 640px;
  height: auto;
}

.chart-grid-line {
  stroke: #e2e8f0;
  stroke-width: 1;
}

.chart-axis-label {
  fill: #64748b;
  font-size: 10px;
  font-family: "Manrope", "Noto Sans", sans-serif;
}

.chart-line {
  fill: none;
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.chart-line.attendance {
  stroke: #0f766e;
}

.chart-line.sunday-school {
  stroke: #f59e0b;
}

.chart-dot {
  stroke: #ffffff;
  stroke-width: 1.5;
}

.chart-dot[data-chart-tip],
.chart-bar[data-chart-tip] {
  cursor: pointer;
}

.chart-dot[data-chart-tip] {
  transition: stroke-width 0.14s ease, opacity 0.14s ease;
}

.chart-dot[data-chart-tip]:hover,
.chart-dot[data-chart-tip].is-active,
.chart-dot[data-chart-tip]:focus {
  stroke-width: 2.6;
  opacity: 1;
}

.chart-dot[data-chart-tip]:focus,
.chart-bar[data-chart-tip]:focus {
  outline: none;
}

.chart-dot.attendance {
  fill: #0f766e;
}

.chart-dot.sunday-school {
  fill: #f59e0b;
}

.chart-bar.offering {
  fill: #22c55e;
  opacity: 0.88;
}

.chart-bar.communion {
  fill: #3b82f6;
  opacity: 0.9;
}

.chart-bar[data-chart-tip] {
  transition: opacity 0.14s ease, filter 0.14s ease;
}

.chart-bar[data-chart-tip]:hover,
.chart-bar[data-chart-tip].is-active,
.chart-bar[data-chart-tip]:focus {
  opacity: 1;
  filter: brightness(0.94);
}

.chart-legend {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 12px;
  color: var(--muted);
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  background: #94a3b8;
}

.legend-dot.attendance {
  background: #0f766e;
}

.legend-dot.sunday-school {
  background: #f59e0b;
}

.legend-dot.success {
  background: #22c55e;
}

.legend-dot.muted {
  background: #94a3b8;
}

.chart-empty {
  text-align: center;
}

.chart-empty .btn {
  margin-top: 10px;
}

.chart-empty-inline {
  border: 1px dashed var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f8fafc;
  color: var(--muted);
}

.chart-tooltip {
  position: absolute;
  top: 8px;
  left: 8px;
  max-width: min(320px, calc(100% - 16px));
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 4;
}

.chart-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.member-pie-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.discipleship-progress-pie-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}

.discipleship-progress-overdue-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.discipleship-target-card {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.discipleship-target-list {
  display: grid;
  gap: 8px;
  margin-top: 2px;
  padding-right: 0;
}

.discipleship-target-item {
  padding: 8px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.94);
}

.discipleship-target-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 3px;
}

.discipleship-target-top .name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: #0f172a;
}

.discipleship-target-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 8px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.86);
}

.discipleship-target-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-bottom: 1px;
}

.discipleship-target-value .current {
  font-size: 18px;
  line-height: 1;
  font-weight: 800;
  color: #0f172a;
}

.discipleship-target-value .divider {
  color: #94a3b8;
  font-weight: 700;
}

.discipleship-target-value .target {
  font-size: 12px;
  font-weight: 700;
  color: #475569;
}

.discipleship-target-meta {
  font-size: 11px;
  color: #64748b;
  line-height: 1.2;
}

.discipleship-overdue-card {
  margin-bottom: 0;
}

.discipleship-overdue-list-wrap {
  margin-top: 4px;
}

.discipleship-overdue-list {
  display: grid;
  gap: 10px;
  max-height: 220px;
  overflow: auto;
  padding-right: 6px;
}

.discipleship-overdue-item {
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.94);
}

.discipleship-overdue-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.discipleship-overdue-top .name {
  font-weight: 700;
  color: #0f172a;
  flex: 1 1 auto;
  min-width: 0;
}

.discipleship-overdue-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.discipleship-overdue-meta {
  font-size: 12px;
  color: #64748b;
  line-height: 1.35;
}

.member-pie-card {
  margin-bottom: 0;
}

.member-pie-layout {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.discipleship-progress-pie-grid > .member-pie-card:first-child {
  display: flex;
  flex-direction: column;
}

.discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-layout {
  grid-template-columns: minmax(272px, 1fr) minmax(122px, 170px);
  gap: 10px;
  align-items: center;
  flex: 1 1 auto;
}

.discipleship-progress-pie-grid > .member-pie-card:first-child .card-row h2 {
  margin-bottom: 2px;
}

.discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-stage,
.discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-svg {
  width: 278px;
  height: 278px;
}

.discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-legend {
  gap: 6px;
}

.discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-legend-item {
  grid-template-columns: 8px minmax(0, 1fr) auto;
  padding: 5px 6px;
  font-size: 11px;
}

.discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-legend-item .count {
  font-size: 11px;
}

.member-pie-stage {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto;
}

.member-pie-svg {
  width: 220px;
  height: 220px;
  display: block;
}

.member-pie-track {
  fill: none;
  stroke: #e2e8f0;
  stroke-width: 28;
}

.member-pie-segment {
  fill: none;
  stroke-width: 28;
  stroke-linecap: butt;
  opacity: 0.92;
  cursor: pointer;
  transition: opacity 0.16s ease, stroke-width 0.16s ease;
}

.member-pie-segment:hover,
.member-pie-segment.is-active,
.member-pie-segment:focus {
  opacity: 1;
  stroke-width: 31;
}

.member-pie-segment:focus {
  outline: none;
}

.member-pie-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}

.member-pie-center .value {
  font-size: 30px;
  line-height: 1.1;
  font-weight: 800;
  color: #0f172a;
}

.member-pie-center .label {
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  margin-top: 2px;
}

.member-pie-tooltip {
  position: absolute;
  top: 8px;
  left: 8px;
  max-width: calc(100% - 16px);
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(15, 23, 42, 0.92);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.35;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.28);
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.14s ease, transform 0.14s ease;
  z-index: 4;
}

.member-pie-tooltip.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.member-pie-legend {
  display: grid;
  gap: 8px;
}

.member-pie-legend-item {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #ffffff;
  font-size: 12px;
}

.member-pie-legend-item .dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
}

.member-pie-legend-item .text {
  color: #334155;
  font-weight: 600;
}

.member-pie-legend-item .count {
  color: #475569;
  font-weight: 700;
  white-space: nowrap;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.print-page {
  background: #fff;
}

.print-page.a5 {
  margin: 0;
}

.label-sheet {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.label-card {
  width: 360px;
  border: 1px solid #111827;
  padding: 16px;
  border-radius: 10px;
  text-align: left;
}

.label-sheet.a5 {
  width: 148mm;
  min-height: 210mm;
  margin: 0 auto;
  margin-top: 0;
  padding: 0;
  display: block;
}

.label-grid {
  display: grid;
  grid-template-columns: repeat(3, 44mm);
  gap: 4mm;
  justify-content: space-between;
  align-content: start;
  align-items: start;
}

.label-card.small {
  width: 44mm;
  border-radius: 6px;
  padding: 4px;
  overflow: hidden;
}

.label-card.small .label-title {
  font-size: 8px;
  letter-spacing: 0.3px;
}

.label-card.small .label-name {
  font-size: 9px;
  margin-top: 1px;
}

.label-card.small .label-meta {
  font-size: 8px;
  margin-top: 1px;
}

.label-card.small .label-logo img {
  max-width: 28px;
  max-height: 18px;
}

.label-card.small .label-header {
  gap: 6px;
}

.label-card.small .label-code {
  font-size: 9px;
  margin-top: 2px;
  text-align: center;
}

.label-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.label-text {
  display: flex;
  flex-direction: column;
}

.label-logo {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
}

.label-logo img {
  max-width: 120px;
  max-height: 60px;
  width: auto;
  height: auto;
}

.label-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #111827;
}

.label-name {
  font-size: 18px;
  font-weight: 700;
  margin-top: 8px;
}

.label-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.label-code {
  font-weight: 600;
  letter-spacing: 1px;
  margin-top: 12px;
  text-align: center;
}

/* Global UI polish */
.app-page {
  color-scheme: light;
}

.app-page .app-main {
  min-width: 0;
}

.container {
  max-width: 1360px;
}

.app-page .container > .card-row.discipleship-page-head {
  margin: 4px 0 10px;
  align-items: flex-end;
}

.app-page .container > .card-row.discipleship-page-head h1 {
  margin: 0;
  line-height: 1.08;
}

.app-page .container > .card-row.discipleship-page-head .actions {
  margin-left: auto;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.app-page .container > .card-row.discipleship-page-head .actions .search {
  width: min(100%, 320px);
  min-width: 220px;
}

.app-page.page-discipleship-groups-list .container > .card-row.discipleship-page-head .actions .search,
.app-page.page-discipleship-people-list .container > .card-row.discipleship-page-head .actions .search,
.app-page.page-spiritual_journey .container > .card-row.discipleship-page-head .actions .search,
.app-page.page-msk_classes .container > .card-row.discipleship-page-head .actions .search {
  width: min(100%, 220px);
  min-width: 160px;
  height: 36px;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
}

.app-page .container > .card-row.discipleship-page-head .actions .btn.tiny.icon-btn {
  width: 44px;
  height: 44px;
  min-width: 44px;
  padding: 0;
  justify-content: center;
}

input,
select,
textarea {
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: rgba(15, 118, 110, 0.56);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16);
}

.search {
  width: min(100%, 300px);
  min-height: 44px;
  padding: 10px 14px;
  border-radius: 14px;
  border-color: #c9d5e1;
  background: rgba(255, 255, 255, 0.9);
}

.btn {
  transition: transform 0.16s ease, box-shadow 0.2s ease, filter 0.16s ease;
}

.btn:hover {
  transform: translateY(-1px);
  filter: brightness(1.02);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.16), 0 8px 20px rgba(15, 118, 110, 0.22);
}

.card.table-card-plain .table-wrap {
  scrollbar-gutter: auto;
}

.card.table-card-plain .table td {
  vertical-align: middle;
}

.card.table-card-plain .table th,
.card.table-card-plain .table td {
  line-height: 1.35;
}

.card.table-card-plain .table th.actions-head,
.card.table-card-plain .table td.actions {
  width: 172px;
  min-width: 172px;
  white-space: nowrap;
}

.page-discipleship-groups-list .discipleship-list-card .table-wrap,
.page-discipleship-people-list .discipleship-list-card .table-wrap,
.page-discipleship-table-scroll .table-card-plain .table-wrap,
.page-member-completeness .member-completeness-main-table .table-wrap,
.page-member-families-scroll .member-families-main-table .table-wrap {
  min-height: clamp(300px, calc(100dvh - 240px), 2000px);
}

.page-dg-public {
  background-color: #f3f7f9;
  background-image:
    radial-gradient(900px 420px at 8% -12%, rgba(20, 184, 166, 0.14), transparent 60%),
    radial-gradient(780px 420px at 92% -8%, rgba(245, 158, 11, 0.16), transparent 58%),
    linear-gradient(180deg, #f7fbfc 0%, #f6f2ea 100%);
}

.page-dg-public .container {
  max-width: 1160px;
  margin: 34px auto 52px;
}

.page-dg-public .public-branch-select-card {
  padding: 26px;
  border-radius: 20px;
  background:
    radial-gradient(340px 180px at -5% -12%, rgba(20, 184, 166, 0.18), transparent 72%),
    radial-gradient(320px 170px at 105% -8%, rgba(251, 191, 36, 0.14), transparent 72%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 250, 252, 0.94));
  border-color: rgba(148, 163, 184, 0.34);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.09);
}

.page-dg-public .public-branch-title-row {
  margin-bottom: 12px;
  align-items: flex-start;
}

.page-dg-public .public-branch-title-wrap h2 {
  font-size: clamp(26px, 2.7vw, 34px);
  line-height: 1.08;
}

.page-dg-public .public-branch-subtitle {
  color: #334155;
}

.page-dg-public .public-branch-meta {
  gap: 10px;
}

.page-dg-public .public-branch-count {
  background: rgba(15, 118, 110, 0.1);
  border-color: rgba(15, 118, 110, 0.24);
}

.page-dg-public .public-branch-guide {
  color: #475569;
  font-weight: 600;
}

.page-dg-public .public-branch-grid {
  gap: 16px;
}

.page-dg-public .public-branch-link-card {
  border-color: rgba(148, 163, 184, 0.38);
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.98), rgba(241, 245, 249, 0.95)),
    radial-gradient(170px 92px at 0% 100%, rgba(15, 118, 110, 0.1), transparent 74%);
  box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.page-dg-public .public-branch-link-card::before {
  background: linear-gradient(90deg, #0f766e, #14b8a6, #f59e0b);
}

.page-dg-public .public-branch-link-card:hover {
  transform: translateY(-3px);
  border-color: rgba(15, 118, 110, 0.46);
  box-shadow: 0 18px 28px rgba(15, 23, 42, 0.15);
}

.page-dg-public .public-branch-card-eyebrow {
  color: #0d9488;
}

.page-dg-public .public-branch-card-title {
  font-size: clamp(22px, 2.3vw, 32px);
  letter-spacing: 0.2px;
}

.page-dg-public .public-branch-card-cta {
  color: #0f766e;
}

.page-dg-public .public-branch-actions {
  margin-top: 22px;
}

.page-dg-public .public-branch-actions .btn.ghost {
  border-color: rgba(15, 118, 110, 0.36);
  color: #0f766e;
  background: rgba(240, 253, 250, 0.86);
}

.page-dg-public .public-branch-actions .btn.ghost:hover {
  border-color: rgba(15, 118, 110, 0.5);
  background: #ecfdf5;
}

@media (max-width: 900px) {
  .app-page .container > .card-row.discipleship-page-head {
    align-items: flex-start;
    gap: 10px;
  }

  .app-page .container > .card-row.discipleship-page-head .actions {
    width: 100%;
    justify-content: flex-start;
    margin-left: 0;
  }

  .app-page .container > .card-row.discipleship-page-head .actions .search {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .app-page.page-discipleship-groups-list .container > .card-row.discipleship-page-head .actions .search,
  .app-page.page-discipleship-people-list .container > .card-row.discipleship-page-head .actions .search,
  .app-page.page-spiritual_journey .container > .card-row.discipleship-page-head .actions .search,
  .app-page.page-msk_classes .container > .card-row.discipleship-page-head .actions .search {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .page-dg-public .public-branch-select-card {
    padding: 20px;
    border-radius: 18px;
  }

  .page-dg-public .public-branch-title-row .badge {
    align-self: flex-start;
  }

  .page-dg-public .public-branch-link-card {
    min-height: 118px;
  }
}

@media (max-width: 640px) {
  .page-dg-public .public-branch-select-card {
    padding: 16px;
  }

  .page-dg-public .public-branch-meta {
    gap: 6px;
  }

  .page-dg-public .public-branch-count {
    min-height: 28px;
    padding: 3px 10px;
  }

  .page-dg-public .public-branch-guide {
    font-size: 12px;
  }
}

@media (max-width: 1180px) {
  .container {
    padding: 0 20px;
    margin: 24px auto 44px;
  }
  .card {
    padding: 16px;
  }
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  }
  .form-grid.worship-attendance-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1024px) {
  body {
    background-attachment: scroll;
  }
  .app-shell {
    position: relative;
    flex-direction: column;
    min-height: 100vh;
  }
  .sidebar-toggle {
    display: inline-flex;
    position: sticky;
    top: 12px;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    margin: 12px 0 0 12px;
    padding: 8px 12px;
    border-radius: 10px;
    border: 1px solid rgba(15, 23, 42, 0.12);
    background: #ffffff;
    color: #0f172a;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
    z-index: 60;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
    z-index: 50;
    border: 0;
    padding: 0;
  }
  .app-shell.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 86vw);
    height: 100vh;
    max-height: 100vh;
    z-index: 65;
    padding: 16px;
    transform: translateX(calc(-100% - 14px));
    transition: transform 0.22s ease;
    box-shadow: 20px 0 36px rgba(15, 23, 42, 0.26);
    border-bottom: 0;
  }
  .app-shell.sidebar-open .sidebar {
    transform: translateX(0);
  }
  .app-main {
    width: 100%;
  }
  .page-tree {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .page-tree .app-shell,
  .page-tree .app-main {
    height: auto;
    overflow: visible;
  }
  .page-discipleship-groups-list,
  .page-discipleship-people-list,
  .page-discipleship-table-scroll,
  .page-member-table-scroll,
  .page-member-families-scroll {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }
  .page-discipleship-groups-list .app-shell,
  .page-discipleship-people-list .app-shell,
  .page-discipleship-table-scroll .app-shell,
  .page-member-table-scroll .app-shell,
  .page-member-families-scroll .app-shell,
  .page-discipleship-groups-list .app-main,
  .page-discipleship-people-list .app-main,
  .page-discipleship-table-scroll .app-main,
  .page-member-table-scroll .app-main,
  .page-member-families-scroll .app-main {
    height: auto;
    overflow: visible;
  }
  .page-tree .container {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 16px;
  }
  .page-discipleship-groups-list .container,
  .page-discipleship-people-list .container,
  .page-discipleship-table-scroll .container,
  .page-member-table-scroll .container,
  .page-member-families-scroll .container {
    height: auto;
    min-height: 0;
    overflow: visible;
    padding: 16px;
    gap: 12px;
  }
  .page-discipleship-groups-list .discipleship-list-card,
  .page-discipleship-people-list .discipleship-list-card,
  .page-discipleship-table-scroll .table-card-plain {
    min-height: 0;
  }
  .page-member-table-scroll .members-main-table,
  .page-member-table-scroll .member-completeness-main-table {
    min-height: 0;
  }
  .page-member-families-scroll .member-families-main-table {
    min-height: 0;
  }
  .page-discipleship-groups-list .discipleship-list-card .table-wrap,
  .page-discipleship-people-list .discipleship-list-card .table-wrap,
  .page-discipleship-table-scroll .table-card-plain .table-wrap,
  .page-member-table-scroll .members-main-table .table-wrap,
  .page-member-table-scroll .member-completeness-main-table .table-wrap,
  .page-member-families-scroll .member-families-main-table .table-wrap {
    overflow: auto;
  }
  .page-tree .tree-scroll {
    max-height: min(68vh, 680px);
  }
  .page-tree-v2 .tree-v2-scroll {
    max-height: min(68vh, 680px);
  }
  .hero {
    grid-template-columns: 1fr;
  }
  .stats.compact {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .member-pie-grid {
    grid-template-columns: 1fr;
  }
  .discipleship-progress-pie-grid {
    grid-template-columns: 1fr;
  }
  .chart-grid {
    grid-template-columns: 1fr;
  }
  .chart-card.span-2 {
    grid-column: auto;
  }
}

@media (max-width: 900px) {
  h1 {
    font-size: 24px;
    margin: 4px 0 14px;
  }
  .container {
    padding: 0 16px;
    margin: 20px auto 36px;
  }
  .stats {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  }
  .stats .stat {
    min-height: 122px;
    padding: 14px;
  }
  .stats .stat-value {
    font-size: clamp(24px, 6.2vw, 34px);
  }
  .member-pie-layout {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-layout {
    grid-template-columns: 1fr;
  }
  .member-pie-stage,
  .member-pie-svg {
    width: 200px;
    height: 200px;
  }
  .discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-stage,
  .discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-svg {
    width: 208px;
    height: 208px;
  }
  .form-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
  .inventory-master-grid {
    grid-template-columns: 1fr;
  }
  .chart-svg {
    min-width: 560px;
  }
  .tree-v2-card {
    padding: 12px;
  }
  .tree-v2-graph {
    --tree-v2-node-width: 182px;
    --tree-v2-node-height: 86px;
    padding: 8px 12px 18px;
  }
  .tree-v2-children {
    --tree-v2-gap: 10px;
    gap: var(--tree-v2-gap);
  }
  .tree-v2-node {
    padding: 7px 9px;
  }
  .tree-v2-name {
    font-size: 12px;
  }
  .tree-v2-meta {
    font-size: 10px;
  }
  .dg-rating-scale {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
  .documentation-photos-all {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .documentation-photo {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 720px) {
  .sidebar {
    width: min(300px, 88vw);
    padding: 14px 12px;
  }
  .sidebar-brand .brand {
    font-size: 16px;
  }
  .brand-sub {
    font-size: 10px;
    letter-spacing: 1.5px;
  }
  .nav {
    width: 100%;
  }
  .page-login .container {
    margin: 20px auto;
  }
  .page-public-links .container {
    margin: 20px auto;
  }
  .public-social-wrap {
    margin-top: 10px;
  }
  .public-social-label {
    font-size: 10px;
    letter-spacing: 1.2px;
  }
  .public-social-row {
    gap: 6px;
  }
  .container {
    padding: 0 12px;
    margin: 16px auto 30px;
  }
  .page-tree-v2 .container {
    padding: 12px;
    gap: 12px;
  }
  .app-page.is-central-readonly .container {
    margin: 12px auto 30px;
    padding-top: 16px;
  }
  .tree-v2-intro {
    padding: 10px 11px;
  }
  .tree-v2-graph {
    --tree-v2-node-width: 166px;
    --tree-v2-node-height: 80px;
  }
  .tree-v2-node {
    padding: 6px 8px;
  }
  .tree-v2-children {
    --tree-v2-gap: 8px;
    --tree-v2-connector: 14px;
    gap: var(--tree-v2-gap);
    margin-top: 12px;
    padding-top: var(--tree-v2-connector);
  }
  .card {
    padding: 14px;
    border-radius: 12px;
  }
  .form-grid,
  .modal-form {
    grid-template-columns: 1fr;
  }
  .form-grid.worship-attendance-form {
    grid-template-columns: 1fr;
  }
  .form-row {
    flex-direction: column;
    align-items: stretch;
  }
  .form-actions {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
  }
  .form-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .card-row .actions {
    width: 100%;
  }
  .card-row .actions > * {
    flex: 1 1 100%;
    width: 100%;
  }
  .card-row .actions .search {
    max-width: 100%;
  }
  .page-member-families .member-family-tools {
    width: 100%;
  }
  .page-member-completeness .member-completeness-filter-form {
    width: 100%;
  }
  .page-member-completeness .member-completeness-filter-form label {
    width: 100%;
  }
  .member-completeness-filter-select {
    width: 100%;
    min-width: 0;
  }
  .page-member-families .member-family-tools > * {
    flex: 1 1 100%;
    width: 100%;
  }
  .member-family-member,
  .member-family-contact {
    width: 100%;
    border-radius: 10px;
  }
  .folder-grid {
    grid-template-columns: 1fr;
  }
  .folder-create-form {
    align-items: stretch;
  }
  .folder-create-form .btn {
    width: 100%;
    justify-content: center;
  }
  .file-move-form {
    display: flex;
    flex-wrap: wrap;
    width: 100%;
    gap: 6px;
  }
  #church-files-table td.actions > .file-move-form {
    margin-right: 0;
  }
  .file-folder-select {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .file-actions-list {
    left: 0;
    right: auto;
    min-width: 0;
    width: max-content;
    max-width: calc(100vw - 52px);
  }
  .file-create-actions {
    width: min(220px, calc(100vw - 52px));
    min-width: min(220px, calc(100vw - 52px));
  }
  .file-row-actions {
    width: min(220px, calc(100vw - 52px));
    min-width: min(220px, calc(100vw - 52px));
  }
  .file-actions-group {
    width: auto;
  }
  .file-actions-group .btn {
    width: auto;
    justify-content: center;
  }
  .file-actions-list .file-move-form {
    width: 100%;
  }
  .file-actions-list .file-move-form .btn {
    width: auto;
  }
  .dg-recap-report-tools {
    flex-wrap: wrap;
  }
  .dg-recap-filter,
  .dg-recap-filter .search,
  .dg-recap-report-search {
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
    margin-left: 0;
  }
  #dg-recap-report-list .dg-recap-report-tools {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  #dg-recap-report-list .dg-recap-filter,
  #dg-recap-report-list .dg-recap-filter .search,
  #dg-recap-report-list .dg-recap-report-search {
    width: 100%;
    flex: 1 1 100%;
    min-width: 0;
    margin-left: 0;
  }
  .card-row .actions.table-tools > * {
    flex: 0 1 auto;
    width: auto;
  }
  .card-row .actions.msk-table-tools > * {
    flex: 0 1 auto;
    width: auto;
  }
  .card-row .actions.members-table-tools > * {
    flex: 0 1 auto;
    width: auto;
  }
  .card-row .actions.items-table-tools > * {
    flex: 0 1 auto;
    width: auto;
  }
  .card-row .actions.worship-table-tools > * {
    flex: 0 1 auto;
    width: auto;
  }
  .card-row .actions.cash-table-tools > * {
    flex: 0 1 auto;
    width: auto;
  }
  .card-row .actions.msk-table-tools .msk-table-search {
    flex: 1 1 180px;
    min-width: 140px;
    width: auto;
    max-width: 240px;
  }
  .card-row .actions.members-table-tools .members-table-search {
    flex: 1 1 180px;
    min-width: 140px;
    width: auto;
    max-width: 240px;
  }
  .card-row .actions.items-table-tools .items-table-search {
    flex: 1 1 180px;
    min-width: 140px;
    width: auto;
    max-width: 240px;
  }
  .card-row .actions.worship-table-tools .worship-table-search {
    flex: 1 1 180px;
    min-width: 140px;
    width: auto;
    max-width: 240px;
  }
  .card-row .actions.cash-table-tools .cash-table-search {
    flex: 1 1 180px;
    min-width: 140px;
    width: auto;
    max-width: 240px;
  }
  .central-rekap-toolbar {
    padding: 12px;
  }
  .central-rekap-head {
    align-items: stretch;
  }
  .cash-filter-form label {
    align-items: flex-start;
    width: 100%;
  }
  .card-row .actions.msk-table-tools .cash-filter-form {
    flex-direction: row;
    align-items: center;
  }
  .card-row .actions.msk-table-tools .cash-filter-form label {
    align-items: center;
    width: auto;
  }
  .stats.compact {
    grid-template-columns: 1fr;
  }
  .table th,
  .table td {
    padding: 8px 6px;
    font-size: 13px;
  }
  .card.table-card-plain .table-wrap {
    border-radius: 12px;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .card.table-card-plain .table th,
  .card.table-card-plain .table td {
    padding: 9px 8px;
  }
  .chart-svg {
    min-width: 520px;
  }
  .dg-rating-scale {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .modal {
    padding: 12px;
  }
  .modal-card {
    width: min(560px, 100%);
    max-height: calc(100vh - 24px);
    border-radius: 12px;
    padding: 0;
  }
  .modal-head {
    padding: 14px;
  }
  .modal-body {
    padding: 10px 14px 14px;
  }
  .modal-actions {
    justify-content: stretch;
  }
  .modal-actions .btn {
    width: 100%;
    justify-content: center;
  }
  .alert {
    top: 12px;
    right: 12px;
    max-width: calc(100vw - 24px);
  }
  .tree.horizontal .tree-row,
  .group-members .tree-row {
    --row-gap: 8px;
  }
  .tree.horizontal .tree-node {
    width: 170px;
  }
  .group-card {
    min-width: 160px;
  }

  .page-files .container > h1 {
    padding-left: 84px;
    min-height: 40px;
    display: flex;
    align-items: center;
  }

  .page-files .card-row > .actions {
    width: auto;
    margin-left: auto;
    flex-wrap: nowrap;
    align-items: center;
  }

  .page-files .card-row > .actions > * {
    flex: 0 0 auto;
    width: auto;
  }

  .page-files .card-row > .actions .btn.icon-btn,
  .page-files .card-row > .actions summary.btn.icon-btn {
    width: 40px;
    height: 40px;
    padding: 0;
    justify-content: center;
  }

  .page-files #church-files-table {
    min-width: 780px;
  }

  .page-files #church-files-table th:first-child,
  .page-files #church-files-table td:first-child {
    min-width: 230px;
  }

  .page-files #church-files-table th:nth-child(2),
  .page-files #church-files-table td:nth-child(2) {
    min-width: 106px;
    white-space: nowrap;
  }

  .page-files #church-files-table th:nth-child(3),
  .page-files #church-files-table td:nth-child(3) {
    min-width: 130px;
    white-space: nowrap;
  }

  .page-files #church-files-table th:nth-child(4),
  .page-files #church-files-table td:nth-child(4) {
    min-width: 180px;
  }

  .page-files #church-files-table th.actions-head,
  .page-files #church-files-table td.actions {
    min-width: 110px;
    white-space: nowrap;
  }

  .page-files #church-files-table .file-title {
    word-break: normal;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 560px) {
  .sidebar {
    width: min(280px, 90vw);
    padding: 12px 10px;
  }
  .container {
    padding: 0 10px;
  }
  .hero {
    padding: 16px;
    gap: 14px;
  }
  .hero-copy h1 {
    font-size: clamp(22px, 8vw, 30px);
  }
  .lead {
    font-size: 14px;
  }
  .feature-grid {
    grid-template-columns: 1fr;
  }
  .feature-card {
    min-height: 0;
  }
  .documentation-photos {
    grid-template-columns: 1fr;
  }
  .member-pie-stage,
  .member-pie-svg {
    width: 184px;
    height: 184px;
  }
  .discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-stage,
  .discipleship-progress-pie-grid > .member-pie-card:first-child .member-pie-svg {
    width: 188px;
    height: 188px;
  }
  .member-pie-center .value {
    font-size: 26px;
  }
  .member-pie-legend-item {
    grid-template-columns: 10px minmax(0, 1fr);
    gap: 8px;
  }
  .member-pie-legend-item .count {
    grid-column: 1 / -1;
    margin-left: 18px;
    white-space: normal;
  }
  .chart-svg {
    min-width: 460px;
  }
  .dg-rating-hint {
    flex-direction: column;
    align-items: flex-start;
  }
  .dg-rating-hint span:last-child {
    text-align: left;
  }

  .storage-summary-grid {
    grid-template-columns: 1fr;
  }

  .storage-share {
    min-width: 92px;
  }
}

@page {
  size: A5;
  margin: 8mm;
}

@media print {
  body {
    background: #fff !important;
  }
  .topbar,
  .container,
  .btn {
    display: none !important;
  }
  .label-card {
    border: 1px solid #000;
  }
}

.printed-code {
  color: #16a34a;
  font-weight: 600;
}
