/* =========================================================================
   Churches Directory — Design System
   Theme: "Sanctuary" — warm, welcoming faith-discovery platform
   ========================================================================= */

/* --- Tokens --------------------------------------------------------------- */
:root {
    --bg: #f3f0fa;
    --bg-soft: #faf8ff;
    --surface: #ffffff;
    --ink: #1b1230;
    --text: #2a2140;
    --muted: #6d6490;
    --line: #e7e1f4;
    --line-strong: #d2c8ea;

    --primary: #7c3aed;
    --primary-strong: #5b21b6;
    --primary-soft: #f1e9fe;
    --amber: #d97706;
    --amber-soft: #fef3c7;
    --teal: #0f766e;
    --teal-soft: #ccfbf1;
    --rose: #be185d;
    --rose-soft: #fce7f3;
    --danger: #e11d48;
    --danger-soft: #ffe4e6;
    --ok: #059669;
    --ok-soft: #d1fae5;

    --shadow-sm: 0 1px 2px rgba(27, 18, 48, 0.05);
    --shadow: 0 14px 38px rgba(27, 18, 48, 0.1);
    --shadow-lg: 0 30px 80px rgba(27, 18, 48, 0.22);

    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 22px;
    --radius-xl: 28px;

    --font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Sora", "Manrope", ui-sans-serif, system-ui, sans-serif;
}

/* Dark theme adjustments (driven by the global #app-window-menu theme switch) */
html[data-bs-theme="dark"] {
    --bg: #120e1f;
    --bg-soft: #181226;
    --surface: #1e1730;
    --ink: #f4efff;
    --text: #e6dff7;
    --muted: #a99fc9;
    --line: #32284a;
    --line-strong: #453865;
    --primary-soft: #2a1e4f;
    --amber-soft: #3a2a12;
    --teal-soft: #0d332f;
    --rose-soft: #3a1830;
    --danger-soft: #43101f;
    --ok-soft: #0d3327;
    --shadow: 0 14px 38px rgba(0, 0, 0, 0.45);
}

/* --- Reset & base ----------------------------------------------------------- */
* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
    font-family: var(--font-body);
    color: var(--text);
    background:
        radial-gradient(54% 42% at 6% -4%, rgba(124, 58, 237, 0.16), transparent 62%),
        radial-gradient(48% 38% at 96% 2%, rgba(217, 119, 6, 0.12), transparent 60%),
        radial-gradient(40% 34% at 50% 108%, rgba(15, 118, 110, 0.08), transparent 60%),
        var(--bg);
    background-attachment: fixed;
}

h1,
h2,
h3 {
    font-family: var(--font-display);
    letter-spacing: -0.015em;
}

button {
    font: inherit;
}

/* --- Top app bar ------------------------------------------------------------ */
.topbar {
    position: sticky;
    top: 0;
    z-index: 90;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(14px) saturate(160%);
    -webkit-backdrop-filter: blur(14px) saturate(160%);
    border-bottom: 1px solid rgba(231, 225, 244, 0.9);
}

html[data-bs-theme="dark"] .topbar {
    background: rgba(18, 14, 31, 0.72);
    border-bottom-color: rgba(50, 40, 74, 0.9);
}

.topbar-inner {
    width: min(1320px, calc(100% - 2rem));
    margin: 0 auto;
    min-height: 64px;
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--font-display);
    font-weight: 700;
    letter-spacing: 0.01em;
    color: var(--ink);
    font-size: 1.05rem;
}

.brand-mark {
    display: inline-grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #a855f7 55%, var(--amber));
    color: #fff;
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.05rem;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
}

.viewswitch {
    display: flex;
    gap: 0.3rem;
    padding: 0.3rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    margin-left: auto;
}

.viewswitch button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 0;
    border-radius: 999px;
    padding: 0.5rem 0.9rem;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.84rem;
    cursor: pointer;
    transition: 0.18s ease;
}

.viewswitch button.is-active {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.35);
}

.vs-icon {
    font-size: 1rem;
    line-height: 1;
}

/* --- Hero -------------------------------------------------------------------- */
.hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius-xl);
    color: #fff;
    background:
        radial-gradient(80% 150% at 8% -30%, rgba(168, 85, 247, 0.55), transparent 62%),
        radial-gradient(70% 130% at 96% -20%, rgba(217, 119, 6, 0.4), transparent 58%),
        linear-gradient(135deg, #1b1033, #31175c 50%, #0f3a38);
    box-shadow: var(--shadow);
}

.panel>.hero {
    margin-bottom: 1.1rem;
}

.hero-inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: clamp(2.2rem, 5vw, 4rem);
    z-index: 1;
}

.hero-copy {
    flex: 1 1 58%;
    max-width: 660px;
}

