:root {
  --blue-950: #0b1f4b;
  --blue-800: #123a8c;
  --blue-700: #165dff;
  --blue-600: #2874ff;
  --blue-100: #eaf2ff;
  --blue-50: #f5f8ff;
  --ink: #17223b;
  --muted: #67748e;
  --line: #e4e9f2;
  --surface: #ffffff;
  --canvas: #f7f9fc;
  --success: #0b8a61;
  --danger: #d93b5b;
  --shadow-sm: 0 1px 2px rgba(19, 38, 77, 0.06), 0 8px 24px rgba(19, 38, 77, 0.06);
  --shadow-lg: 0 24px 72px rgba(9, 28, 70, 0.22);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

button, input, textarea, select { font: inherit; }
button { color: inherit; }
button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(22, 93, 255, 0.2);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  z-index: 1000;
  top: 0;
  min-height: 70px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(110px, 1fr);
  align-items: center;
  gap: 20px;
  padding: 12px clamp(16px, 3vw, 42px);
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  isolation: isolate;
  box-shadow: 0 5px 18px rgba(19, 38, 77, .05);
}

.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 12px; }
.topbar-actions { justify-content: flex-end; }
.brand { border: 0; background: transparent; display: flex; align-items: center; gap: 10px; cursor: pointer; padding: 0; }
.brand-mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  color: white; font-size: 20px; font-weight: 800; letter-spacing: -0.04em;
  background: linear-gradient(145deg, var(--blue-700), #4895ff); box-shadow: 0 8px 20px rgba(22, 93, 255, .25);
}
.brand-name { font-weight: 800; letter-spacing: -0.03em; font-size: 18px; }

