:root {
  /* Dendi Lawaka–inspired soft lavender + navy */
  --navy: #0c1a3a;
  --navy-soft: #1a2d5a;
  --blue: #2b7fd4;
  --blue-light: #5eb3f5;
  --magenta: #d4147a;
  --bg-deep: #cdd2f0;
  --bg: #d7dbf5;
  --bg-elevated: #faf9f6;
  --bg-soft: #eef0fa;
  --stone: #4f5d78;
  --stone-dim: #6a7894;
  --ink: #0c1a3a;
  --gold: #2b7fd4;
  --gold-soft: #5eb3f5;
  --danger: #c45c6a;
  --ok: #0d9f6e;
  --line: rgba(12, 26, 58, 0.08);
  --shadow: 0 8px 32px rgba(12, 26, 58, 0.12);
  --shadow-sm: 0 2px 12px rgba(12, 26, 58, 0.08);
  --radius: 20px;
  --radius-sm: 14px;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --max: 1120px;
  --bottom-nav-h: 4.3rem;
  --white: #faf9f6;
}

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  color-scheme: light;
  overflow-x: clip;
  max-width: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  max-width: 100%;
  overflow-x: clip;
  font-family: var(--font-body);
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  letter-spacing: 0.01em;
  -webkit-font-smoothing: antialiased;
}

body.page-landing { overflow-x: clip; }

img, video, canvas {
  max-width: 100%;
}

.main img,
.panel img,
.memorial-photo img,
.photo-preview img {
  height: auto;
}

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(ellipse 70% 45% at 12% -8%, rgba(43, 127, 212, 0.12), transparent 55%),
    radial-gradient(ellipse 55% 60% at 90% 8%, rgba(212, 20, 122, 0.06), transparent 55%),
    linear-gradient(165deg, #d7dbf5 0%, #cdd2f0 55%, #e4e7fa 100%);
}

.ambient::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--blue); text-decoration: none; }
a:hover { color: var(--navy); }

.main {
  width: min(100% - 1.5rem, var(--max));
  max-width: 100%;
  margin: 0 auto;
  padding: 1.5rem 0.75rem 4rem;
  min-width: 0;
  overflow-x: clip;
}

.page-landing .main,
.page-auth .main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.display {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.85rem, 5vw, 3.4rem);
  line-height: 1.1;
  margin: 0.2rem 0 0.6rem;
  letter-spacing: 0.01em;
  color: var(--navy);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.72rem;
  color: var(--blue);
  margin: 0 0 0.4rem;
  font-weight: 500;
}

.lede {
  color: var(--stone);
  max-width: 36rem;
  margin: 0 0 1.25rem;
  font-weight: 400;
  font-size: 1.05rem;
}

.muted { color: var(--stone-dim); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--white);
  background: var(--navy);
  letter-spacing: 0.04em;
  box-shadow: var(--shadow-sm);
}

.brand-mark-lg {
  width: 4.5rem;
  height: 4.5rem;
  font-size: 1.35rem;
  margin-bottom: 1rem;
  border-radius: 14px;
}

.brand-mark-sm {
  width: 2.5rem;
  height: 2.5rem;
  flex-shrink: 0;
}

.install-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 90;
  padding: 0.85rem 1rem calc(0.85rem + env(safe-area-inset-bottom));
  pointer-events: none;
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.install-banner.is-visible {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

.install-banner-inner {
  width: min(100%, 720px);
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem 1rem;
  padding: 1rem 1.1rem;
  background: rgba(250, 249, 246, 0.96);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.install-banner-copy {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  min-width: 0;
}

.install-banner-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--navy);
}

.install-banner-text {
  margin: 0.15rem 0 0;
  color: var(--stone-dim);
  font-size: 0.9rem;
}

.install-banner-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.brand-name {
  font-family: var(--font-display);
  font-size: clamp(3rem, 8vw, 5.5rem);
  font-weight: 600;
  margin: 0;
  line-height: 0.95;
  color: var(--navy);
}