.kicker {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #fcd34d;
    margin-bottom: 0.9rem;
}

.kicker-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #fcd34d;
    box-shadow: 0 0 0 4px rgba(252, 211, 77, 0.25);
}

.hero h1 {
    font-size: clamp(1.7rem, 3.6vw, 2.7rem);
    line-height: 1.15;
    margin: 0 0 0.9rem;
    color: #fff;
}

.hero h1 em {
    font-style: normal;
    color: #fcd34d;
}

/* The belt's duplicate copy only appears on small screens; on desktop the
   h1 renders as a single, normally-wrapping line. */
.hero h1 .marquee-item[aria-hidden="true"] {
    display: none;
}

/* h1 marquee belt on small screens: the duplicated h1 text is one seamless,
   endlessly-scrolling conveyor; translating -50% = exactly one copy + gap. */
@keyframes heroBelt {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-50%);
    }
}

.hero p {
    margin: 0 0 1.4rem;
    color: rgba(255, 255, 255, 0.82);
    line-height: 1.65;
    font-size: 0.98rem;
}

.hero-cta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 1.3rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    border: 1px solid transparent;
    border-radius: 999px;
    padding: 0.6rem 1.15rem;
    font-weight: 700;
    font-size: 0.88rem;
    cursor: pointer;
    transition: 0.18s ease;
    text-decoration: none;
    color: var(--text);
    background: var(--surface);
}

.btn-hero {
    background: #fff;
    color: #31175c;
    box-shadow: 0 10px 26px rgba(0, 0, 0, 0.25);
}

.btn-hero:hover {
    transform: translateY(-2px);
}

.btn-hero-ghost {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    border-color: rgba(255, 255, 255, 0.35);
}

.btn-hero-ghost:hover {
    background: rgba(255, 255, 255, 0.22);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), #8b5cf6);
    color: #fff;
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 12px 26px rgba(124, 58, 237, 0.4);
}

.btn-alt {
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-color: var(--line-strong);
}

.btn-alt:hover {
    background: var(--surface);
}

.btn-plain {
    background: transparent;
    color: var(--muted);
    border-color: var(--line);
}

.btn-plain:hover {
    color: var(--primary-strong);
    border-color: var(--line-strong);
}

.btn-danger {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.btn-danger:hover {
    background: var(--danger);
    color: #fff;
}

.hero-trust {
    display: flex;
    flex-wrap: wrap;
    gap: 0.9rem;
}

.trust-item {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.85);
}

.trust-check {
    display: inline-grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    background: rgba(252, 211, 77, 0.25);
    color: #fcd34d;
    font-size: 0.72rem;
    font-weight: 800;
}

.hero-art {
    position: relative;
    flex: 0 0 34%;
    min-width: 220px;
    min-height: 260px;
}

.art-sun {
    position: absolute;
    top: 4%;
    right: 8%;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, #fde68a, #f59e0b 70%);
    opacity: 0.9;
    box-shadow: 0 0 60px 10px rgba(245, 158, 11, 0.55);
}

.art-window {
    position: absolute;
    top: 12%;
    left: 50%;
    transform: translateX(-50%);
    width: 150px;
    height: 210px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 75px 75px 12px 12px;
    background:
        radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.5), transparent 40%),
        linear-gradient(160deg, rgba(124, 58, 237, 0.85), rgba(190, 24, 93, 0.75) 45%, rgba(217, 119, 6, 0.8));
    border: 6px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35), inset 0 0 30px rgba(255, 255, 255, 0.25);
    overflow: hidden;
}

.art-window::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        repeating-linear-gradient(90deg, transparent 0 34px, rgba(255, 255, 255, 0.22) 34px 36px),
        repeating-linear-gradient(0deg, transparent 0 34px, rgba(255, 255, 255, 0.22) 34px 36px);
    border-radius: inherit;
}