.icon-button, .avatar-button {
  width: 42px; height: 42px; border: 1px solid var(--line); background: var(--surface); border-radius: 13px;
  display: grid; place-items: center; cursor: pointer; transition: .18s ease;
}
.icon-button:hover, .avatar-button:hover { border-color: #b7c8eb; background: var(--blue-50); transform: translateY(-1px); }
#menuButton { gap: 4px; padding: 11px; }
#menuButton span { display: block; width: 18px; height: 2px; background: var(--ink); border-radius: 2px; }
.search-trigger span { font-size: 29px; line-height: 1; transform: rotate(-15deg); }
.avatar-button { overflow: hidden; border: 2px solid white; box-shadow: 0 0 0 2px var(--blue-100); background: var(--blue-700); color: white; font-weight: 800; }
.avatar-button img { width: 100%; height: 100%; object-fit: cover; }

.pinned-shortcuts { display: flex; align-items: center; justify-content: center; gap: 6px; }
.shortcut {
  display: flex; align-items: center; gap: 7px; padding: 9px 12px; border: 0; border-radius: 12px;
  background: transparent; color: var(--muted); font-weight: 700; font-size: 14px; cursor: pointer;
}
.shortcut:hover, .shortcut.active { background: var(--blue-100); color: var(--blue-700); }
.mini-count { min-width: 19px; height: 19px; display: inline-grid; place-items: center; margin-left: auto; padding: 0 5px; border-radius: 99px; color: white; background: var(--blue-700); font-size: 10px; font-weight: 900; }
.shortcut .mini-count { margin-left: 2px; }

.drawer { position: fixed; z-index: 1200; top: 0; left: 0; bottom: 0; width: min(390px, calc(100vw - 24px)); padding: 24px; background: white; box-shadow: var(--shadow-lg); transform: translateX(-105%); transition: transform .24s ease; overflow-y: auto; }
.drawer.open { transform: translateX(0); }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.drawer h2 { margin: 3px 0 0; font-size: 25px; letter-spacing: -0.04em; }
.eyebrow { margin: 0; color: var(--blue-700); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.drawer-note { display: flex; gap: 12px; padding: 14px; margin: 22px 0; border-radius: 14px; color: var(--blue-800); background: var(--blue-50); font-size: 13px; line-height: 1.45; }
.drawer-note p { margin: 0; }
.drawer-note span { color: var(--blue-700); }
.drawer-nav { display: grid; gap: 7px; }
.nav-wrap { display: grid; grid-template-columns: 1fr 42px; gap: 6px; }
.nav-row { min-width: 0; min-height: 48px; display: flex; align-items: center; gap: 13px; padding: 0 14px; border: 0; border-radius: 12px; background: transparent; cursor: pointer; text-align: left; font-weight: 700; }
.nav-row:hover, .nav-row.active { background: var(--blue-50); color: var(--blue-700); }
.nav-icon { width: 24px; text-align: center; font-size: 18px; }
.pin-button { border: 0; background: transparent; border-radius: 12px; color: #9aa6bc; cursor: pointer; font-size: 18px; }
.pin-button:hover, .pin-button.pinned { background: var(--blue-100); color: var(--blue-700); }
.drawer-foot { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.scrim { position: fixed; z-index: 1100; inset: 0; border: 0; opacity: 0; visibility: hidden; transition: .2s ease; background: rgba(7, 20, 48, .48); }
.scrim.visible { opacity: 1; visibility: visible; }

.main-content { position: relative; z-index: 0; min-height: calc(100vh - 70px); isolation: isolate; }
.mobile-tabbar { display: none; }
.auth-mode { background: white; }
.auth-mode .topbar { display: none; }
.auth-mode .main-content { min-height: 100vh; }
.boot-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; gap: 13px; color: var(--blue-950); background: var(--blue-50); font-size: 17px; }
.auth-page { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(420px, .95fr); background: white; }
.auth-story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(34px, 6vw, 74px); color: white; background: linear-gradient(145deg, #0b2863, #165dff 70%, #59a8ff); }
.auth-story::before, .auth-story::after { content: ""; position: absolute; border-radius: 50%; background: rgba(255,255,255,.08); }
.auth-story::before { width: 480px; height: 480px; right: -180px; top: -180px; }
.auth-story::after { width: 310px; height: 310px; left: -120px; bottom: -140px; }
.auth-brand { position: relative; z-index: 1; display: flex; align-items: center; gap: 12px; font-size: 20px; }
.auth-brand .brand-mark { color: var(--blue-800); background: white; box-shadow: none; }
.auth-story-copy { position: relative; z-index: 1; max-width: 680px; margin: 80px 0; }
.auth-story-copy .eyebrow { color: #bcd6ff; }
.auth-story-copy h1 { margin: 15px 0 22px; font-size: clamp(48px, 6vw, 78px); line-height: .98; letter-spacing: -0.065em; }
.auth-story-copy > p:last-child { max-width: 610px; margin: 0; color: #deebff; font-size: 17px; line-height: 1.7; }
.auth-points { position: relative; z-index: 1; display: flex; gap: 20px; flex-wrap: wrap; color: #eaf2ff; font-size: 13px; font-weight: 750; }
.auth-form-side { display: grid; place-items: center; padding: 35px; background: #fbfcff; }
.auth-card { width: min(460px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 24px; background: white; box-shadow: 0 24px 70px rgba(17,43,92,.12); }
.auth-card h2 { margin: 7px 0 8px; font-size: 34px; letter-spacing: -0.05em; }
.auth-intro { margin: 0 0 24px; color: var(--muted); }
.auth-form { display: grid; gap: 15px; }
.auth-form input { min-height: 48px; }
.auth-submit { width: 100%; min-height: 49px; margin-top: 4px; }
.field-label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.auth-link { padding: 0; border: 0; color: var(--blue-700); background: transparent; cursor: pointer; font: inherit; font-size: 13px; font-weight: 800; }
.auth-help-link { justify-self: center; margin-top: -2px; }
.auth-link:hover, .auth-switch button:hover { text-decoration: underline; }
.auth-message { margin: -5px 0 18px; padding: 13px 14px; border: 1px solid #b9d5ff; border-radius: 12px; color: #143b79; background: #eff6ff; font-size: 14px; line-height: 1.5; }
.auth-switch { display: flex; justify-content: center; align-items: center; gap: 7px; margin-top: 22px; color: var(--muted); font-size: 14px; }
.auth-switch button { padding: 0; border: 0; color: var(--blue-700); background: transparent; cursor: pointer; font-weight: 850; }
.auth-note { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: #8894a9; font-size: 11px; line-height: 1.5; text-align: center; }
.auth-mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 30px; }
.page { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 36px 0 70px; }
.page-narrow { width: min(900px, calc(100% - 32px)); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 24px; }
.page-title { margin: 4px 0 0; font-size: clamp(30px, 5vw, 44px); line-height: 1; letter-spacing: -0.055em; }
.page-subtitle { max-width: 650px; margin: 10px 0 0; color: var(--muted); line-height: 1.6; }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.18fr .82fr; min-height: 350px; border-radius: 28px; color: white; background: linear-gradient(135deg, #0d2b65, #165dff 66%, #56a6ff); box-shadow: 0 22px 55px rgba(22,93,255,.17); }
.hero::after { content: ""; position: absolute; width: 340px; height: 340px; right: -80px; top: -100px; border-radius: 50%; background: rgba(255,255,255,.09); }
.hero-copy { position: relative; z-index: 1; padding: clamp(30px, 5vw, 62px); }
.hero .eyebrow { color: #bcd6ff; }
.hero h1 { max-width: 610px; margin: 12px 0 18px; font-size: clamp(40px, 6vw, 67px); line-height: .99; letter-spacing: -0.065em; }
.hero p { max-width: 560px; margin: 0 0 26px; color: #dce9ff; font-size: 17px; line-height: 1.6; }
.hero-panel { z-index: 1; align-self: center; margin: 32px 32px 32px 0; padding: 24px; border: 1px solid rgba(255,255,255,.22); border-radius: 20px; background: rgba(255,255,255,.11); backdrop-filter: blur(12px); }
.hero-panel h3 { margin: 0 0 15px; }
.hero-compact { min-height: 315px; }
.hero-compact .hero-copy { padding-top: 48px; padding-bottom: 48px; }
.hero-compact h1 { font-size: clamp(38px, 5vw, 58px); }
.flow-list { display: grid; gap: 13px; }
.flow-item { display: flex; align-items: center; gap: 12px; color: #edf4ff; font-size: 14px; }
.flow-number { width: 28px; height: 28px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 9px; color: var(--blue-800); background: white; font-weight: 800; }

.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 17px; border: 1px solid transparent; border-radius: 12px; font-weight: 800; cursor: pointer; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--blue-700); box-shadow: 0 8px 20px rgba(22, 93, 255, .2); }
.button-primary:hover { background: var(--blue-600); }
.button-light { color: var(--blue-800); background: white; }
.button-secondary { color: var(--blue-800); background: var(--blue-50); border-color: #d8e5ff; }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button-danger { color: var(--danger); background: #fff4f6; border-color: #ffd5de; }
.button-small { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 10px; }
.button[disabled] { opacity: .55; cursor: not-allowed; transform: none; }

.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 20px; }
.stat-card, .card { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-md); box-shadow: var(--shadow-sm); }
.stat-card { padding: 21px; }
.stat-label { color: var(--muted); font-size: 13px; font-weight: 700; }
.stat-value { display: block; margin-top: 8px; font-size: 29px; font-weight: 850; letter-spacing: -0.04em; }
.feed-welcome { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 24px 26px; border: 1px solid #dce6f7; border-radius: 22px; color: white; background: linear-gradient(125deg, #0d347e, #165dff 62%, #4b9aff); box-shadow: 0 16px 40px rgba(22,93,255,.15); }
.feed-welcome h1 { margin: 5px 0 4px; font-size: clamp(27px, 4vw, 38px); letter-spacing: -.045em; }
.feed-welcome p:last-child { margin: 0; color: #dce9ff; }
.feed-welcome .eyebrow { color: #c9dcff; }
.community-pills { display: flex; gap: 8px; }
.community-pills button { min-width: 78px; padding: 12px 11px; border: 1px solid rgba(255,255,255,.2); border-radius: 15px; color: white; background: rgba(255,255,255,.12); cursor: pointer; backdrop-filter: blur(8px); }
.community-pills button:hover { background: rgba(255,255,255,.2); }
.community-pills strong, .community-pills span { display: block; }
.community-pills strong { font-size: 22px; }
.community-pills span { margin-top: 2px; color: #dce9ff; font-size: 11px; font-weight: 750; }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 14px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow-sm); }
.search-field { position: relative; flex: 1; min-width: 220px; }
.search-field span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #8996ad; }
.search-field input { width: 100%; min-height: 44px; padding: 0 14px 0 40px; border: 1px solid var(--line); border-radius: 12px; color: var(--ink); background: var(--canvas); }
.tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: #eff3f8; }
.tab { min-height: 36px; padding: 0 13px; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 13px; font-weight: 800; cursor: pointer; }
.tab.active { color: var(--blue-800); background: white; box-shadow: 0 2px 8px rgba(19,38,77,.08); }

.people-grid, .church-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.person-card { overflow: hidden; }
.person-cover { height: 80px; background: linear-gradient(130deg, var(--blue-100), #d6e6ff); }
.person-body { padding: 0 18px 18px; }
.person-avatar { width: 68px; height: 68px; margin-top: -34px; display: grid; place-items: center; overflow: hidden; border: 4px solid white; border-radius: 20px; color: white; background: var(--blue-700); font-size: 24px; font-weight: 850; box-shadow: 0 3px 14px rgba(19,38,77,.12); }
.person-avatar img { width: 100%; height: 100%; object-fit: cover; }
.person-card h3 { margin: 13px 0 4px; font-size: 18px; }
.meta { color: var(--muted); font-size: 13px; line-height: 1.5; }
.person-bio { min-height: 40px; margin: 12px 0 17px; color: #46536d; font-size: 14px; line-height: 1.45; }
.card-actions { display: flex; gap: 8px; }
.card-actions .button { flex: 1; }

.church-card { padding: 20px; }
.church-icon { width: 50px; height: 50px; display: grid; place-items: center; border-radius: 14px; color: var(--blue-700); background: var(--blue-100); font-size: 22px; }
.church-card h3 { margin: 14px 0 5px; }
.church-card p { min-height: 42px; margin: 12px 0 18px; color: #4d5b74; font-size: 14px; line-height: 1.5; }

.feed-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 18px; margin-top: 20px; }
.composer { display: flex; gap: 14px; padding: 18px; }
.composer-avatar, .feed-avatar, .conversation-avatar { flex: 0 0 auto; display: grid; place-items: center; overflow: hidden; border-radius: 14px; color: white; background: var(--blue-700); font-weight: 850; }
.composer-avatar { width: 48px; height: 48px; }
.feed-avatar, .conversation-avatar { width: 42px; height: 42px; }
.composer-avatar img, .feed-avatar img, .conversation-avatar img { width: 100%; height: 100%; object-fit: cover; }
.composer-main { flex: 1; min-width: 0; }
.composer textarea { width: 100%; min-height: 82px; padding: 4px 2px; border: 0; resize: vertical; color: var(--ink); background: transparent; font-size: 15px; line-height: 1.5; }
.composer textarea:focus { outline: 0; }
.composer-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.media-picker { min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 11px; border: 1px solid var(--line); border-radius: 10px; color: var(--blue-800); background: var(--blue-50); cursor: pointer; font-size: 14px; font-weight: 750; }
.media-picker:hover { border-color: #9db8e6; background: var(--blue-100); }
.post-media-preview { position: relative; margin: 10px 0 4px; overflow: hidden; border: 1px solid var(--line); border-radius: 15px; background: #f5f8fc; }
.post-media-preview[hidden] { display: none; }
.post-media-preview img, .post-media-preview video { width: 100%; max-height: 440px; display: block; object-fit: contain; background: #08111f; }
.post-media-preview button { position: absolute; top: 10px; right: 10px; width: 34px; height: 34px; border: 0; border-radius: 50%; color: white; background: rgba(8,17,31,.82); cursor: pointer; font-size: 20px; }
.feed-list { display: grid; gap: 14px; margin-top: 14px; }
.feed-list .empty-state { min-height: 250px; }
.feed-card { padding: 19px; }
.feed-author { display: flex; align-items: center; gap: 12px; }
.feed-author .more-button { margin-left: auto; }
.feed-author-link { min-width: 0; display: flex; align-items: center; gap: 12px; padding: 0; border: 0; color: inherit; background: transparent; cursor: pointer; text-align: left; }
.feed-author-link > span { min-width: 0; }
.feed-author-link strong, .feed-author-link .meta { display: block; }
.feed-author-link:hover strong { color: var(--blue-700); text-decoration: underline; }
.person-profile-link { display: block; padding: 0; border: 0; background: transparent; cursor: pointer; text-align: left; }
.person-profile-link h3 { transition: color .15s ease; }
.person-profile-link:hover h3 { color: var(--blue-700); }
.feed-copy { margin: 18px 0; color: #35425c; line-height: 1.65; white-space: pre-wrap; }
.feed-media { width: calc(100% + 38px); max-height: 620px; display: block; margin: 14px -19px 0; object-fit: contain; background: #08111f; }
.feed-counts { min-height: 34px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.feed-counts button { padding: 0; border: 0; color: var(--muted); background: transparent; cursor: pointer; }
.feed-counts button:hover { color: var(--blue-700); text-decoration: underline; }
.feed-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding-top: 7px; border-top: 1px solid var(--line); }
.reaction-button { min-height: 40px; padding: 0 12px; border: 0; border-radius: 10px; color: var(--muted); background: transparent; cursor: pointer; font-weight: 800; }
.reaction-button:hover, .reaction-button.active { color: var(--blue-700); background: var(--blue-100); }
.more-button { width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 10px; color: #8895ac; background: transparent; cursor: pointer; font-size: 20px; }
.more-button:hover { color: var(--danger); background: #fff3f6; }
.quick-panel { position: sticky; top: 90px; padding: 20px; }
.quick-panel h3 { margin: 6px 0 16px; }
.quick-panel > button { width: 100%; display: flex; align-items: center; gap: 12px; padding: 13px 8px; border: 0; border-top: 1px solid var(--line); background: transparent; cursor: pointer; text-align: left; }
.quick-panel > button > span:first-child { width: 37px; height: 37px; display: grid; place-items: center; border-radius: 11px; color: var(--blue-700); background: var(--blue-100); font-size: 17px; }
.quick-panel strong, .quick-panel small { display: block; }
.quick-panel small { margin-top: 3px; color: var(--muted); }

.comment-list { max-height: min(52vh, 470px); overflow-y: auto; display: grid; gap: 14px; margin: 0 -4px 18px; padding: 4px; }
.comment-row { display: flex; align-items: flex-start; gap: 10px; }
.comment-avatar { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; overflow: hidden; border-radius: 50%; color: white; background: var(--blue-700); font-size: 12px; font-weight: 850; }
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-row > div { min-width: 0; }
.comment-bubble { padding: 10px 13px; border-radius: 5px 15px 15px; background: #f1f4f9; }
.comment-bubble strong { font-size: 13px; }
.comment-bubble p { margin: 4px 0 0; line-height: 1.45; white-space: pre-wrap; }
.comment-row small { display: block; margin: 4px 8px 0; color: var(--muted); font-size: 11px; }
.comment-empty { padding: 28px 14px; color: var(--muted); text-align: center; }
.comment-form { display: grid; grid-template-columns: 1fr auto; gap: 9px; padding-top: 16px; border-top: 1px solid var(--line); }
.comment-form input { min-width: 0; min-height: 42px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; }
.shared-post-preview { margin-bottom: 18px; padding: 15px; border-left: 4px solid var(--blue-700); border-radius: 5px 14px 14px 5px; background: var(--blue-50); }
.shared-post-preview p { margin: 7px 0; line-height: 1.5; }
.shared-post-preview span { color: var(--muted); font-size: 13px; }

.community-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.feature-card { position: relative; padding: 20px; overflow: hidden; }
.feature-icon { width: 52px; height: 52px; display: grid; place-items: center; border-radius: 15px; color: var(--blue-700); background: var(--blue-100); font-size: 23px; }
.feature-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 16px 0 0; }
.feature-card h3 { margin: 13px 0 8px; font-size: 19px; }
.feature-card > p { min-height: 64px; margin: 0 0 18px; color: #4d5b74; font-size: 14px; line-height: 1.5; }
.date-tile { position: absolute; top: 18px; right: 18px; width: 52px; padding: 7px 3px; border-radius: 13px; color: var(--blue-800); background: var(--blue-100); text-align: center; }
.date-tile strong, .date-tile span { display: block; }
.date-tile strong { font-size: 20px; }
.date-tile span { font-size: 10px; font-weight: 900; text-transform: uppercase; }
.event-card .feature-top { padding-right: 54px; }

.active-contacts { margin: 18px 0 14px; padding: 15px 16px 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: white; box-shadow: var(--shadow-sm); }
.active-contacts-title { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.active-contacts-title span { color: var(--muted); font-size: 12px; }
.active-contacts-scroll { display: flex; gap: 15px; overflow-x: auto; padding: 2px 1px 4px; scrollbar-width: none; }
.active-contacts-scroll::-webkit-scrollbar { display: none; }
.active-contacts-scroll > button { flex: 0 0 58px; display: grid; justify-items: center; gap: 5px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.active-contacts-scroll small { width: 58px; overflow: hidden; color: #40506b; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.active-avatar-wrap, .conversation-avatar-wrap { position: relative; display: inline-flex; flex: 0 0 auto; }
.active-avatar { width: 52px; height: 52px; display: grid; place-items: center; overflow: hidden; border: 2px solid white; border-radius: 50%; color: white; background: var(--blue-700); box-shadow: 0 0 0 2px var(--blue-100); font-weight: 850; }
.active-avatar img { width: 100%; height: 100%; object-fit: cover; }
.presence-dot { position: absolute; right: -1px; bottom: -1px; width: 12px; height: 12px; border: 2px solid white; border-radius: 50%; background: #aab3c2; }
.presence-dot.online { background: #16b875; }
.messaging-shell { min-height: 590px; display: grid; grid-template-columns: 310px minmax(0, 1fr); overflow: hidden; }
.conversation-list { border-right: 1px solid var(--line); background: #fbfcff; }
.conversation-title { display: flex; justify-content: space-between; align-items: center; padding: 19px; border-bottom: 1px solid var(--line); }
.conversation-row { width: 100%; display: flex; align-items: center; gap: 11px; padding: 13px 16px; border: 0; border-bottom: 1px solid #edf0f5; background: transparent; cursor: pointer; text-align: left; }
.conversation-row:hover, .conversation-row.active { background: var(--blue-100); }
.conversation-row > span:last-child { min-width: 0; }
.conversation-row strong, .conversation-row small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conversation-row small { max-width: 190px; margin-top: 4px; color: var(--muted); }
.conversation-empty { padding: 20px; color: var(--muted); font-size: 14px; }
.chat-panel { min-width: 0; min-height: 590px; display: flex; flex-direction: column; background: white; }
.chat-head { position: relative; z-index: 2; min-height: 72px; display: flex; align-items: center; gap: 12px; padding: 14px 19px; border-bottom: 1px solid var(--line); background: white; }
.chat-head > div:last-child strong, .chat-head > div:last-child span { display: block; }
.chat-head > div:last-child span { margin-top: 3px; color: var(--success); font-size: 12px; font-weight: 700; }
.chat-back { display: none; width: 38px; height: 38px; border: 0; border-radius: 11px; background: var(--blue-50); color: var(--blue-800); cursor: pointer; font-size: 30px; line-height: 1; }
.message-stream { flex: 1; min-height: 400px; max-height: 500px; overflow-y: auto; display: flex; flex-direction: column; justify-content: flex-end; gap: 10px; padding: 22px; background: linear-gradient(180deg,#fbfcff,#f6f9ff); }
.message-bubble { align-self: flex-start; max-width: min(75%, 520px); padding: 11px 13px 7px; border: 1px solid var(--line); border-radius: 5px 16px 16px 16px; background: white; cursor: pointer; touch-action: pan-y; -webkit-touch-callout: none; transition: transform .15s ease, box-shadow .15s ease; }
.message-bubble.mine { align-self: flex-end; color: white; border-color: var(--blue-700); border-radius: 16px 5px 16px 16px; background: var(--blue-700); }
.message-bubble:hover { box-shadow: 0 7px 18px rgba(22,93,255,.13); transform: translateY(-1px); }
.message-bubble:focus-visible { outline: 3px solid rgba(22,93,255,.28); outline-offset: 3px; }
.message-bubble p { margin: 0; line-height: 1.5; white-space: pre-wrap; }
.message-bubble p a { color: var(--blue-700); font-weight: 700; overflow-wrap: anywhere; }
.message-bubble.mine p a { color: white; }
.message-bubble.has-media { width: min(75%, 360px); padding: 5px 5px 7px; overflow: hidden; }
.message-bubble.has-media p { padding: 8px 8px 2px; }
.message-media { width: 100%; max-height: 360px; display: block; border-radius: 10px; object-fit: contain; background: #07101e; }
.message-meta { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 6px; }
.message-bubble.has-media .message-meta { padding: 0 8px; }
.message-meta > span:first-child { opacity: .68; font-size: 10px; }
.message-form { display: grid; grid-template-columns: auto 1fr auto; align-items: end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); background: white; }
.message-form textarea { min-width: 0; min-height: 44px; max-height: 140px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; resize: none; line-height: 1.45; }
.message-attachment, .message-send { min-width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%; cursor: pointer; font-weight: 850; }
.message-attachment { color: var(--blue-700); background: var(--blue-100); font-size: 25px; }
.message-send { padding: 0 14px; border-radius: 13px; color: white; background: var(--blue-700); font-size: 13px; }
.message-send:disabled { opacity: .58; cursor: wait; }
.message-media-preview { position: relative; display: flex; align-items: center; gap: 11px; padding: 10px 55px 10px 14px; border-top: 1px solid var(--line); background: #f8faff; }
.message-media-preview[hidden] { display: none; }
.message-media-preview img, .message-media-preview video { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; background: #07101e; }
.message-media-preview strong, .message-media-preview small { display: block; }
.message-media-preview small { margin-top: 3px; color: var(--muted); font-size: 12px; }
.message-media-preview > button { position: absolute; right: 14px; width: 32px; height: 32px; border: 0; border-radius: 50%; color: #8b2035; background: #fff0f3; cursor: pointer; font-size: 20px; }
.chat-placeholder { flex: 1; display: grid; place-items: center; align-content: center; padding: 30px; text-align: center; }
.chat-placeholder > span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: var(--blue-700); background: var(--blue-100); font-size: 26px; }
.chat-placeholder h3 { margin: 14px 0 5px; }
.chat-placeholder p { margin: 0 0 16px; color: var(--muted); }

.message-action-preview { max-height: 120px; overflow-y: auto; margin-bottom: 18px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 13px; color: #40506b; background: #f7f9fd; line-height: 1.5; white-space: pre-wrap; }
.message-action-list { display: grid; gap: 9px; }
.message-action-button { width: 100%; display: flex; align-items: center; gap: 13px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; color: var(--ink); background: white; cursor: pointer; text-align: left; }
.message-action-button:hover, .message-action-button:focus-visible { border-color: #9ebdff; background: var(--blue-100); outline: none; }
.message-action-button > span:first-child { flex: 0 0 40px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--blue-700); background: var(--blue-100); font-size: 20px; font-weight: 800; }
.message-action-button strong, .message-action-button small { display: block; }
.message-action-button small { margin-top: 3px; color: var(--muted); }
.message-action-button.danger { color: #b3261e; }
.message-action-button.danger > span:first-child { color: #b3261e; background: #fff0ef; }

.prayer-list { display: grid; gap: 14px; }
.prayer-card { padding: 22px; }
.prayer-card.answered { border-color: #bce8d8; background: #fbfffd; }
.prayer-head { display: flex; align-items: center; gap: 12px; }
.prayer-head .badge { margin-left: auto; }
.prayer-card h3 { margin: 18px 0 8px; }
.prayer-card > p { margin: 0; color: #46536d; line-height: 1.65; white-space: pre-wrap; }
.prayer-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.prayer-actions .more-button { margin-left: auto; }

.notification-list { overflow: hidden; }
.notification-row { width: 100%; display: flex; align-items: flex-start; gap: 13px; padding: 17px 19px; border: 0; border-bottom: 1px solid var(--line); background: white; cursor: pointer; text-align: left; }
.notification-row:last-child { border-bottom: 0; }
.notification-row:hover { background: var(--blue-50); }
.notification-row.unread { background: #f6f9ff; }
.notification-dot { width: 9px; height: 9px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: transparent; }
.notification-row.unread .notification-dot { background: var(--blue-700); box-shadow: 0 0 0 4px var(--blue-100); }
.notification-row strong, .notification-row small { display: block; }
.notification-row small { margin-top: 5px; color: var(--muted); }
.inline-empty { display: grid; place-items: center; min-height: 300px; padding: 30px; text-align: center; }
.inline-empty > span { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 18px; color: var(--blue-700); background: var(--blue-100); font-size: 25px; }
.inline-empty h3 { margin: 14px 0 5px; }
.inline-empty p { margin: 0 0 18px; color: var(--muted); }

.empty-state { grid-column: 1 / -1; display: grid; place-items: center; min-height: 360px; padding: 42px 24px; border: 1px dashed #cbd5e5; border-radius: 22px; background: rgba(255,255,255,.58); text-align: center; }
.empty-icon { width: 64px; height: 64px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 20px; color: var(--blue-700); background: var(--blue-100); font-size: 28px; }
.empty-state h3 { margin: 0 0 8px; font-size: 21px; }
.empty-state p { max-width: 480px; margin: 0 0 20px; color: var(--muted); line-height: 1.55; }

.profile-card { overflow: hidden; }
.cover { position: relative; height: 285px; background: linear-gradient(125deg, #d9e7ff, #f0f5ff); background-position: center; background-size: cover; }
.cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 55%, rgba(8,25,63,.23)); }
.cover-action { position: absolute; z-index: 1; right: 18px; bottom: 18px; }
.cover-actions { position: absolute; z-index: 1; right: 18px; bottom: 18px; display: flex; gap: 8px; }
.profile-details { position: relative; padding: 0 30px 30px; }
.profile-avatar { width: 132px; height: 132px; margin-top: -66px; position: relative; z-index: 2; display: grid; place-items: center; overflow: hidden; border: 6px solid white; border-radius: 36px; color: white; background: var(--blue-700); font-size: 42px; font-weight: 850; box-shadow: 0 8px 25px rgba(19,38,77,.16); }
.profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-edit { position: absolute; z-index: 3; left: 126px; top: 43px; width: 38px; height: 38px; border: 3px solid white; border-radius: 50%; color: var(--blue-700); background: var(--blue-100); cursor: pointer; font-weight: 900; }
.avatar-remove { position: absolute; z-index: 3; left: 158px; top: 74px; width: 34px; height: 34px; border: 3px solid white; border-radius: 50%; color: var(--danger); background: #fff1f4; cursor: pointer; font-size: 18px; font-weight: 900; }
.profile-heading { display: flex; justify-content: space-between; gap: 22px; align-items: flex-end; margin-top: 18px; }
.profile-heading h1 { margin: 0; font-size: 30px; letter-spacing: -0.04em; }
.profile-heading p { margin: 6px 0 0; color: var(--muted); }
.profile-about { max-width: 690px; margin: 22px 0 0; line-height: 1.65; color: #46536d; }
.profile-back { margin-bottom: 14px; padding: 9px 12px; border: 0; border-radius: 11px; color: var(--blue-800); background: var(--blue-100); cursor: pointer; font-weight: 800; }
.member-profile-card .cover { background: linear-gradient(125deg, #cfe0ff, #eef5ff 55%, #b8d4ff); }
.profile-facts { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 18px; }
.profile-facts span { padding: 7px 10px; border-radius: 999px; color: #425371; background: #f1f5fb; font-size: 13px; font-weight: 700; }
.member-posts-head { margin: 28px 0 12px; }
.member-posts-head h2 { margin: 5px 0 0; font-size: 24px; letter-spacing: -.035em; }
.member-feed { width: min(680px, 100%); margin-right: auto; margin-left: auto; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.settings-card { padding: 22px; }
.settings-card h3 { margin: 0 0 8px; }
.settings-card p { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.55; }

.modal-backdrop { position: fixed; z-index: 1300; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(7,20,48,.62); backdrop-filter: blur(5px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(610px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 26px; border-radius: 22px; background: white; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 22px; }
.modal-head h2 { margin: 3px 0 0; font-size: 25px; letter-spacing: -0.04em; }
.modal-close { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: white; cursor: pointer; font-size: 22px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.field { display: grid; gap: 7px; }
.field-full { grid-column: 1 / -1; }
.field label { color: #39465f; font-size: 13px; font-weight: 800; }
.field input, .field textarea, .field select { width: 100%; border: 1px solid #d9e0eb; border-radius: 11px; padding: 11px 12px; color: var(--ink); background: white; }
.field textarea { min-height: 95px; resize: vertical; }
.check-field { align-content: end; padding-bottom: 10px; }
.check-field label { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check-field input { width: 17px; height: 17px; accent-color: var(--blue-700); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 23px; }
.form-hint { color: var(--muted); font-size: 12px; }

.photo-workspace { display: grid; gap: 18px; }
.upload-drop { display: grid; place-items: center; gap: 8px; min-height: 120px; border: 1px dashed #b8c6dd; border-radius: 16px; color: var(--muted); background: var(--blue-50); cursor: pointer; text-align: center; padding: 20px; }
.upload-drop strong { color: var(--blue-800); }
.crop-stage { position: relative; overflow: hidden; width: 100%; border-radius: 16px; background: #dfe6f2; }
.crop-stage.cover-preview { aspect-ratio: 16 / 6; }
.crop-stage.avatar-preview { width: 270px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; border-radius: 50%; }
.crop-stage img { position: absolute; width: 100%; height: 100%; object-fit: cover; user-select: none; pointer-events: none; }
.sliders { display: grid; gap: 12px; }
.slider-row { display: grid; grid-template-columns: 86px 1fr 40px; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }
.slider-row input { accent-color: var(--blue-700); }

.global-results { display: grid; gap: 9px; margin-top: 14px; }
.result-row { width: 100%; display: flex; align-items: center; gap: 13px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; background: white; cursor: pointer; text-align: left; }
.result-row:hover { border-color: #b8cdf6; background: var(--blue-50); }
.result-icon { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 12px; color: var(--blue-700); background: var(--blue-100); font-weight: 850; }

.toast-region { position: fixed; z-index: 1400; right: 20px; bottom: 20px; display: grid; gap: 9px; }
.toast { max-width: 330px; padding: 13px 16px; border-radius: 12px; color: white; background: var(--blue-950); box-shadow: var(--shadow-lg); font-size: 14px; animation: toastIn .22s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } }

.badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; color: var(--blue-800); background: var(--blue-100); font-size: 12px; font-weight: 800; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 900px) {
  .auth-page { grid-template-columns: 1fr; }
  .auth-story { display: none; }
  .auth-mobile-brand { display: flex; }
  .topbar { grid-template-columns: 1fr auto; }
  .pinned-shortcuts { order: 3; grid-column: 1 / -1; justify-content: flex-start; overflow-x: auto; padding-top: 2px; }
  .hero { grid-template-columns: 1fr; }
  .hero-panel { margin: 0 30px 30px; }
  .people-grid, .church-grid { grid-template-columns: repeat(2, 1fr); }
  .community-grid { grid-template-columns: repeat(2, 1fr); }
  .feed-layout { grid-template-columns: 1fr; }
  .quick-panel { position: static; }
}

@media (max-width: 640px) {
  .auth-form-side { align-items: start; padding: 20px 14px; }
  .auth-card { padding: 28px 22px; border: 0; box-shadow: none; }
  .auth-card h2 { font-size: 30px; }
  .auth-switch { align-items: flex-start; flex-direction: column; }
  .topbar { top: 0; min-height: calc(64px + env(safe-area-inset-top)); padding: calc(10px + env(safe-area-inset-top)) 14px 10px; gap: 8px; border-bottom-color: #dfe5ef; background: #fff; }
  .brand-name { display: none; }
  .main-content { padding-bottom: calc(76px + env(safe-area-inset-bottom)); }
  .page { width: min(100% - 20px, 1180px); padding-top: 14px; padding-bottom: 28px; }
  .mobile-tabbar { position: fixed; z-index: 1050; right: 0; bottom: 0; left: 0; min-height: calc(64px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 5px env(safe-area-inset-bottom); border-top: 1px solid #dde4ef; background: rgba(255,255,255,.96); box-shadow: 0 -8px 24px rgba(19,38,77,.08); backdrop-filter: blur(16px); }
  .mobile-tabbar button { position: relative; display: grid; place-items: center; align-content: center; gap: 2px; padding: 3px; border: 0; border-radius: 12px; color: #66738a; background: transparent; cursor: pointer; }
  .mobile-tabbar button > span { font-size: 22px; line-height: 1; }
  .mobile-tabbar small { font-size: 10px; font-weight: 800; }
  .mobile-tabbar button.active { color: var(--blue-700); background: var(--blue-50); }
  .mobile-tabbar i { position: absolute; top: 2px; left: calc(50% + 7px); min-width: 17px; height: 17px; display: grid; place-items: center; padding: 0 4px; border: 2px solid white; border-radius: 99px; color: white; background: #e3415e; font-size: 9px; font-style: normal; font-weight: 900; }
  .mobile-tabbar i[hidden], .auth-mode .mobile-tabbar { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .hero-copy { padding: 32px 24px; }
  .hero h1 { font-size: 42px; }
  .hero-panel { margin: 0 20px 20px; }
  .feed-welcome { display: block; padding: 18px; border-radius: 19px; }
  .feed-welcome h1 { font-size: 29px; }
  .feed-welcome > div:first-child > p:last-child { display: none; }
  .community-pills { margin-top: 14px; }
  .community-pills button { flex: 1; min-width: 0; padding: 9px 7px; }
  .stats-strip, .people-grid, .church-grid, .community-grid, .settings-grid { grid-template-columns: 1fr; }
  .tabs { width: 100%; overflow-x: auto; }
  .tab { flex: 1; white-space: nowrap; }
  .form-grid { grid-template-columns: 1fr; }
  .field-full { grid-column: auto; }
  .cover { height: 210px; }
  .profile-details { padding: 0 20px 24px; }
  .profile-heading { align-items: flex-start; flex-direction: column; }
  .slider-row { grid-template-columns: 70px 1fr 34px; }
  .messages-page { width: 100%; padding: 18px 12px 0; }
  .messages-page .page-head { padding: 0 2px; }
  .active-contacts { margin: 14px 0 12px; border-radius: 17px; }
  .messaging-shell { min-height: 0; grid-template-columns: 1fr; border-radius: 18px 18px 0 0; }
  .conversation-list { max-height: none; overflow-y: visible; border-right: 0; border-bottom: 0; }
  .chat-panel { min-height: calc(100dvh - 82px - env(safe-area-inset-top)); }
  .messages-page:not(.mobile-chat-open) .chat-panel { display: none; }
  .messages-page.mobile-chat-open { padding: 0; }
  .messages-page.mobile-chat-open > .page-head, .messages-page.mobile-chat-open > .active-contacts, .messages-page.mobile-chat-open .conversation-list { display: none; }
  .messages-page.mobile-chat-open .messaging-shell { border: 0; border-radius: 0; box-shadow: none; }
  .messages-page.mobile-chat-open .chat-panel { height: calc(100dvh - 64px - env(safe-area-inset-top)); min-height: 0; }
  .chat-head { flex: 0 0 auto; min-height: 68px; padding: 11px 14px; box-shadow: 0 4px 14px rgba(19,38,77,.05); }
  .chat-back { display: grid; place-items: center; }
  .message-stream { min-height: 0; max-height: none; padding: 16px 12px; }
  .message-bubble { max-width: 84%; }
  .message-bubble.has-media { width: min(84%, 330px); max-width: 84%; }
  .message-form { position: sticky; bottom: 0; z-index: 4; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
  .message-form textarea { font-size: 16px; }
  .message-media-preview { flex: 0 0 auto; }
  .feed-layout { margin-top: 12px; }
  .composer { align-items: flex-start; padding: 14px; border-radius: 18px; }
  .composer-avatar { width: 42px; height: 42px; border-radius: 50%; }
  .composer textarea { min-height: 60px; font-size: 16px; }
  .composer-foot { align-items: stretch; flex-wrap: wrap; }
  .composer-foot .meta { width: 100%; }
  .media-picker { justify-content: center; }
  .feed-list { gap: 10px; margin-top: 10px; }
  .feed-card { padding: 14px; border-radius: 18px; }
  .feed-avatar { border-radius: 50%; }
  .feed-copy { margin: 14px 2px; font-size: 15px; line-height: 1.55; }
  .feed-media { width: calc(100% + 28px); max-height: 72vh; margin-right: -14px; margin-left: -14px; }
  .feed-counts { min-height: 38px; }
  .feed-actions { gap: 1px; }
  .reaction-button { padding: 0 5px; font-size: 13px; }
  .quick-panel { display: none; }
  .member-profile-page { padding-top: 12px; }
  .member-profile-card .cover { height: 170px; }
  .member-profile-card .profile-details { padding: 0 18px 22px; }
  .member-profile-card .profile-avatar { width: 104px; height: 104px; margin-top: -52px; border-radius: 28px; font-size: 34px; }
  .member-profile-card .profile-heading { gap: 14px; }
  .member-profile-card .profile-heading h1 { font-size: 27px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal { width: 100%; max-height: min(88dvh, 760px); padding: 22px 18px calc(22px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
  .toast-region { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; }
  .toast { max-width: none; }
  .prayer-head { align-items: flex-start; flex-wrap: wrap; }
  .prayer-head .badge { margin-left: 0; }
}