.brand-text {
  font-family: var(--font-display);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--navy);
}

.brand-hero {
  flex-direction: column;
  align-items: center;
  gap: 0;
  text-align: center;
}

.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: clamp(1.5rem, 5vw, 3rem);
}

.hero-media {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 30%, rgba(43, 127, 212, 0.14), transparent 55%),
    radial-gradient(ellipse 60% 50% at 20% 80%, rgba(212, 20, 122, 0.06), transparent 50%),
    linear-gradient(165deg, #d7dbf5 0%, #cdd2f0 55%, #e4e7fa 100%);
}

.hero-veil {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(215,219,245,0.2) 0%, rgba(215,219,245,0.45) 100%);
}

.hero-content {
  position: relative;
  z-index: 1;
  width: min(100%, 34rem);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hero-tagline {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 3vw, 1.7rem);
  font-style: italic;
  color: var(--stone);
  margin: 0.85rem 0 1.5rem;
  font-weight: 500;
  max-width: 22rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  justify-content: center;
}

.hero-hint {
  margin-top: 1rem;
  color: var(--stone-dim);
  font-size: 0.9rem;
  min-height: 1.2em;
}

@media (display-mode: standalone) {
  #install-btn { display: none !important; }
}

/* Fund / dashboard hero card (DLI style) */
.fund-hero {
  display: block;
  width: 100%;
  text-align: left;
  background: linear-gradient(145deg, var(--navy), var(--navy-soft) 55%, #243a6e);
  border-radius: var(--radius);
  padding: 1.5rem;
  color: var(--white);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  margin: 0 0 1.25rem;
  text-decoration: none;
}

a.fund-hero:hover {
  color: var(--white);
}

.fund-hero::before {
  content: "";
  position: absolute;
  top: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(43, 127, 212, 0.35), transparent 70%);
  pointer-events: none;
}

.fund-hero-label {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0.7;
}

.fund-hero-amount {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 7vw, 2.75rem);
  font-weight: 700;
  line-height: 1.1;
  margin: 0.25rem 0;
  color: var(--white);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fund-hero-sub {
  margin: 0 0 1.1rem;
  font-size: 0.78rem;
  opacity: 0.65;
  overflow-wrap: anywhere;
}

.fund-hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  position: relative;
  z-index: 1;
}

.fund-hero-stat {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.35rem;
  text-align: center;
  min-width: 0;
}

.fund-hero-stat .val {
  font-size: clamp(0.72rem, 2.8vw, 0.95rem);
  font-weight: 600;
  color: var(--white);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.fund-hero-stat .lbl {
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.6;
  margin-top: 0.15rem;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin: 0 0 1.35rem;
  max-width: 100%;
}

.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  color: var(--navy-soft);
  text-decoration: none;
  font-size: 0.68rem;
  font-weight: 500;
  text-align: center;
  min-width: 0;
}

.quick-action span:last-child {
  max-width: 100%;
  overflow-wrap: anywhere;
  line-height: 1.25;
}

.quick-action:hover { color: var(--navy); }

.quick-action-icon {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 16px;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  font-size: 1.15rem;
}