.art-cross {
    position: relative;
    z-index: 1;
    font-size: 3.2rem;
    color: #fff;
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.art-ground {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 18%;
    background: linear-gradient(to top, rgba(15, 118, 110, 0.55), transparent);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* --- Panel + headings -------------------------------------------------------- */
.shell {
    width: min(1320px, calc(100% - 2rem));
    margin: 1.2rem auto 3rem;
}

.panel.hidden {
    display: none;
}

.panel-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin: 1.6rem 0 1rem;
}

.panel-head h2 {
    margin: 0 0 0.2rem;
    color: var(--ink);
}

.panel-head p {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
}

.focus-pick {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.focus-pick label {
    font-size: 0.75rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* --- Custom church picker (replaces select#consoleChurch) -------------------- */
.church-picker {
    position: relative;
    min-width: min(320px, 78vw);
}

.church-picker-trigger {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    text-align: left;
    transition: 0.15s ease;
}

.church-picker-trigger:hover {
    border-color: var(--primary);
}

.church-picker-trigger:focus-visible,
.church-picker.is-open .church-picker-trigger {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.church-picker-value {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.church-picker-avatar {
    flex: 0 0 32px;
    width: 32px;
    height: 32px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #a855f7 55%, var(--amber));
    color: #fff;
    font-size: 0.95rem;
    box-shadow: 0 4px 10px rgba(124, 58, 237, 0.3);
}

.church-picker-text {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
}

.church-picker-text strong {
    color: var(--ink);
    font-size: 0.86rem;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.church-picker-text small {
    color: var(--muted);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.church-picker-chevron {
    flex: 0 0 auto;
    width: 9px;
    height: 9px;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg) translateY(-2px);
    transition: transform 0.2s ease;
}

.church-picker.is-open .church-picker-chevron {
    transform: rotate(-135deg) translateY(-2px);
}

.church-picker-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 120;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.church-picker-menu[hidden] {
    display: none;
}

.church-picker-search {
    padding: 0.55rem;
    border-bottom: 1px solid var(--line);
}

.church-picker-search input {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    padding: 0.45rem 0.65rem;
    font-size: 0.85rem;
}

.church-picker-search input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.church-picker-list,
#churchPickerList {
    list-style: none;
    margin: 0;
    padding: 0.35rem;
    padding-left: 0;
    max-height: 260px;
    overflow-y: auto;
}

.church-picker-option {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.5rem 0.6rem;
    border-radius: var(--radius-sm);
    cursor: pointer;
}

.church-picker-option:hover {
    background: var(--primary-soft);
}

.church-picker-option.is-selected {
    background: var(--primary-soft);
}

.church-picker-option .option-avatar {
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    display: inline-grid;
    place-items: center;
    border-radius: 9px;
    background: var(--primary-soft);
    color: var(--primary-strong);
    font-size: 0.85rem;
}

.church-picker-option.is-selected .option-avatar {
    background: linear-gradient(135deg, var(--primary), #a855f7);
    color: #fff;
}

.church-picker-option .option-main {
    display: flex;
    flex-direction: column;
    line-height: 1.2;
    min-width: 0;
    flex: 1;
}

.church-picker-option .option-name {
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.church-picker-option .option-sub {
    color: var(--muted);
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.church-picker-option .option-check {
    flex: 0 0 18px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--line-strong);
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 0.7rem;
    font-weight: 900;
}

.church-picker-option.is-selected .option-check {
    background: var(--primary);
    border-color: var(--primary);
}

.church-picker-option.is-selected .option-check::after {
    content: "✓";
}

.church-picker-empty {
    padding: 1rem;
    text-align: center;
    color: var(--muted);
    font-size: 0.85rem;
}

.church-picker-empty[hidden] {
    display: none;
}

/* --- Search card -------------------------------------------------------------- */
.search-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.2rem;
    box-shadow: var(--shadow-sm);
    margin-bottom: 1rem;
}

/* Collapsible search card header (shown on small screens only) */
.search-head {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}

.search-head-label {
    font-weight: 800;
    color: var(--ink);
    font-size: 0.9rem;
}

.filter-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--primary);
    color: #fff;
    font-size: 0.72rem;
    font-weight: 800;
    line-height: 1;
}

.filter-count:empty {
    display: none;
}

.btn-filters {
    padding: 0.45rem 0.9rem;
    font-size: 0.8rem;
}

.filters {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 0.9rem;
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.field.span-2 {
    grid-column: span 2;
}

.field.span-3 {
    grid-column: span 3;
}

.field label {
    font-size: 0.76rem;
    font-weight: 800;
    color: var(--muted);
    letter-spacing: 0.02em;
}

.field label small {
    font-weight: 600;
    color: var(--amber);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    padding: 0.55rem 0.75rem;
    font-size: 0.9rem;
    transition: 0.15s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.field textarea {
    min-height: 84px;
    resize: vertical;
}

.check-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    cursor: pointer;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
}

.check-label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
    margin: 0;
    border: 1.5px solid var(--line-strong);
    border-radius: 6px;
    background-color: var(--bg-soft);
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease, box-shadow 0.15s ease;
}

.check-label input[type="checkbox"]:hover {
    border-color: var(--primary);
}

.check-label input[type="checkbox"]:checked {
    background-color: var(--primary);
    border-color: var(--primary);
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='20 6 9 17 4 12'/></svg>");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 13px;
}

.check-label input[type="checkbox"]:focus-visible {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

/* --- Search results summary (merged footer of the search card) --------------- */
.search-results {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.6rem 1rem;
    margin-top: 1.05rem;
    padding-top: 0.9rem;
    border-top: 1px dashed var(--line-strong);
}

.results-count {
    display: inline-flex;
    align-items: center;
    gap: 0.7rem;
}

.results-count-icon {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 1.15rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #a855f7 55%, var(--amber));
    box-shadow: 0 6px 16px rgba(124, 58, 237, 0.32);
}

.results-count-copy {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.results-count-copy strong {
    font-size: 1.06rem;
    color: var(--ink);
    white-space: nowrap;
}

.results-count-copy small {
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.results-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.results-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.42rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    color: var(--text);
    font-weight: 700;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.results-chip-icon {
    opacity: 0.85;
    font-size: 0.9rem;
}

.results-chip-label {
    color: var(--muted);
    font-weight: 600;
}

.results-chip strong {
    color: var(--primary-strong);
    font-size: 0.92rem;
}

/* Near-me chip states (toggled by app.js) */
.results-chip-near {
    border-style: dashed;
    border-color: var(--line-strong);
}

.results-chip-near.is-on {
    background: var(--ok-soft);
    border-style: solid;
    border-color: var(--ok);
    color: var(--ok);
    box-shadow: 0 0 0 3px var(--ok-soft);
}

.results-chip-near.is-on .results-chip-icon {
    animation: nearPulse 2s ease-in-out infinite;
}

@keyframes nearPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.18);
    }
}

.results-chip-near.is-off {
    opacity: 0.85;
}

/* --- Listing grid -------------------------------------------------------------- */
.grid-listings {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1rem;
}

.listing-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.15rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
    box-shadow: var(--shadow-sm);
}

.listing-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--line-strong);
    transition-delay: 0ms;
    transition-duration: 0.2s;
}

/* --- Scroll-reveal entrance for listing cards -------------------------------- */
/* Cards start hidden (only when JS marks the grid as .reveal) and animate in as
   they scroll into view; the per-card `--i` staggers consecutive cards for a
   smooth cascade. */
.grid-listings.reveal .listing-card {
    opacity: 0;
    transform: translateY(26px) scale(0.985);
    transition:
        opacity 0.55s ease,
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        box-shadow 0.25s ease,
        border-color 0.25s ease;
    transition-delay: calc(var(--i, 0) * 55ms);
}

.grid-listings.reveal .listing-card.is-visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.grid-listings.reveal .listing-card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow);
    border-color: var(--line-strong);
    transition-delay: 0ms;
    transition-duration: 0.2s;
}

@media (prefers-reduced-motion: reduce) {
    .grid-listings.reveal .listing-card {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* --- Scroll-reveal entrance for console church rows ------------------------- */
.tight-list.reveal .entry {
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.45s ease,
        transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    transition-delay: calc(var(--i, 0) * 45ms);
}

.tight-list.reveal .entry.is-visible {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .tight-list.reveal .entry {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

.listing-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
}

.listing-title {
    margin: 0 0 0.15rem;
    font-size: 1.08rem;
    color: var(--ink);
}

.listing-sub {
    color: var(--muted);
    font-size: 0.83rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.2rem 0.6rem;
    font-size: 0.72rem;
    font-weight: 800;
    white-space: nowrap;
    background: var(--bg-soft);
    color: var(--muted);
}

.badge.match {
    background: var(--teal-soft);
    color: var(--teal);
    border-color: transparent;
}

.badge.denom {
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-color: transparent;
}

.badge.state-active {
    background: var(--ok-soft);
    color: var(--ok);
    border-color: transparent;
}

.badge.state-inactive {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.badge.state-new {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: transparent;
}

.badge.state-contacted {
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-color: transparent;
}

.badge.state-closed {
    background: var(--bg-soft);
    color: var(--muted);
    border-color: var(--line);
}

.badge.state-upcoming {
    background: var(--teal-soft);
    color: var(--teal);
    border-color: transparent;
}

.badge.state-completed {
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-color: transparent;
}

.badge.state-paused {
    background: var(--amber-soft);
    color: var(--amber);
    border-color: transparent;
}

.badge.state-ongoing {
    background: var(--teal-soft);
    color: var(--teal);
    border-color: transparent;
}

.badge.state-cancelled {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: transparent;
}

.badge.state-paid {
    background: var(--ok-soft);
    color: var(--ok);
    border-color: transparent;
}

.church-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.15rem 0;
}

.church-stats .stat {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.22rem 0.6rem;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text);
}

.church-stats .stat b {
    color: var(--primary-strong);
}

.member-line {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--muted);
    font-size: 0.8rem;
}

.amenities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}

.amenities span {
    font-size: 0.72rem;
    font-weight: 700;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 0.18rem 0.5rem;
    color: var(--muted);
}

.listing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 0.4rem;
}

.empty {
    color: var(--muted);
    font-size: 0.9rem;
    text-align: center;
    padding: 1.6rem 1rem;
    background: var(--bg-soft);
    border: 1px dashed var(--line-strong);
    border-radius: var(--radius);
}