.quick-action-icon.funerals {
  background: linear-gradient(135deg, #fde8f3, #fad0e8);
  color: var(--magenta);
}

.quick-action-icon.members {
  background: linear-gradient(135deg, #e8f4fd, #d0e8fa);
  color: var(--blue);
}

.quick-action-icon.fund {
  background: linear-gradient(135deg, #eef1f8, #dde4f0);
  color: var(--navy);
}

.quick-action-icon.news {
  background: linear-gradient(135deg, #f0e8fd, #e0d0fa);
  color: #6b5ce7;
}

.info-strip {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  width: 100%;
  background: linear-gradient(135deg, rgba(43, 127, 212, 0.08), rgba(212, 20, 122, 0.06));
  border: 1px solid rgba(43, 127, 212, 0.15);
  border-radius: var(--radius-sm);
  padding: 0.9rem 1rem;
  margin: 0 0 1.35rem;
  color: var(--navy-soft);
  font-size: 0.82rem;
  line-height: 1.45;
}

.info-strip strong { color: var(--blue); }

.info-strip-icon {
  width: 2.25rem;
  height: 2.25rem;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--white);
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  color: var(--blue);
  font-weight: 600;
}

.report-hub {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.report-card {
  background: var(--white);
  border: 1px solid rgba(12, 26, 58, 0.06);
  border-radius: var(--radius);
  padding: 1.15rem 1.05rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 0.75rem;
}

.report-card .section-title {
  margin: 0;
}

.report-card .muted {
  margin: 0;
}

.report-card .btn {
  justify-self: start;
}

@media (min-width: 900px) {
  .report-hub {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: start;
  }
}

.app-nav {
  width: min(100% - 1.5rem, var(--max));
  max-width: 100%;
  margin: 1rem auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: rgba(250, 249, 246, 0.94);
  border: 1px solid var(--line);
  border-radius: 999px;
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0.75rem;
  z-index: 40;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1rem;
}

.nav-links a,
.linkish {
  color: var(--stone);
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
  padding: 0;
}

.nav-links a:hover,
.linkish:hover { color: var(--navy); }

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font: inherit;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border-radius: 999px;
  padding: 0.85rem 1.4rem;
  font: inherit;
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  text-decoration: none;
}

.btn:hover { transform: translateY(-1px); }
.btn-sm { padding: 0.55rem 0.95rem; font-size: 0.9rem; }

.btn-primary {
  background: var(--navy);
  color: var(--white);
}

.btn-primary:hover { background: var(--navy-soft); color: var(--white); }

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border-color: rgba(12, 26, 58, 0.12);
}

.btn-ghost {
  background: transparent;
  color: var(--navy);
  border-color: rgba(12, 26, 58, 0.18);
}

.btn-ghost:hover {
  border-color: var(--blue);
  color: var(--blue);
}

.page-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  margin: 1.5rem 0 1.25rem;
  flex-wrap: wrap;
  min-width: 0;
  max-width: 100%;
}

.page-head > div {
  min-width: 0;
  flex: 1 1 12rem;
}

.head-actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  align-items: center;
}

.section { margin: 2rem 0; max-width: 100%; min-width: 0; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  font-weight: 600;
  margin: 0 0 1rem;
  color: var(--navy);
  overflow-wrap: anywhere;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin-bottom: 0.85rem;
  flex-wrap: wrap;
}

.section-head .section-title { margin: 0; font-size: 1.35rem; }

.link-btn {
  font-size: 0.78rem;
  color: var(--blue);
  font-weight: 500;
}

.panel {
  background: var(--white);
  border: 1px solid rgba(12, 26, 58, 0.04);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem;
  box-shadow: var(--shadow-sm);
  max-width: 100%;
  min-width: 0;
  overflow-wrap: anywhere;
}

.panel.narrow {
  max-width: min(560px, 100%);
}

/* Soft surface for lists — no outer card around cards */
.list-surface {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  max-width: 100%;
}

.block {
  min-width: 0;
  max-width: 100%;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin: 1rem 0 1.5rem;
  max-width: 100%;
}

.stat {
  background: var(--white);
  border: 1px solid rgba(12, 26, 58, 0.04);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  box-shadow: var(--shadow-sm);
  min-width: 0;
}

.stat-label {
  display: block;
  color: var(--stone-dim);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 0.35rem;
}

.stat strong {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.85rem);
  font-weight: 600;
  color: var(--navy);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.grid-2.tight { gap: 0.85rem; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: end;
  margin-bottom: 1rem;
  max-width: 100%;
}

.filters-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  align-items: stretch;
}

.filters-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
  align-items: end;
  min-width: 0;
}

.filters-row .field {
  min-width: 0;
}

.filters-submit {
  white-space: nowrap;
  height: fit-content;
  align-self: end;
}