.empty-icon {
    display: block;
    font-size: 1.6rem;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.empty-hint {
    display: block;
    margin-top: 0.35rem;
    font-weight: 700;
    color: var(--text);
}

.empty-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
    margin-top: 0.9rem;
}

/* --- Place banner (geo deep links shared with E-Tours) ------------------------ */
.place-banner {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.65rem;
    margin-bottom: 1rem;
    padding: 0.6rem 0.9rem;
    border: 1px solid var(--primary);
    border-radius: 999px;
    background: var(--primary-soft);
    font-size: 0.86rem;
    line-height: 1.3;
}

.place-banner[hidden] {
    display: none;
}

.place-banner-pin {
    font-size: 1rem;
    line-height: 1;
}

.place-banner-text {
    flex: 1 1 220px;
    min-width: 0;
    color: var(--text);
}

.place-banner-text strong {
    color: var(--primary-strong);
}

.place-banner-note {
    color: var(--muted);
}

.place-banner-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-left: auto;
}

.place-banner-actions .btn {
    white-space: nowrap;
    text-decoration: none;
}

/* --- Console KPIs ------------------------------------------------------------- */
.manager-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

/* --- Console KPI panels (selected church + overall) -------------------------- */
.console-kpis {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 1.2rem;
}

.kpi-panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.1rem;
}

.kpi-section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-bottom: 0.9rem;
}

.kpi-eyebrow {
    display: block;
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.kpi-church-name {
    margin: 0.25rem 0 0;
    font-size: 1.18rem;
    font-weight: 800;
    color: var(--ink);
    line-height: 1.2;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.7rem;
}

.kpi-overall {
    flex-basis: 100%;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: flex;
    align-items: stretch;
    gap: 0.5rem;
    margin-top: 0.15rem;
    padding-top: 0.65rem;
    padding-bottom: 0.3rem;
    border-top: 1px dashed var(--line);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.kpi-overall::-webkit-scrollbar {
    display: none;
}

.kpi-overall .kpi {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 0.15rem;
    min-width: 108px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-sm);
    padding: 0.45rem 0.7rem;
    white-space: nowrap;
    scroll-snap-align: start;
}

.kpi-overall .kpi label {
    display: block;
    margin: 0;
    font-size: 0.64rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    white-space: nowrap;
}

.kpi-overall .kpi strong {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--ink);
    font-family: var(--font-display);
    white-space: nowrap;
}

/* --- Church details tab ------------------------------------------------------ */
.church-details {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.details-head {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.details-avatar {
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    display: inline-grid;
    place-items: center;
    border-radius: 16px;
    font-size: 1.6rem;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), #a855f7 55%, var(--amber));
    box-shadow: 0 8px 20px rgba(124, 58, 237, 0.3);
}

.details-head-copy h3 {
    margin: 0;
    font-size: 1.25rem;
    color: var(--ink);
}

.details-head-copy p {
    margin: 0.15rem 0 0.4rem;
    color: var(--muted);
    font-size: 0.88rem;
}

.details-desc {
    margin: 0;
    color: var(--text);
    line-height: 1.7;
    font-size: 0.95rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
}

.details-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 0.6rem;
}

.detail-item {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
}

.detail-item label {
    display: block;
    font-size: 0.68rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted);
    margin-bottom: 0.2rem;
}

.detail-item strong {
    font-size: 0.9rem;
    color: var(--ink);
    overflow-wrap: anywhere;
}

.details-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.details-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: var(--primary-soft);
    color: var(--primary-strong);
    border-radius: 999px;
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 700;
}

.kpi {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    box-shadow: var(--shadow-sm);
}