.stack { display: grid; gap: 0.95rem; max-width: 100%; }
.field { display: grid; gap: 0.35rem; min-width: 0; max-width: 100%; }
.field span {
  color: var(--stone-dim);
  font-size: 0.86rem;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}
.field.compact {
  min-width: 0;
  flex: 1 1 12rem;
  max-width: 100%;
}

input, select, textarea {
  width: 100%;
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--ink);
  border-radius: 12px;
  padding: 0.75rem 0.9rem;
  font: inherit;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid rgba(43, 127, 212, 0.28);
  border-color: var(--blue);
}

.check {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--stone);
}

.check input { width: auto; }

.form-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
  margin-top: 0.35rem;
}

.divider {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.5rem 0;
}

.table-wrap {
  overflow-x: visible;
  max-width: 100%;
  min-width: 0;
}

table {
  width: 100%;
  max-width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  padding: 0.75rem 0.55rem;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--stone-dim);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.actions form { margin: 0; }
.inline-form { display: inline; margin: 0; }
.danger { color: var(--danger) !important; }

.pill {
  display: inline-block;
  margin-left: 0.4rem;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--stone-dim);
}

.pill-ok {
  color: var(--ok);
  border-color: rgba(13, 159, 110, 0.35);
}

.funeral-list { display: grid; gap: 0.65rem; }

.funeral-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.2rem;
  border-radius: var(--radius);
  border: 1px solid rgba(12, 26, 58, 0.04);
  background: var(--white);
  color: inherit;
  box-shadow: var(--shadow-sm);
  animation: rise 0.55s ease both;
  animation-delay: calc(var(--i, 0) * 60ms);
}

.funeral-row h3 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 600;
  color: var(--navy);
}

.funeral-row p { margin: 0; color: var(--stone-dim); font-size: 0.92rem; }
.funeral-row.muted { opacity: 0.78; }

.funeral-meta {
  text-align: right;
  display: grid;
  align-content: center;
  gap: 0.15rem;
}

.funeral-meta strong {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--navy);
}

.funeral-meta span { color: var(--stone-dim); font-size: 0.85rem; }

.memorial {
  padding: 0.35rem 0 1rem;
  border-bottom: 0;
  margin-bottom: 0.85rem;
}

.memorial-name {
  font-size: clamp(2rem, 6vw, 3.25rem);
  color: var(--navy);
  margin: 0.15rem 0 0.45rem;
}
.memorial-meta { color: var(--stone-dim); margin: 0 0 0.85rem; }
.cause { color: var(--stone); }
.cause span { color: var(--blue); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.75rem; margin-right: 0.5rem; }
.history { color: var(--stone); max-width: 42rem; font-size: 1.05rem; }

.progress {
  height: 0.55rem;
  background: #e8edf5;
  border-radius: 999px;
  overflow: hidden;
  margin: 0.45rem 0;
}

.progress span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--magenta));
  border-radius: inherit;
  transition: width 0.8s ease;
}

.progress.large { height: 0.85rem; margin: 1rem 0 0.5rem; }
.progress-caption { color: var(--stone-dim); margin: 0; }

.contrib-list { display: grid; gap: 0.55rem; }

.contrib-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--line);
  animation: rise 0.45s ease both;
  animation-delay: calc(var(--i, 0) * 40ms);
  flex-wrap: wrap;
  min-width: 0;
}

.contrib-row > div {
  min-width: 0;
  flex: 1 1 10rem;
}

.contrib-row strong { display: block; color: var(--navy); overflow-wrap: anywhere; }
.contrib-row span { color: var(--stone-dim); font-size: 0.86rem; overflow-wrap: anywhere; }
.contrib-amt { text-align: right; }
.contrib-amt strong {
  font-family: var(--font-display);
  font-size: 1.25rem;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 8rem) 1fr minmax(0, 5rem);
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.bar-label {
  min-width: 0;
}

.bar-label strong { display: block; font-size: 0.95rem; color: var(--navy); overflow-wrap: anywhere; }
.bar-label span { color: var(--stone-dim); font-size: 0.8rem; }
.bar-track {
  height: 0.55rem;
  background: #e8edf5;
  border-radius: 999px;
  overflow: hidden;
  min-width: 0;
}
.bar-track span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--blue), var(--navy-soft));
  border-radius: inherit;
}
.bar-value {
  text-align: right;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--navy);
  font-size: 0.95rem;
  overflow-wrap: anywhere;
}

.pay-group { margin-bottom: 1.5rem; }
.pay-group h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin: 0 0 0.75rem;
  color: var(--navy);
}

.pay-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.pay-row.is-paid { opacity: 0.95; }
.pay-who strong { display: block; }
.pay-who span { color: var(--stone-dim); font-size: 0.85rem; }
.pay-done {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  color: var(--ok);
}

.pay-form-quick {
  display: flex;
  flex-wrap: nowrap;
  gap: 0.45rem;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
}

.pay-form-quick input[type="number"] {
  width: 5.75rem;
  max-width: none;
  flex: 0 0 5.75rem;
}

.pay-form-quick .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}

.pay-form {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  max-width: 100%;
  min-width: 0;
}

.pay-board .pay-row {
  background: var(--white);
  border: 1px solid rgba(12, 26, 58, 0.06);
  border-radius: 14px;
  padding: 0.85rem 0.95rem;
  margin-bottom: 0.55rem;
  border-bottom: 1px solid rgba(12, 26, 58, 0.06);
}

.pay-board .pay-row.is-paid {
  opacity: 0.92;
  background: rgba(250, 249, 246, 0.9);
}


.pay-form input[type="number"] { width: 6.5rem; max-width: 100%; }
.pay-form input[type="datetime-local"] { width: min(11.5rem, 100%); max-width: 100%; }
.pay-form input[type="text"] { width: min(8rem, 100%); max-width: 100%; }

.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 2rem 1rem;
}

.auth-panel {
  width: min(100%, 420px);
  background: var(--white);
  border: 1px solid rgba(12, 26, 58, 0.04);
  border-radius: calc(var(--radius) + 4px);
  padding: 1.75rem;
  box-shadow: var(--shadow);
}

.auth-panel .brand { margin-bottom: 1.25rem; }

.toast-stack {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 80;
  display: grid;
  gap: 0.5rem;
  width: min(calc(100% - 2rem), 360px);
}

.toast {
  padding: 0.85rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--white);
  box-shadow: var(--shadow);
  animation: rise 0.35s ease;
}

.toast-success { border-color: rgba(13, 159, 110, 0.4); }
.toast-error { border-color: rgba(196, 92, 106, 0.5); }

.reveal {
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2 { grid-template-columns: 1fr; }
  .bar-row { grid-template-columns: 1fr; gap: 0.3rem; }
  .bar-value { text-align: left; }
}

@media (max-width: 640px) {
  .stats-row { grid-template-columns: 1fr 1fr; gap: 0.65rem; }
  .fund-hero { padding: 1.15rem; border-radius: 18px; }
  .fund-hero-stats { gap: 0.4rem; }
  .quick-action { font-size: 0.62rem; }
  .info-strip { flex-direction: column; align-items: flex-start; }

  /* Tables → stacked cards (no sideways page scroll) */
  .table-wrap table {
    border-collapse: separate;
    border-spacing: 0;
  }

  .table-wrap thead {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .table-wrap tbody {
    display: grid;
    gap: 0.75rem;
  }

  .table-wrap tbody tr {
    display: grid;
    gap: 0.35rem;
    background: var(--white);
    border: 1px solid rgba(12, 26, 58, 0.06);
    border-radius: var(--radius-sm);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-sm);
  }

  .table-wrap tbody td {
    display: grid;
    grid-template-columns: minmax(5.5rem, 34%) 1fr;
    gap: 0.65rem;
    align-items: start;
    border: 0;
    padding: 0.28rem 0;
    text-align: left;
    min-width: 0;
  }

  .table-wrap tbody td::before {
    content: attr(data-label);
    color: var(--stone-dim);
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    line-height: 1.35;
  }

  .table-wrap tbody td:empty {
    display: none;
  }

  .table-wrap tbody td.actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.85rem 1rem;
    grid-template-columns: none;
    padding-top: 0.65rem;
    margin-top: 0.35rem;
    border-top: 1px solid var(--line);
  }

  .table-wrap tbody td.actions::before {
    display: none;
  }

  .contrib-amt,
  .funeral-meta { text-align: left; }

  .brand-name {
    font-size: clamp(2.4rem, 12vw, 4rem);
  }

  .install-banner-inner {
    border-radius: 16px;
  }

  .toast-stack {
    left: 1rem;
    right: 1rem;
    width: auto;
  }
}