.kpi label {
    display: block;
    font-size: 0.74rem;
    font-weight: 800;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.kpi strong {
    font-size: 1.35rem;
    color: var(--ink);
    font-family: var(--font-display);
}

/* --- Workspace ---------------------------------------------------------------- */
.workspace {
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 1rem;
    min-width: 0;
}

.workspace-rail {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 0.5rem;
    align-self: start;
    position: sticky;
    top: 84px;
}

.workspace-rail button {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    border: 0;
    background: transparent;
    color: var(--muted);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    font-weight: 700;
    font-size: 0.86rem;
    cursor: pointer;
    text-align: left;
    transition: 0.15s ease;
}

.workspace-rail button:hover {
    background: var(--bg-soft);
}

.workspace-rail button.is-active {
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.rail-icon {
    font-size: 1rem;
    line-height: 1;
}

.workspace-main {
    min-width: 0;
}

.tab-content {
    display: none;
}

.tab-content.is-active {
    display: block;
    animation: fadeIn 0.25s ease;
}

/* Members & Enquiries sub-nav (segmented control) */
.sub-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    margin-bottom: 1rem;
}

.sub-nav button {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.86rem;
    padding: 0.5rem 0.9rem;
    border-radius: calc(var(--radius-sm) - 3px);
    cursor: pointer;
    transition: 0.15s ease;
}

.sub-nav button:hover {
    color: var(--primary-strong);
}

.sub-nav button.is-active {
    background: var(--surface);
    color: var(--primary-strong);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.sub-nav-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.35rem;
    height: 1.35rem;
    padding: 0 0.35rem;
    font-size: 0.72rem;
    font-weight: 800;
    border-radius: 999px;
    background: var(--primary-soft);
    color: var(--primary-strong);
}

.sub-nav button.is-active .sub-nav-count {
    background: var(--primary);
    color: #fff;
}

.sub-content {
    display: none;
}

.sub-content.is-active {
    display: block;
    animation: fadeIn 0.25s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Boxes -------------------------------------------------------------------- */
.box {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.2rem;
    margin-bottom: 1rem;
    box-shadow: var(--shadow-sm);
    min-width: 0;
}

.box h3 {
    margin: 0 0 0.8rem;
    color: var(--ink);
    font-size: 1.02rem;
}

.box-block {
    margin-top: 1rem;
}

.box-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    margin-bottom: 0.8rem;
}

.box-head h3 {
    margin: 0;
}

.box-hint {
    display: block;
    color: var(--muted);
    font-size: 0.8rem;
}

.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    align-items: start;
}

.split-grid>.box {
    margin-bottom: 0;
}

/* --- Tight list / entries ------------------------------------------------------ */
.tight-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.entry {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.entry-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
}

.entry strong {
    color: var(--ink);
    font-size: 0.92rem;
}

.entry small {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.5;
}

.entry-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-top: 0.35rem;
}

.entry input,
.entry select {
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: var(--bg-soft);
    color: var(--text);
    padding: 0.45rem 0.6rem;
    font-size: 0.82rem;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.entry input::placeholder {
    color: var(--muted);
}

.entry input:focus,
.entry select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.15);
}

.entry .btn {
    padding: 0.4rem 0.8rem;
    font-size: 0.8rem;
}

/* --- Tables ------------------------------------------------------------------- */
.table-wrap {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 560px;
}

th,
td {
    text-align: left;
    padding: 0.6rem 0.7rem;
    border-bottom: 1px solid var(--line);
    font-size: 0.84rem;
    vertical-align: top;
}

th {
    color: var(--muted);
    font-weight: 800;
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
    background: var(--bg-soft);
}

td strong {
    color: var(--ink);
}

td small {
    color: var(--muted);
}

.divider {
    border: 0;
    border-top: 1px solid var(--line);
    margin: 1rem 0;
}

.receipt {
    background: var(--ok-soft);
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    padding: 0.8rem 1rem;
    font-size: 0.86rem;
    color: var(--ok);
    line-height: 1.6;
    margin-top: 1rem;
}

/* --- Modals ------------------------------------------------------------------- */
/* NOTE: scoped to :not(.fade) so we never override the framework's Bootstrap
   `.modal` styles (which use `.modal.fade`). The module's custom modals use a
   plain `.modal` element (no `.fade`), so they are the only ones styled here. */
.modal:not(.fade) {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(18, 12, 34, 0.55);
    backdrop-filter: blur(6px);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}

.modal:not(.fade).is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal.is-open {
    opacity: 1;
    pointer-events: auto;
}

.modal-card {
    width: min(520px, 100%);
    max-height: 92vh;
    overflow-y: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    padding: 1.3rem;
    transform: translateY(12px);
    transition: transform 0.2s ease;
}

.modal-card-wide {
    width: min(860px, 100%);
}

.modal:not(.fade).is-open .modal-card {
    transform: translateY(0);
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    margin-bottom: 0.9rem;
}

.modal-head h3 {
    margin: 0;
    color: var(--ink);
}

.lead-target {
    display: block;
    color: var(--muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.8rem;
}

.btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
}

.my-memberships-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-top: 0.75rem;
}

.mm-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    padding: 0.7rem 0.85rem;
    text-decoration: none;
    color: inherit;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.mm-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.12);
}

.mm-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.mm-main strong {
    color: var(--ink);
    font-size: 0.92rem;
}

.mm-main small {
    color: var(--muted);
    font-size: 0.8rem;
}