.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 70;
  align-items: stretch;
  justify-content: space-around;
  height: var(--bottom-nav-h);
  padding: 0.35rem 0.4rem calc(0.35rem + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid rgba(12, 26, 58, 0.06);
  box-shadow: 0 -8px 24px rgba(12, 26, 58, 0.06);
  backdrop-filter: blur(20px);
}

.bottom-nav-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
  padding: 0.3rem 0.2rem;
  border: 0;
  background: none;
  color: var(--stone-dim);
  font: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s ease;
}

.bottom-nav-item svg {
  width: 1.35rem;
  height: 1.35rem;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  padding: 0.35rem 0.55rem;
  border-radius: 10px;
  box-sizing: content-box;
}

.bottom-nav-item span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bottom-nav-item.is-active,
.bottom-nav-item[aria-expanded="true"] {
  color: var(--navy);
}

.bottom-nav-item.is-active svg,
.bottom-nav-item[aria-expanded="true"] svg {
  background: var(--navy);
  stroke: #fff;
}

.bottom-nav-item .nav-badge {
  position: absolute;
  top: 0.05rem;
  right: 22%;
  min-width: 1.05rem;
  height: 1.05rem;
  font-size: 0.6rem;
  padding: 0 0.3rem;
}

@media (max-width: 720px) {
  .main {
    width: 100%;
    padding: 0.65rem 0.85rem calc(var(--bottom-nav-h) + 0.85rem + env(safe-area-inset-bottom));
  }

  .app-nav {
    width: calc(100% - 0.5rem);
    margin: 0.45rem auto 0;
    border-radius: 14px;
    padding: 0.65rem 0.8rem;
  }

  .page-head {
    margin: 0.55rem 0 0.75rem;
    align-items: flex-start;
  }

  .page-head .display {
    margin-bottom: 0.25rem;
  }

  .lede {
    margin-bottom: 0.55rem;
    font-size: 0.92rem;
  }

  .section {
    margin: 1rem 0;
  }

  .section-title {
    margin-bottom: 0.55rem;
  }

  .section-head {
    margin-bottom: 0.55rem;
  }

  .stats-row {
    gap: 0.5rem;
    margin: 0.5rem 0 0.85rem;
  }

  .stat {
    padding: 0.7rem 0.75rem;
    border-radius: 14px;
  }

  /* Only form cards keep a box — list panels go flat */
  .panel:not(.narrow) {
    background: transparent;
    border: 0;
    box-shadow: none;
    padding: 0;
    border-radius: 0;
  }

  .panel.narrow {
    padding: 1rem;
    border-radius: 16px;
    max-width: 100%;
  }

  .fund-hero {
    margin-bottom: 0.85rem;
    padding: 1.05rem 1rem;
    border-radius: 16px;
  }

  .bar-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.35rem 0.75rem;
  }

  .bar-track {
    grid-column: 1 / -1;
  }

  .bar-value {
    justify-self: end;
  }

  .quick-actions {
    margin-bottom: 0.85rem;
    gap: 0.35rem;
  }

  .info-strip {
    margin-bottom: 0.85rem;
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
  }

  .filters {
    margin-bottom: 0.75rem;
    gap: 0.55rem;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .filters .field.compact,
  .filters .field {
    flex: none;
    width: 100%;
    max-width: 100%;
  }

  .filters-row {
    grid-template-columns: 1fr;
  }

  .filters-submit {
    width: 100%;
  }

  .page-head .btn {
    width: 100%;
  }

  .table-wrap tbody {
    gap: 0.55rem;
  }

  .table-wrap tbody tr {
    padding: 0.75rem 0.85rem;
    border-radius: 14px;
  }

  .table-wrap tbody td {
    grid-template-columns: minmax(4.75rem, 30%) 1fr;
    gap: 0.45rem;
    padding: 0.2rem 0;
  }

  .contrib-row {
    padding: 0.7rem 0;
  }

  .list-surface .contrib-row,
  .list-surface .bar-row {
    padding-left: 0;
    padding-right: 0;
  }

  .bars.list-surface {
    padding: 0.15rem 0;
  }

  body.has-bottom-nav .main {
    padding-bottom: calc(var(--bottom-nav-h) + 0.85rem + env(safe-area-inset-bottom));
  }

  .app-nav {
    border-radius: 14px;
    flex-wrap: wrap;
  }
  .nav-toggle { display: inline-flex; }
  .nav-links {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    padding-top: 0.5rem;
  }
  .nav-links.is-open { display: flex; }
  .funeral-row { flex-direction: column; }
  .funeral-meta { text-align: left; }
  .pay-form input[type="datetime-local"],
  .pay-form input[type="text"],
  .pay-form input[type="number"] { width: 100%; }

  /* Keep amount + Mark paid on one line even on narrow phones */
  .pay-form-quick input[type="number"] {
    width: 5.75rem;
    max-width: none;
    flex: 0 0 5.75rem;
  }

  body.has-bottom-nav .nav-toggle { display: none; }

  body.has-bottom-nav .install-banner {
    bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
  }

  .bottom-nav {
    display: flex;
  }

  .quick-action-icon {
    width: 2.85rem;
    height: 2.85rem;
  }
}