/* --- Church detail ------------------------------------------------------------ */
.church-detail {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Dedicated church profile page */
body.is-profile .viewswitch {
    display: none;
}

.profile-panel {
    max-width: 920px;
    margin: 0 auto;
}

.profile-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.detail-hero {
    background: linear-gradient(135deg, var(--primary-strong), #31175c 60%, #0f3a38);
    color: #fff;
    border-radius: var(--radius);
    padding: 1.2rem 1.3rem;
}

.detail-hero h4 {
    margin: 0 0 0.35rem;
    font-size: 1.3rem;
}

.detail-hero .detail-sub {
    color: rgba(255, 255, 255, 0.85);
    font-size: 0.86rem;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.6rem;
    margin-top: 0.8rem;
}

.detail-stat {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
}

.detail-stat label {
    display: block;
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 800;
}

.detail-stat strong {
    font-size: 0.98rem;
}

.detail-section {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
}

.detail-section h5 {
    margin: 0 0 0.7rem;
    color: var(--ink);
    font-size: 0.98rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.service-chip {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.4rem 0;
    border-bottom: 1px dashed var(--line);
    font-size: 0.84rem;
}

.service-chip:last-child {
    border-bottom: 0;
}

.service-day {
    flex: 0 0 74px;
    font-weight: 800;
    color: var(--primary-strong);
}

.service-time {
    font-weight: 700;
    color: var(--text);
    white-space: nowrap;
}

.service-meta {
    color: var(--muted);
    font-size: 0.78rem;
}

.event-item,
.announcement-item {
    padding: 0.55rem 0;
    border-bottom: 1px dashed var(--line);
}

.event-item:last-child,
.announcement-item:last-child {
    border-bottom: 0;
}

.event-item strong,
.announcement-item strong {
    color: var(--ink);
    display: block;
}

.event-item small,
.announcement-item small {
    color: var(--muted);
    line-height: 1.5;
    display: block;
}

/* --- Program progress --------------------------------------------------------- */
.program-item {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 0.85rem 1rem;
    margin-bottom: 0.7rem;
}

.program-item .entry-top {
    margin-bottom: 0.5rem;
}

.progress-track {
    height: 10px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
    margin: 0.4rem 0;
}

.progress-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--amber), var(--primary));
    transition: width 0.4s ease;
}

.program-meta {
    display: flex;
    justify-content: space-between;
    gap: 0.6rem;
    flex-wrap: wrap;
    font-size: 0.8rem;
    color: var(--muted);
}

.program-meta b {
    color: var(--primary-strong);
}

/* --- Toast -------------------------------------------------------------------- */
.toast {
    position: fixed;
    bottom: 1.4rem;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    z-index: 300;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 0.7rem 1.2rem;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
    box-shadow: var(--shadow-lg);
    opacity: 0;
    pointer-events: none;
    transition: 0.25s ease;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.err {
    background: var(--danger);
    color: #fff;
    border-color: transparent;
}

/* --- Responsive ---------------------------------------------------------------- */
@media (max-width: 980px) {
    .hero-inner {
        flex-direction: column;
        align-items: flex-start;
    }

    .hero-art {
        position: absolute;
        right: 1rem;
        bottom: 0;
        width: 140px;
        min-height: 170px;
        opacity: 0.5;
        z-index: 0;
    }

    .hero-copy {
        z-index: 1;
        max-width: 100%;
    }

    .filters {
        grid-template-columns: repeat(2, 1fr);
    }

    .field.span-2,
    .field.span-3 {
        grid-column: span 2;
    }

    .workspace {
        grid-template-columns: 1fr;
    }

    /* Rail stays horizontal: never wrap, scroll instead */
    .workspace-rail {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        position: static;
    }

    .workspace-rail::-webkit-scrollbar {
        display: none;
    }

    .workspace-rail button {
        flex: 0 0 auto;
        white-space: nowrap;
    }

    .split-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .filters {
        grid-template-columns: 1fr;
    }

    .field.span-2,
    .field.span-3 {
        grid-column: span 1;
    }

    .console-kpis {
        gap: 0.8rem;
        margin-bottom: 1rem;
    }

    .kpi-panel {
        padding: 0.85rem 0.9rem;
    }

    .kpi-section-head {
        align-items: stretch;
        flex-direction: column;
    }

    .kpi {
        min-width: 0;
    }

    .details-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* Overall stats cards snap horizontally on small screens */
    .kpi-overall {
        scroll-snap-type: x mandatory;
    }

    /* Add-forms: bottom sheet modals on small screens */
    .modal.add-modal {
        align-items: flex-end;
        padding: 0;
    }

    .modal.add-modal .modal-card {
        width: 100%;
        max-width: 100%;
        max-height: 88vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        padding: 1.1rem 1.1rem calc(1.1rem + env(safe-area-inset-bottom, 0px));
        transform: translateY(100%);
        transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1);
    }

    .modal.add-modal.is-open .modal-card {
        transform: translateY(0);
    }

    .grid-listings {
        grid-template-columns: 1fr;
    }

    /* Console church picker: full width on small screens */
    .focus-pick {
        width: 100%;
        margin-left: 0;
    }

    .church-picker {
        min-width: 0;
        width: 100%;
    }

    /* --- Console panel: small-screen redesign --- */
    .panel-head {
        align-items: stretch;
        flex-direction: column;
        gap: 0.75rem;
        margin-top: 1rem;
    }

    .panel-head #refreshConsole,
    .panel-head #registerChurch {
        width: 100%;
        justify-content: center;
    }

    .box {
        padding: 0.85rem 0.9rem;
        border-radius: var(--radius);
    }

    .box-head {
        align-items: stretch;
        flex-direction: column;
    }

    .box-head .btn {
        width: 100%;
        justify-content: center;
    }

    .kpi {
        padding: 0.7rem 0.8rem;
    }

    /* Members & Enquiries sub-nav: full-width segmented control */
    .sub-nav {
        display: flex;
        width: 100%;
    }

    .sub-nav button {
        flex: 1 1 auto;
        justify-content: center;
    }

    /* Rail becomes a horizontal, scrollable, sticky tab bar */
    .workspace-rail {
        flex-direction: row;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        position: sticky;
        top: 60px;
        z-index: 40;
        gap: 0.35rem;
        padding: 0.4rem;
    }

    .workspace-rail::-webkit-scrollbar {
        display: none;
    }

    .workspace-rail button {
        flex: 0 0 auto;
        white-space: nowrap;
        padding: 0.55rem 0.8rem;
    }

    /* Touch-friendly full-width row actions */
    .entry-actions .btn {
        flex: 1 1 auto;
        justify-content: center;
    }

    .table-wrap {
        -webkit-overflow-scrolling: touch;
    }

    /* Console panel sections keep horizontal padding on small screens */
    .panel[data-panel="console"] .panel-head,
    .panel[data-panel="console"] .console-kpis,
    .panel[data-panel="console"] .workspace {
        padding-left: 1rem;
        padding-right: 1rem;
    }

    .vs-label {
        display: none;
    }

    /* Full-bleed layout on small screens: no side margins, no rounded corners */
    .shell {
        width: 100%;
        margin: 0;
    }

    .hero,
    .search-card,
    .listing-card {
        border-radius: 0;
    }

    /* Collapsible search card: hidden by default, expands to a 2-col grid */
    .search-head {
        display: flex;
    }

    html.js .search-card .filters {
        display: none;
    }

    html.js .search-card.is-open .filters {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
    }

    html.js .search-card.is-open .field.span-2,
    html.js .search-card.is-open .field.span-3 {
        grid-column: span 2;
    }

    /* --- Compact hero: less vertical height on small screens --- */
    .hero-inner {
        padding: 1.6rem 1.25rem 1.9rem;
        gap: 1rem;
    }

    .hero h1 {
        font-size: 1.5rem;
        line-height: 1.2;
        margin-bottom: 0.7rem;
        /* keep on one line and clip the scrolling belt */
        overflow: hidden;
        white-space: nowrap;
    }

    .hero h1 .marquee-track {
        display: inline-flex;
        white-space: nowrap;
        animation: heroBelt 22s linear infinite;
        will-change: transform;
    }

    .hero h1 .marquee-item {
        white-space: nowrap;
        padding-right: 2.5rem;
    }

    .hero h1 .marquee-item[aria-hidden="true"] {
        display: inline;
    }

    @media (prefers-reduced-motion: reduce) {
        .hero h1 {
            white-space: normal;
            overflow: visible;
        }

        .hero h1 .marquee-track {
            display: block;
            animation: none;
        }

        .hero h1 .marquee-item {
            padding-right: 0;
        }

        .hero h1 .marquee-item[aria-hidden="true"] {
            display: none;
        }
    }

    .hero p {
        /* keep the base 0.98rem font size — only tighten spacing */
        line-height: 1.55;
        margin-bottom: 1.05rem;
    }

    .kicker {
        font-size: 0.74rem;
        margin-bottom: 0.65rem;
    }

    .hero-cta {
        gap: 0.6rem;
        margin-bottom: 1.05rem;
    }

    .hero-cta .btn {
        padding: 0.55rem 1.05rem;
        font-size: 0.85rem;
    }

    .hero-trust {
        gap: 0.55rem 1rem;
    }

    .trust-item {
        font-size: 0.78rem;
    }

    .trust-check {
        width: 16px;
        height: 16px;
        font-size: 0.7rem;
    }

    /* The decorative window art stays visible on small screens via the
       ≤980px rule (absolute, bottom-right, 0.5 opacity, behind the copy). */

    /* Place banner: stack its actions so nothing gets clipped */
    .place-banner {
        border-radius: var(--radius);
    }

    .place-banner-actions {
        width: 100%;
        margin-left: 0;
    }

    .place-banner-actions .btn {
        flex: 1 1 45%;
        justify-content: center;
    }
}