.field-hint {
  font-size: 0.8rem;
  color: var(--stone-dim);
}

.nav-user {
  color: var(--stone-dim);
  font-size: 0.88rem;
  margin-right: 0.35rem;
}

.nav-user strong { color: var(--ink); font-weight: 500; }

.nav-badge {
  display: inline-grid;
  place-items: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.35rem;
  border-radius: 999px;
  background: var(--magenta);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 600;
}

.pill-new {
  color: var(--blue);
  border-color: rgba(43, 127, 212, 0.35);
  margin-left: 0.35rem;
}

.memorial-photo {
  margin: 0 0 1.25rem;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 360px;
  background: var(--bg-soft);
}

.memorial-photo img {
  display: block;
  width: 100%;
  height: 100%;
  max-height: 360px;
  object-fit: cover;
}

.photo-preview {
  display: grid;
  gap: 0.65rem;
}

.photo-preview img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.funeral-row:hover {
  border-color: rgba(43, 127, 212, 0.25);
  background: #fff;
}

/* Modal / bottom sheet */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: end center;
  padding: 0;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12, 26, 58, 0.45);
  backdrop-filter: blur(4px);
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 440px);
  max-height: min(92dvh, 640px);
  overflow-y: auto;
  background: var(--white);
  border-radius: 22px 22px 0 0;
  padding: 1.25rem 1.25rem calc(1.35rem + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px rgba(12, 26, 58, 0.2);
  animation: modalUp 0.28s ease;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.35rem;
}

.modal-head .section-title {
  margin: 0;
  font-size: 1.45rem;
}

.modal-close {
  width: 2.25rem;
  height: 2.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--bg-soft);
  color: var(--navy);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover {
  background: #e4e7f4;
}

body.modal-open {
  overflow: hidden;
}

@keyframes modalUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}

@media (min-width: 721px) {
  .modal {
    place-items: center;
    padding: 1.5rem;
  }

  .modal-sheet {
    border-radius: var(--radius);
    padding: 1.5rem;
    max-height: min(86vh, 640px);
  }
}

