:root {
    /* Brightscout palette */
    --color-mint: #C1F6ED;
    --color-teal-deep: #02353C;
    --color-forest: #449342;
    --color-emerald: #2EAF7D;
    --color-cyan: #3FD0C9;
    --color-heart-red: #ef4444;

    --dark-950: #02353C;
    --dark-900: #034a52;
    --dark-800: #056068;
    --dark-700: #2EAF7D;
    --dark-600: #3FD0C9;
    --dark-border: rgba(2, 53, 60, 0.12);
    --dark-text: #02353C;
    --dark-text-muted: rgba(2, 53, 60, 0.72);
    --text-on-green: #02353C;
    --text-on-dark: #ffffff;
    --text-on-dark-muted: rgba(255, 255, 255, 0.78);

    --light-bg: #eef6f5;
    --light-surface: #ffffff;
    --light-elevated: #f4fbf9;
    --light-border: #c5e8e4;
    --light-border-subtle: #d8f0ee;

    --green-900: var(--color-teal-deep);
    --green-800: var(--color-forest);
    --green-700: var(--color-emerald);
    --green-600: var(--color-emerald);
    --green-500: var(--color-cyan);
    --green-400: var(--color-cyan);
    --green-100: var(--color-mint);
    --green-50: #e8faf8;

    --navy-900: var(--color-teal-deep);
    --navy-800: var(--color-forest);
    --navy-700: var(--color-emerald);
    --blue-600: var(--color-emerald);
    --blue-500: var(--color-cyan);
    --blue-100: var(--color-mint);

    --slate-50: var(--light-elevated);
    --slate-100: #eef6f5;
    --slate-200: var(--light-border);
    --slate-400: #7a9a96;
    --slate-600: #4a6b67;
    --slate-800: #02353C;
    --white: #ffffff;

    --shadow-sm: 0 1px 3px rgba(2, 53, 60, 0.06);
    --shadow-md: 0 4px 20px rgba(2, 53, 60, 0.1);
    --shadow-lg: 0 16px 48px rgba(2, 53, 60, 0.14);
    --shadow-dark: 0 8px 32px rgba(2, 53, 60, 0.22);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --transition: 0.2s ease;
    --sidebar-width: 260px;
    --directory-width: 380px;
}

/* Blue theme */
html[data-theme="blue"] {
    --color-mint: #CFE8FC;
    --color-teal-deep: #0D47A1;
    --color-forest: #1565C0;
    --color-emerald: #42A5F5;
    --color-cyan: #64B5F6;

    --dark-950: #0D47A1;
    --dark-900: #1565C0;
    --dark-800: #1976D2;
    --dark-700: #42A5F5;
    --dark-600: #64B5F6;
    --dark-border: rgba(13, 71, 161, 0.12);
    --dark-text: #0D47A1;
    --dark-text-muted: rgba(13, 71, 161, 0.72);
    --text-on-green: #0D47A1;

    --light-bg: #eef4fc;
    --light-elevated: #f3f8ff;
    --light-border: #c5daf4;
    --light-border-subtle: #dce8fa;

    --green-50: #e8f4ff;

    --slate-100: #eef4fc;
    --slate-400: #7a96b8;
    --slate-600: #4a6b8f;
    --slate-800: #0D47A1;

    --shadow-sm: 0 1px 3px rgba(13, 71, 161, 0.06);
    --shadow-md: 0 4px 20px rgba(13, 71, 161, 0.1);
    --shadow-lg: 0 16px 48px rgba(13, 71, 161, 0.14);
    --shadow-dark: 0 8px 32px rgba(13, 71, 161, 0.22);
}

html {
    -webkit-text-size-adjust: 100%;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--light-bg);
    color: var(--slate-800);
    overflow: hidden;
    line-height: 1.5;
}

/* MAIN LAYOUT */

.dashboard {
    display: flex;
    height: 100vh;
    height: 100dvh;
    min-width: 0;
    overflow: hidden;
}

/* SIDEBAR */

.sidebar {
    width: var(--sidebar-width);
    background: linear-gradient(135deg, var(--color-teal-deep) 0%, var(--color-emerald) 55%, var(--color-cyan) 100%);
    color: var(--text-on-dark);
    display: flex;
    flex-direction: column;
    padding: 24px 20px;
    flex-shrink: 0;
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 4px 0 24px rgba(2, 53, 60, 0.18);
}

.logo-mark {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.logo-img {
    display: block;
    height: 48px;
    width: auto;
    max-width: 130px;
    object-fit: contain;
}

.logo-text h2 {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--white);
}

.logo-text span {
    color: var(--text-on-dark-muted);
    font-size: 12px;
    font-weight: 500;
}

.sidebar-nav {
    margin-top: 32px;
    flex: 1;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-on-dark-muted);
    text-decoration: none;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    margin-bottom: 4px;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    font-size: 15px;
    font-weight: 500;
    border: 1px solid transparent;
}

.menu-item:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--white);
    border-color: rgba(255, 255, 255, 0.15);
}

.menu-item.active {
    background: rgba(255, 255, 255, 0.22);
    border-color: rgba(255, 255, 255, 0.28);
    color: var(--white);
    box-shadow: 0 2px 12px rgba(2, 53, 60, 0.15);
    font-weight: 600;
}

.sidebar-footer {
    padding-top: 16px;
    border-top: 1px solid rgba(27, 67, 47, 0.12);
}

.sidebar-footer p {
    font-size: 11px;
    color: var(--text-on-dark-muted);
    line-height: 1.4;
}

.menu-icon {
    font-size: 16px;
    width: 22px;
    text-align: center;
    opacity: 0.85;
}

.logo {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 8px;
}

.menu-item[hidden] {
    display: none !important;
}

/* CENTER CONTENT */

.content {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 20px 24px;
    min-width: 0;
    background: linear-gradient(165deg, var(--light-bg) 0%, #e8eceb 45%, var(--light-elevated) 100%);
}

.topbar {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    align-items: center;
}

.search-wrap {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

.search-icon {
    position: absolute;
    left: 16px;
    font-size: 14px;
    opacity: 0.45;
    pointer-events: none;
}

.search-box {
    width: 100%;
    padding: 13px 16px 13px 42px;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-md);
    background: var(--light-surface);
    font-size: 15px;
    color: var(--slate-800);
    box-shadow: var(--shadow-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.search-box:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.15), var(--shadow-sm);
}

.top-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--light-border);
    background: var(--light-surface);
    padding: 13px 18px;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-800);
    box-shadow: var(--shadow-sm);
    transition: background var(--transition), border-color var(--transition), transform var(--transition), box-shadow var(--transition);
    white-space: nowrap;
}

.top-btn:hover {
    background: var(--light-elevated);
    border-color: var(--green-600);
    box-shadow: var(--shadow-md);
}

.top-btn.active {
    background: var(--dark-800);
    border-color: var(--dark-700);
    color: var(--text-on-green);
}

/* FILTER PANEL */

.filter-panel {
    margin-bottom: 16px;
    animation: slideDown 0.2s ease;
}

.filter-panel-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    align-items: flex-end;
    padding: 16px 20px;
    background: var(--light-surface);
    border: 1px solid var(--light-border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.filter-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 180px;
}

.filter-field label {
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.filter-field select,
.filter-field input {
    padding: 10px 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    background: var(--white);
}

.filter-field select:focus,
.filter-field input:focus {
    outline: none;
    border-color: var(--blue-600);
}

.filter-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* BUTTONS */

.btn-primary,
.btn-secondary {
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: background var(--transition), transform var(--transition);
}

.btn-primary {
    background: linear-gradient(145deg, var(--green-700), var(--green-600));
    color: var(--white);
    box-shadow: 0 2px 8px rgba(21, 128, 61, 0.25);
}

.btn-primary:hover {
    background: linear-gradient(145deg, var(--green-800), var(--green-700));
    box-shadow: 0 4px 12px rgba(21, 128, 61, 0.3);
}

.btn-secondary {
    background: var(--light-elevated);
    color: var(--slate-800);
    border: 1px solid var(--light-border);
}

.btn-secondary:hover {
    background: var(--light-surface);
    border-color: var(--slate-400);
}

.btn-danger {
    padding: 11px 18px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
    margin-top: 8px;
    transition: background var(--transition);
}

.btn-danger:hover {
    background: #fee2e2;
}

.btn-block {
    width: 100%;
}

.btn-primary:active,
.btn-secondary:active {
    transform: scale(0.98);
}

/* MAP */

.map-container {
    flex: 1;
    position: relative;
    border-radius: var(--radius-xl);
    overflow: hidden;
    background: var(--light-surface);
    box-shadow: var(--shadow-md);
    border: 1px solid var(--light-border);
    min-height: 300px;
}

.map-markers-toggle {
    position: absolute;
    right: 12px;
    bottom: 12px;
    z-index: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--light-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--color-teal-deep);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.map-markers-toggle:hover {
    background: var(--light-elevated);
    border-color: var(--color-teal-mid);
}

.map-markers-toggle:active {
    transform: scale(0.97);
}

.map-markers-toggle[aria-pressed="true"] {
    background: var(--green-100);
    border-color: var(--green-600);
    color: var(--green-800);
}

.map-world-view-btn {
    position: absolute;
    right: 12px;
    bottom: 58px;
    z-index: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    border: 1px solid var(--light-border);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    color: var(--color-teal-deep);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    box-shadow: var(--shadow-md);
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}

.map-world-view-btn:hover {
    background: var(--light-elevated);
    border-color: var(--color-teal-mid);
}

.map-world-view-btn:active {
    transform: scale(0.97);
}

.map-world-view-btn[aria-pressed="true"] {
    background: var(--green-100);
    border-color: var(--green-600);
    color: var(--green-800);
}

.map-markers-toggle-icon {
    font-size: 16px;
    line-height: 1;
}

#map {
    width: 100%;
    height: 100%;
}

#map.leaflet-container,
.leaflet-container {
    width: 100%;
    height: 100%;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
    touch-action: pan-x pan-y pinch-zoom;
}

.leaflet-tile-container img.leaflet-tile {
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
}

.church-map-marker-icon {
    image-rendering: -webkit-optimize-contrast;
}

.leaflet-control-zoom a {
    min-width: 32px;
    min-height: 32px;
    line-height: 32px;
}

.leaflet-control-attribution {
    font-size: 11px;
}

.content.view-directory .map-container {
    display: none;
}

.content.view-directory .directory-full {
    display: flex;
}

/* DIRECTORY FULL VIEW */

.directory-full {
    flex: 1;
    display: none;
    flex-direction: column;
    background: var(--white);
    border-radius: var(--radius-xl);
    border: 1px solid var(--slate-200);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.directory-full-header {
    padding: 24px 28px 16px;
    border-bottom: 1px solid var(--slate-200);
}

.directory-full-header h2 {
    font-size: 22px;
    color: var(--navy-900);
    margin-bottom: 4px;
}

.directory-full-header p {
    color: var(--slate-600);
    font-size: 14px;
}

.directory-full-list {
    flex: 1;
    overflow-y: auto;
    padding: 20px 28px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* RIGHT PANEL */

.directory-panel {
    width: var(--directory-width);
    max-width: var(--directory-width);
    background: var(--light-elevated);
    border-left: 1px solid var(--light-border);
    overflow-y: auto;
    padding: 0;
    flex-shrink: 0;
    transition: opacity var(--transition), transform var(--transition);
    display: flex;
    flex-direction: column;
}

.directory-header {
    background: linear-gradient(135deg, var(--color-teal-deep) 0%, var(--color-emerald) 70%, var(--color-cyan) 100%);
    padding: 24px 20px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    flex-shrink: 0;
}

.directory-header h2 {
    font-size: 20px;
    color: var(--white);
    margin-bottom: 4px;
    font-weight: 700;
}

.directory-header p {
    color: var(--text-on-dark-muted);
    font-size: 14px;
    margin-bottom: 0;
}

.directory-admin-hint {
    font-size: 12px;
    color: var(--text-on-dark-muted);
    margin-top: 12px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-sm);
    border: 1px solid rgba(255, 255, 255, 0.18);
    line-height: 1.4;
}

.admin-ui {
    display: none !important;
}

body.is-admin .admin-ui {
    display: flex !important;
}

body.is-admin .admin-ui.btn-block,
body.is-admin .admin-ui.btn-danger {
    display: block !important;
}

.directory-admin-hint.admin-ui {
    display: none !important;
}

body.is-admin .directory-admin-hint.admin-ui {
    display: block !important;
}

.dashboard.view-directory-only .directory-panel {
    opacity: 0;
    pointer-events: none;
    width: 0;
    overflow: hidden;
}

.directory-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.directory-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    background: var(--light-elevated);
}

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

.church-card {
    background: var(--light-surface);
    border: 1px solid var(--light-border);
    border-radius: var(--radius-lg);
    padding: 16px;
    transition: box-shadow var(--transition), border-color var(--transition), transform var(--transition);
    cursor: pointer;
    position: relative;
    box-shadow: var(--shadow-sm);
}

.church-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--green-600);
    transform: translateY(-2px);
}

.church-card h3 {
    color: var(--slate-800);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;
}

.church-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 10px;
}

.church-card-thumb {
    width: 100%;
    height: 100px;
    object-fit: cover;
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    border: 1px solid var(--light-border);
}

.church-badge {
    background: var(--color-mint);
    color: var(--color-teal-deep);
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    margin-bottom: 10px;
    border: 1px solid var(--light-border);
}

/* Heart button */
.heart-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 999px;
    background: var(--color-teal-deep);
    cursor: pointer;
    transition: transform var(--transition), background var(--transition), box-shadow var(--transition);
    flex-shrink: 0;
}

.heart-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(2, 53, 60, 0.25);
}

.heart-btn.active {
    background: var(--color-teal-deep);
    border-color: var(--color-heart-red);
}

.heart-icon {
    width: 20px;
    height: 20px;
    fill: #ffffff;
    transition: fill var(--transition);
}

.heart-btn.active .heart-icon {
    fill: var(--color-heart-red);
}

.heart-count {
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    min-width: 14px;
    line-height: 1;
}

.detail-title-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 8px;
}

.detail-title-text h2 {
    margin-top: 4px;
}

/* Reviews */
.reviews-section {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--light-border);
}

.reviews-heading {
    font-size: 16px;
    color: var(--color-teal-deep);
    margin-bottom: 12px;
    font-weight: 700;
}

.reviews-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
    max-height: 200px;
    overflow-y: auto;
}

.review-item {
    padding: 12px;
    background: var(--light-elevated);
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
}

.review-item-author {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-teal-deep);
    margin-bottom: 4px;
}

.review-item-text {
    font-size: 14px;
    color: var(--slate-600);
    margin-bottom: 6px;
}

.review-item-date {
    font-size: 11px;
    color: var(--slate-400);
}

.reviews-empty,
.reviews-loading {
    font-size: 13px;
    color: var(--slate-600);
    padding: 12px;
    text-align: center;
    background: var(--light-elevated);
    border-radius: var(--radius-sm);
}

.review-form textarea {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    min-height: 80px;
}

.review-form textarea:focus {
    outline: none;
    border-color: var(--color-emerald);
    box-shadow: 0 0 0 3px rgba(46, 175, 125, 0.15);
}

/* Admin comments modal */
.comments-admin-filters {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 12px;
}

.comments-admin-summary {
    font-size: 13px;
    color: var(--slate-600);
    margin-bottom: 14px;
    padding: 10px 12px;
    background: var(--color-mint);
    border-radius: var(--radius-sm);
    border: 1px solid var(--light-border);
}

.comments-admin-groups {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.church-comments-group {
    border: 1px solid var(--light-border);
    border-radius: var(--radius-md);
    background: var(--light-surface);
    overflow: hidden;
}

.church-comments-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border: none;
    background: linear-gradient(135deg, rgba(193, 246, 237, 0.5), rgba(255, 255, 255, 0.9));
    cursor: pointer;
    text-align: left;
    transition: background var(--transition);
}

.church-comments-toggle:hover {
    background: var(--color-mint);
}

.church-comments-toggle .toggle-icon {
    font-size: 11px;
    color: var(--color-teal-deep);
    width: 14px;
    flex-shrink: 0;
}

.group-church-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--color-teal-deep);
    flex: 1;
    min-width: 0;
}

.group-district {
    font-size: 12px;
    color: var(--slate-600);
    padding: 2px 8px;
    background: rgba(2, 53, 60, 0.06);
    border-radius: 20px;
    white-space: nowrap;
}

.comment-count-badge {
    font-size: 12px;
    font-weight: 700;
    color: var(--white);
    background: var(--color-emerald);
    min-width: 28px;
    height: 28px;
    padding: 0 8px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.comment-count-badge.is-unread {
    background: #dc2626;
    min-width: 22px;
    height: 22px;
    font-size: 11px;
}

.church-comments-panel {
    padding: 12px;
    background: var(--light-elevated);
    border-top: 1px solid var(--light-border);
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.church-comments-panel[hidden] {
    display: none;
}

.admin-review-card.is-important {
    border-color: #f59e0b;
    background: rgba(245, 158, 11, 0.08);
}

.review-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tag-important {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 20px;
    background: #fef3c7;
    color: #b45309;
    border: 1px solid #fcd34d;
}

.tag-checklist {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--color-cyan);
    color: var(--color-teal-deep);
}

.tag-done {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    padding: 3px 8px;
    border-radius: 20px;
    background: var(--color-forest);
    color: var(--white);
}

.admin-note-field {
    margin-top: 10px;
    margin-bottom: 0;
}

.admin-note-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-family: inherit;
    resize: vertical;
    min-height: 56px;
}

.admin-note-input:focus {
    outline: none;
    border-color: var(--color-emerald);
    box-shadow: 0 0 0 3px rgba(46, 175, 125, 0.15);
}

.comments-admin-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding-top: 8px;
    padding-bottom: 24px;
}

.admin-review-card {
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--light-border);
    background: var(--light-elevated);
}

.admin-review-card.status-todo {
    border-color: var(--color-cyan);
    background: rgba(193, 246, 237, 0.35);
}

.admin-review-card.status-done {
    border-color: var(--color-forest);
    opacity: 0.85;
}

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

.review-church-name {
    font-weight: 700;
    font-size: 13px;
    color: var(--color-teal-deep);
}

.review-status-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.badge-open {
    background: var(--color-mint);
    color: var(--color-teal-deep);
}

.badge-todo {
    background: var(--color-cyan);
    color: var(--color-teal-deep);
}

.badge-done {
    background: var(--color-forest);
    color: var(--white);
}

.review-author-name {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 6px;
}

.review-body {
    font-size: 14px;
    color: var(--slate-600);
    margin-bottom: 8px;
    line-height: 1.5;
}

.review-date {
    font-size: 11px;
    color: var(--slate-400);
    display: block;
    margin-bottom: 12px;
}

.admin-review-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
}

.church-card-meta {
    font-size: 13px;
    color: var(--slate-600);
    margin-bottom: 4px;
}

.church-card-meta strong {
    color: var(--slate-800);
    font-weight: 600;
}

.church-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.card-btn {
    flex: 1;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--light-border);
    background: var(--light-elevated);
    color: var(--slate-800);
    transition: background var(--transition), border-color var(--transition);
}

.card-btn:hover {
    background: var(--light-border-subtle);
    border-color: var(--slate-400);
}

.card-btn.primary {
    background: var(--color-teal-deep);
    color: var(--white);
    border-color: var(--color-teal-deep);
}

.card-btn.primary:hover {
    background: var(--color-forest);
    border-color: var(--color-forest);
}

.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--slate-600);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

.empty-state p {
    margin-bottom: 16px;
}

/* FORM (modals) */

.form-field {
    margin-bottom: 14px;
}

.form-field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--slate-600);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.form-field input,
.form-field select {
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--slate-200);
    border-radius: var(--radius-sm);
    font-size: 14px;
    transition: border-color var(--transition);
}

.form-field input:focus {
    outline: none;
    border-color: var(--blue-600);
    box-shadow: 0 0 0 3px rgba(21, 128, 61, 0.1);
}

.form-row {
    display: flex;
    gap: 12px;
}

.form-row .form-field {
    flex: 1;
}

#saveBtn {
    margin-top: 4px;
}

.search-box::placeholder {
    color: var(--slate-400);
}

.top-btn:active {
    transform: scale(0.98);
}

.form-error {
    color: #dc2626;
    font-size: 13px;
    margin-bottom: 12px;
}

/* MODALS */

.modal {
    position: fixed;
    inset: 0;
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal[hidden] {
    display: none;
}

.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(45, 106, 79, 0.35);
    backdrop-filter: blur(6px);
}

.modal-dialog {
    position: relative;
    background: var(--light-surface);
    border-radius: var(--radius-lg);
    padding: 0;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 16px 48px rgba(45, 106, 79, 0.18);
    animation: modalIn 0.25s ease;
    border: 1px solid var(--dark-border);
    overflow: hidden;
}

.modal-dialog > h2,
.modal-dialog > .modal-subtitle,
.modal-dialog > form,
.modal-dialog > .about-content,
.modal-dialog > .profile-modal-body,
.modal-dialog > #churchDetailContent,
.modal-dialog > .comments-admin-body {
    padding-left: 32px;
    padding-right: 32px;
}

.modal-dialog > .comments-admin-body {
    padding-top: 20px;
    padding-bottom: 32px;
}

.modal-dialog > h2 {
    padding-top: 28px;
    padding-bottom: 0;
    background: linear-gradient(135deg, var(--color-teal-deep), var(--color-emerald));
    color: var(--white);
    margin: 0;
    padding-bottom: 8px;
    margin-bottom: 0;
}

.modal-dialog > .modal-subtitle {
    background: linear-gradient(135deg, var(--color-emerald), var(--color-cyan));
    color: var(--text-on-dark-muted);
    margin-bottom: 0;
    padding-bottom: 20px;
    padding-top: 4px;
}

.modal-dialog > form {
    padding-top: 24px;
    padding-bottom: 32px;
}

.modal-dialog > .about-content,
.modal-dialog > .profile-modal-body {
    padding-top: 24px;
    padding-bottom: 32px;
}

.modal-dialog > .settings-modal-body {
    padding-left: 32px;
    padding-right: 32px;
    padding-top: 24px;
    padding-bottom: 32px;
}

.modal-dialog > #churchDetailContent {
    padding-top: 24px;
    padding-bottom: 32px;
}

.modal-dialog > .modal-close {
    top: 12px;
    right: 12px;
    background: rgba(255, 255, 255, 0.65);
    color: var(--text-on-green);
    z-index: 2;
}

.modal-dialog > .modal-close:hover {
    background: rgba(255, 255, 255, 0.9);
}

#churchDetailContent > h2 {
    color: var(--slate-800);
    font-size: 22px;
    margin-bottom: 4px;
}

#churchDetailContent > .church-badge {
    margin-bottom: 8px;
}

.modal-dialog h2 {
    font-size: 22px;
    margin-bottom: 4px;
}

.modal-dialog-lg {
    max-width: 640px;
}

.modal-dialog-scroll {
    max-height: 90vh;
    overflow-y: auto;
}

.modal-subtitle {
    color: var(--slate-600);
    font-size: 14px;
}

.modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border: none;
    background: var(--dark-700);
    border-radius: 50%;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--text-on-green);
    transition: background var(--transition);
}

.modal-close:hover {
    background: var(--dark-600);
}

.about-content {
    color: var(--slate-600);
    font-size: 15px;
}

.about-content ul {
    margin: 16px 0;
    padding-left: 20px;
}

.about-content li {
    margin-bottom: 8px;
}

.about-note {
    font-size: 13px;
    color: var(--slate-400);
    margin-top: 16px;
}

.profile-modal-body {
    padding-top: 8px;
}

.profile-info-item {
    padding: 12px 0;
    border-bottom: 1px solid var(--slate-200);
}

.profile-info-item:last-child {
    border-bottom: none;
}

.profile-info-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--slate-400);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.profile-info-value {
    font-size: 15px;
    color: var(--slate-800);
    margin-top: 4px;
}

/* Settings & theme */

.settings-section {
    margin-bottom: 20px;
}

.settings-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--slate-600);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 12px;
}

.theme-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.theme-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 14px 12px;
    border: 2px solid var(--light-border);
    border-radius: var(--radius-md);
    background: var(--light-elevated);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    color: var(--slate-800);
    transition: border-color var(--transition), box-shadow var(--transition);
    font-family: inherit;
}

.theme-option:hover {
    border-color: var(--color-emerald);
}

.theme-option.active {
    border-color: var(--color-emerald);
    box-shadow: 0 0 0 3px rgba(46, 175, 125, 0.2);
    background: var(--light-surface);
}

html[data-theme="blue"] .theme-option.active {
    box-shadow: 0 0 0 3px rgba(66, 165, 245, 0.25);
}

.theme-swatch {
    width: 100%;
    height: 36px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--light-border);
}

.theme-swatch-green {
    background: linear-gradient(135deg, #02353C 0%, #2EAF7D 55%, #3FD0C9 100%);
}

.theme-swatch-blue {
    background: linear-gradient(135deg, #0D47A1 0%, #42A5F5 55%, #64B5F6 100%);
}

.settings-divider {
    border: none;
    border-top: 1px solid var(--light-border);
    margin: 20px 0;
}

.settings-hint {
    font-size: 13px;
    color: var(--slate-600);
    margin-bottom: 12px;
    line-height: 1.45;
}

.settings-section.admin-ui[hidden] {
    display: none !important;
}

.backup-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 14px;
}

.backup-loading,
.backup-empty,
.backup-error {
    font-size: 13px;
    color: var(--slate-600);
    padding: 12px;
    background: var(--light-elevated);
    border-radius: var(--radius-sm);
    border: 1px solid var(--light-border);
}

.backup-error {
    color: #b91c1c;
    border-color: #fecaca;
    background: #fef2f2;
}

.backup-card {
    padding: 12px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--light-border);
    background: var(--light-elevated);
}

.backup-card.ok {
    border-color: var(--color-emerald);
}

.backup-card.failed {
    border-color: #fecaca;
    background: #fef2f2;
}

.backup-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.backup-card-top strong {
    font-size: 14px;
    color: var(--slate-800);
}

.backup-status {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--color-mint);
    color: var(--color-teal-deep);
}

.backup-card.failed .backup-status {
    background: #fee2e2;
    color: #b91c1c;
}

.backup-meta {
    font-size: 12px;
    color: var(--slate-600);
    margin-bottom: 10px;
}

.backup-restore-btn {
    width: 100%;
}

/* TOAST */

.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(145deg, var(--color-emerald), var(--color-teal-deep));
    color: var(--white);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 24px rgba(45, 106, 79, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.25);
    z-index: 30000;
    animation: toastIn 0.3s ease;
}

.toast[hidden] {
    display: none;
}

/* MAP MARKER HIGHLIGHT */

.church-marker-highlighted {
    filter: drop-shadow(0 0 8px rgba(46, 175, 125, 0.95));
}

.church-marker-highlight-pulse {
    animation: church-marker-pulse 1.5s ease-in-out infinite;
}

@keyframes church-marker-pulse {
    0%, 100% {
        opacity: 0.35;
        stroke-width: 2;
    }

    50% {
        opacity: 0.7;
        stroke-width: 4;
    }
}

/* POPUPS */

.leaflet-popup-content-wrapper {
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
}

.church-popup h3 {
    color: var(--blue-600);
    margin-bottom: 8px;
    font-size: 16px;
}

.church-popup p {
    font-size: 13px;
    margin-bottom: 4px;
    color: var(--slate-600);
}

.details-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 10px 18px;
    background: var(--white);
    color: var(--green-800);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 2px solid var(--green-600);
    transition: background var(--transition), color var(--transition);
}

.details-btn:hover {
    background: var(--green-50);
    color: var(--green-900);
}

.detail-meta {
    margin: 16px 0;
    font-size: 14px;
    color: var(--slate-600);
}

.detail-meta p {
    margin-bottom: 6px;
}

.detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.church-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin: 16px 0;
}

.gallery-item {
    border-radius: var(--radius-sm);
    overflow: hidden;
    aspect-ratio: 4/3;
    border: 1px solid var(--slate-200);
    display: block;
    width: 100%;
    padding: 0;
    cursor: pointer;
    background: var(--light-elevated);
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    min-height: 44px;
}

.gallery-item:hover {
    transform: scale(1.02);
    box-shadow: var(--shadow-md);
    border-color: var(--color-emerald);
}

.gallery-item:active {
    transform: scale(0.98);
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

/* Photo lightbox */

body.photo-lightbox-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
}

body.photo-lightbox-open .modal,
body.photo-lightbox-open .mobile-bottom-nav,
body.photo-lightbox-open .mobile-menu-panel,
body.photo-lightbox-open .mobile-sheet-backdrop,
body.photo-lightbox-open .directory-panel {
    visibility: hidden !important;
    pointer-events: none !important;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: rgba(0, 0, 0, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
    touch-action: none;
    -webkit-tap-highlight-color: transparent;
}

.photo-lightbox:not([hidden]) {
    display: flex !important;
}

.photo-lightbox[hidden] {
    display: none !important;
}

.photo-lightbox-close {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0));
    right: calc(12px + env(safe-area-inset-right, 0));
    width: 48px;
    height: 48px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}

.photo-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

.photo-lightbox-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 0;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    padding: 56px 12px 48px;
    touch-action: pan-y pinch-zoom;
}

.photo-lightbox-stage img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius-sm);
    user-select: none;
    -webkit-user-drag: none;
}

.photo-lightbox-nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 56px;
    border: none;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    font-size: 32px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.photo-lightbox-nav:hover {
    background: rgba(255, 255, 255, 0.22);
}

.photo-lightbox-nav[hidden] {
    display: none !important;
}

.photo-lightbox-prev {
    left: calc(8px + env(safe-area-inset-left, 0));
}

.photo-lightbox-next {
    right: calc(8px + env(safe-area-inset-right, 0));
}

.photo-lightbox-counter {
    position: absolute;
    bottom: calc(16px + env(safe-area-inset-bottom, 0));
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 600;
    padding: 6px 14px;
    background: rgba(0, 0, 0, 0.45);
    border-radius: 999px;
    pointer-events: none;
}

.detail-actions-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-top: 20px;
    padding: 16px;
    background: linear-gradient(135deg, var(--color-teal-deep), var(--color-emerald));
    border-radius: var(--radius-md);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.detail-actions-bar .details-btn {
    background: var(--white);
    color: var(--text-on-green);
    border-color: var(--white);
    margin-top: 0;
}

.detail-actions-bar .details-btn-alt {
    display: inline-block;
    padding: 10px 18px;
    background: transparent;
    color: var(--white);
    text-decoration: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    border: 2px solid rgba(255, 255, 255, 0.85);
    cursor: pointer;
    transition: background var(--transition), color var(--transition), border-color var(--transition);
    font-family: inherit;
}

.detail-actions-bar .details-btn-alt:hover,
.detail-actions-bar .details-btn-alt.active {
    background: var(--white);
    color: var(--text-on-green);
    border-color: var(--white);
}

.user-review-panel {
    margin-top: 16px;
    padding: 16px;
    background: var(--light-elevated);
    border: 1px solid var(--light-border);
    border-radius: var(--radius-md);
}

.user-review-panel[hidden] {
    display: none;
}

.user-review-heading {
    font-size: 15px;
    font-weight: 700;
    color: var(--color-teal-deep);
    margin-bottom: 12px;
}

.detail-actions-bar .details-btn:hover {
    background: var(--green-50);
    color: #2d6a4f;
    border-color: #b7e4c7;
}

.detail-actions-bar .btn-secondary {
    background: rgba(255, 255, 255, 0.45);
    color: var(--text-on-green);
    border-color: rgba(27, 67, 47, 0.15);
}

.detail-actions-bar .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.75);
    border-color: rgba(27, 67, 47, 0.25);
}

.church-gallery-empty {
    padding: 24px;
    text-align: center;
    background: var(--light-elevated);
    border-radius: var(--radius-md);
    color: var(--slate-600);
    font-size: 14px;
    margin: 16px 0;
    border: 1px dashed var(--light-border);
}

.image-upload-section {
    margin-top: 8px;
}

.field-hint {
    font-size: 12px;
    color: var(--slate-600);
    margin-bottom: 10px;
}

.pastor-fields {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.pastor-field-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.pastor-field-row input {
    flex: 1;
    min-width: 0;
    padding: 11px 12px;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    font-size: 15px;
    color: var(--slate-800);
    background: var(--light-surface);
}

.pastor-field-row input:focus {
    outline: none;
    border-color: var(--color-emerald);
    box-shadow: 0 0 0 3px rgba(63, 208, 201, 0.2);
}

.pastor-field-remove {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    background: var(--light-elevated);
    color: var(--slate-600);
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
}

.pastor-field-remove:hover {
    background: #fef2f2;
    color: #b91c1c;
    border-color: #fecaca;
}

.pastor-field-remove[hidden] {
    display: none;
}

#addPastorBtn {
    margin-top: 4px;
}

.location-pending-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(234, 179, 8, 0.18);
    color: #a16207;
    margin: 4px 0 8px;
}

.pending-locations-wrap {
    margin-top: 8px;
    max-height: 360px;
    overflow: auto;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-md);
    background: var(--light-surface);
}

.pending-locations-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

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

.pending-locations-table th {
    background: var(--light-elevated);
    font-weight: 600;
    position: sticky;
    top: 0;
    z-index: 1;
}

.pending-locations-table input {
    width: 100%;
    min-width: 72px;
    padding: 6px 8px;
    border: 1px solid var(--light-border);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.church-status-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 6px 0 4px;
}

.church-status-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.03em;
    padding: 3px 8px;
    border-radius: 999px;
    text-transform: uppercase;
}

.church-status-closed {
    background: #fef2f2;
    color: #b91c1c;
    border: 1px solid #fecaca;
}

.church-status-careof {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    text-transform: none;
    font-weight: 600;
}

.church-card.is-closed {
    border-left: 3px solid #dc2626;
}

.church-card.is-closed h3 {
    color: #b91c1c;
}

.detail-title-closed h2 {
    color: #b91c1c;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
    gap: 8px;
    margin-bottom: 12px;
}

.image-preview-item {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    border: 1px solid var(--slate-200);
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.image-preview-item.pending {
    border-color: var(--green-500);
}

.image-remove-btn {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.65);
    color: white;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.upload-btn {
    display: inline-block;
    padding: 10px 16px;
    background: var(--green-50);
    color: var(--green-800);
    border: 1px dashed var(--green-600);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--transition);
}

.upload-btn:hover {
    background: var(--green-100);
}

/* CLUSTERS */

.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
    background: rgba(21, 128, 61, 0.35) !important;
}

.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
    background: var(--blue-600) !important;
    color: var(--white) !important;
    font-weight: 600;
}

/* PROFILE DROPDOWN */

.profile-menu {
    position: relative;
    width: 100%;
    z-index: 10000;
    margin-bottom: 8px;
}

.profile-btn {
    width: 100%;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    cursor: pointer;
    color: var(--white);
    font-size: 15px;
    font-weight: 500;
}

.profile-name-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.admin-comment-badge {
    position: absolute;
    top: -8px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    color: var(--white);
    background: #dc2626;
    border: 2px solid var(--color-teal-deep);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.admin-comment-badge[hidden] {
    display: none !important;
}

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

.arrow {
    margin-left: auto;
    font-size: 10px;
    opacity: 0.6;
    transition: transform var(--transition);
}

.profile-btn[aria-expanded="true"] .arrow {
    transform: rotate(180deg);
}

.submenu {
    display: none;
    position: absolute;
    left: 0;
    width: 100%;
    background: var(--color-teal-deep);
    border-radius: var(--radius-sm);
    margin-top: 6px;
    z-index: 10001;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: var(--shadow-dark);
    overflow: hidden;
}

.submenu.show {
    display: block;
}

.submenu a {
    display: block;
    color: rgba(255, 255, 255, 0.88);
    text-decoration: none;
    padding: 11px 16px;
    font-size: 14px;
    transition: background var(--transition);
}

.submenu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--white);
}

.submenu a#logoutBtn {
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    color: #fca5a5;
}

/* SCROLLBAR */

.directory-panel::-webkit-scrollbar,
.directory-full-list::-webkit-scrollbar,
.modal-dialog-scroll::-webkit-scrollbar {
    width: 6px;
}

.directory-panel::-webkit-scrollbar-thumb,
.directory-full-list::-webkit-scrollbar-thumb,
.modal-dialog-scroll::-webkit-scrollbar-thumb {
    background: var(--slate-200);
    border-radius: 3px;
}

/* ANIMATIONS */

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

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(12px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* RESPONSIVE */

@media (max-width: 1200px) {
    :root {
        --sidebar-width: 228px;
        --directory-width: 300px;
    }

    .logo-text h2 {
        font-size: 22px;
    }

    .sidebar {
        padding: 20px 16px;
    }

    .content {
        padding: 16px 18px;
    }
}

@media (max-width: 1100px) {
    .directory-panel {
        width: 320px;
        max-width: 320px;
    }
}

/* Desktop: never show mobile chrome when layout class is off */
@media (min-width: 901px) {
    html:not(.mobile-layout) .mobile-bottom-nav,
    html:not(.mobile-layout) .mobile-sheet-backdrop,
    html:not(.mobile-layout) .mobile-menu-panel,
    html:not(.mobile-layout) .directory-sheet-close {
        display: none !important;
    }

    html:not(.mobile-layout) .directory-panel {
        position: relative;
        transform: none !important;
        height: auto;
        border-radius: 0;
    }

    html:not(.mobile-layout) body {
        overflow: hidden;
    }
}

/* Mobile layout */

.mobile-bottom-nav,
.mobile-sheet-backdrop,
.mobile-menu-panel,
.directory-sheet-close {
    display: none;
}

@media (max-width: 900px), (max-width: 1024px) and (max-height: 950px) {
    :root {
        --mobile-nav-height: 64px;
    }

    body {
        overflow: auto;
    }

    button,
    input,
    select,
    textarea {
        font-size: 16px;
    }

    .dashboard {
        flex-direction: column;
        height: 100vh;
        height: 100dvh;
        min-height: 100dvh;
    }

    .sidebar {
        display: none;
    }

    .content {
        flex: 1;
        padding: 12px 12px 0;
        min-height: 0;
        padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
    }

    .topbar {
        flex-wrap: wrap;
        gap: 8px;
        margin-bottom: 12px;
    }

    .search-wrap {
        flex: 1 1 100%;
        order: 1;
    }

    .search-box {
        padding: 12px 14px 12px 38px;
        font-size: 16px;
    }

    .top-btn {
        flex: 1;
        justify-content: center;
        padding: 12px 10px;
        min-height: 44px;
    }

    .top-btn span:not([aria-hidden]) {
        display: none;
    }

    #filterBtn {
        order: 2;
    }

    #myLocationBtn {
        order: 3;
    }

    .filter-panel-inner {
        flex-direction: column;
        align-items: stretch;
        padding: 14px;
    }

    .filter-field {
        min-width: 0;
        width: 100%;
    }

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

    .filter-actions .btn-primary,
    .filter-actions .btn-secondary {
        flex: 1;
        min-height: 44px;
    }

    .map-container {
        border-radius: var(--radius-lg);
        min-height: 0;
        flex: 1;
    }

    .content.view-directory .map-container {
        display: none;
    }

    .directory-full {
        border-radius: var(--radius-lg);
        min-height: 0;
    }

    .directory-full-header {
        padding: 18px 16px 14px;
    }

    .directory-full-header h2 {
        font-size: 20px;
    }

    .directory-full-list {
        padding: 14px 16px;
        grid-template-columns: 1fr;
        gap: 12px;
    }

  /* Church list sheet (map view on mobile) */

    .directory-panel {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        width: 100%;
        max-width: none;
        height: min(78vh, calc(100dvh - var(--mobile-nav-height) - 12px));
        z-index: 16900;
        border-left: none;
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -12px 40px rgba(2, 53, 60, 0.22);
        transform: translateY(105%);
        transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
        padding-bottom: env(safe-area-inset-bottom, 0);
        background: var(--light-elevated);
        isolation: isolate;
    }

    body.directory-sheet-open .directory-panel {
        transform: translateY(0);
    }

    .dashboard.view-directory-only .directory-panel {
        opacity: 1;
        pointer-events: auto;
        width: 100%;
        overflow: hidden;
    }

    .content.view-directory .directory-panel {
        display: none;
    }

    .directory-sheet-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 50%;
        background: rgba(255, 255, 255, 0.2);
        color: var(--white);
        font-size: 22px;
        line-height: 1;
        cursor: pointer;
        flex-shrink: 0;
    }

    .directory-header {
        padding: 16px 16px 14px;
        border-radius: 20px 20px 0 0;
    }

    .directory-header-top h2 {
        font-size: 18px;
        flex: 1;
        min-width: 0;
    }

    .directory-body {
        padding: 14px;
    }

    .church-card {
        padding: 14px;
    }

    .church-card-actions {
        flex-direction: column;
    }

    .card-btn {
        min-height: 44px;
    }

  /* Bottom navigation */

    .mobile-bottom-nav {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 17200;
        background: var(--color-teal-deep);
        border-top: 1px solid rgba(255, 255, 255, 0.12);
        padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0));
        box-shadow: 0 -4px 20px rgba(2, 53, 60, 0.2);
    }

    .mobile-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2px;
        min-height: 52px;
        padding: 4px 2px;
        border: none;
        background: transparent;
        color: rgba(255, 255, 255, 0.72);
        cursor: pointer;
        border-radius: var(--radius-sm);
        font-family: inherit;
        -webkit-tap-highlight-color: transparent;
    }

    .mobile-nav-item.active {
        color: var(--white);
        background: rgba(255, 255, 255, 0.14);
    }

    .mobile-nav-icon {
        font-size: 18px;
        line-height: 1;
    }

    .mobile-nav-label {
        font-size: 10px;
        font-weight: 600;
        line-height: 1.2;
    }

  /* Mobile menu */

    .mobile-sheet-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 16400;
        background: rgba(2, 53, 60, 0.45);
        backdrop-filter: blur(3px);
        animation: fadeIn 0.2s ease;
    }

    .mobile-sheet-backdrop[hidden] {
        display: none !important;
    }

    .mobile-menu-panel {
        display: flex;
        flex-direction: column;
        position: fixed;
        left: 0;
        right: 0;
        bottom: var(--mobile-nav-height);
        bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
        z-index: 17100;
        max-height: 55vh;
        background: var(--light-surface);
        border-radius: 20px 20px 0 0;
        box-shadow: 0 -12px 40px rgba(2, 53, 60, 0.2);
        animation: slideUpMenu 0.28s ease;
    }

    .mobile-menu-panel[hidden] {
        display: none !important;
    }

    .mobile-menu-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px 16px 12px;
        border-bottom: 1px solid var(--light-border);
    }

    .mobile-menu-header h3 {
        font-size: 18px;
        color: var(--color-teal-deep);
    }

    .mobile-menu-close {
        width: 36px;
        height: 36px;
        border: none;
        border-radius: 50%;
        background: var(--light-elevated);
        color: var(--color-teal-deep);
        font-size: 22px;
        cursor: pointer;
    }

    .mobile-menu-links {
        display: flex;
        flex-direction: column;
        padding: 8px 12px 16px;
        overflow-y: auto;
    }

    .mobile-menu-link {
        display: flex;
        align-items: center;
        width: 100%;
        min-height: 48px;
        padding: 12px 14px;
        border: none;
        background: transparent;
        color: var(--color-teal-deep);
        font-size: 16px;
        font-weight: 600;
        text-align: left;
        border-radius: var(--radius-sm);
        cursor: pointer;
        font-family: inherit;
    }

    .mobile-menu-link:hover,
    .mobile-menu-link:active {
        background: var(--light-elevated);
    }

    .mobile-menu-link-danger {
        color: #b91c1c;
        margin-top: 4px;
        border-top: 1px solid var(--light-border);
    }

    .mobile-menu-link[hidden] {
        display: none !important;
    }

    .mobile-menu-link.admin-only[hidden] {
        display: none !important;
    }

  /* Modals on mobile */

    .modal {
        padding: 0;
        align-items: flex-end;
    }

    .modal-dialog {
        max-width: none;
        width: 100%;
        max-height: 94dvh;
        border-radius: 20px 20px 0 0;
        animation: slideUpMenu 0.28s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #churchDetailModal .modal-dialog {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .modal-dialog-lg {
        max-width: none;
    }

    .modal-dialog > h2,
    .modal-dialog > .modal-subtitle,
    .modal-dialog > form,
    .modal-dialog > .about-content,
    .modal-dialog > .profile-modal-body,
    .modal-dialog > #churchDetailContent,
    .modal-dialog > .comments-admin-body {
        padding-left: 20px;
        padding-right: 20px;
    }

    .modal-dialog > h2 {
        padding-top: 22px;
        font-size: 20px;
    }

    .form-row {
        flex-direction: column;
        gap: 0;
    }

    .comments-admin-filters {
        grid-template-columns: 1fr;
    }

    .church-comments-toggle {
        flex-wrap: wrap;
        padding: 12px 14px;
    }

    .group-district {
        display: none;
    }

    .admin-review-actions {
        flex-direction: column;
    }

    .admin-review-actions .btn-sm {
        width: 100%;
        min-height: 44px;
    }

    .detail-actions-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .detail-actions-bar .details-btn,
    .detail-actions-bar .details-btn-alt {
        width: 100%;
        text-align: center;
        min-height: 44px;
    }

    .detail-title-row {
        flex-direction: column;
        gap: 10px;
    }

    .heart-btn {
        align-self: flex-start;
    }

    .toast {
        bottom: calc(var(--mobile-nav-height) + 12px + env(safe-area-inset-bottom, 0));
        left: 16px;
        right: 16px;
        transform: none;
        text-align: center;
        max-width: none;
    }

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

@media (max-width: 480px) {
    .topbar .top-btn span[aria-hidden="true"] {
        font-size: 18px;
    }

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

    .mobile-nav-label {
        font-size: 9px;
    }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

/* In-app browsers (Messenger / Facebook) — JS adds html.mobile-layout when viewport is misleading */

html.mobile-layout {
    --mobile-nav-height: 64px;
}

html.mobile-layout body {
    overflow: auto;
}

html.mobile-layout .sidebar {
    display: none !important;
}

html.mobile-layout .dashboard {
    flex-direction: column;
    height: 100vh;
    height: 100dvh;
    min-height: 100dvh;
}

html.mobile-layout .content {
    flex: 1;
    padding: 12px 12px 0;
    min-height: 0;
    min-width: 0;
    width: 100%;
    padding-bottom: calc(var(--mobile-nav-height) + env(safe-area-inset-bottom, 0));
}

html.mobile-layout .map-container {
    flex: 1;
    min-height: 0;
    width: 100%;
    touch-action: manipulation;
}

html.mobile-layout #map.leaflet-container {
    height: 100%;
    width: 100%;
}

html.mobile-layout .leaflet-control-zoom {
    margin-top: calc(8px + env(safe-area-inset-top, 0));
    margin-left: calc(8px + env(safe-area-inset-left, 0));
    border: none;
    box-shadow: var(--shadow-md);
}

html.mobile-layout .leaflet-control-zoom a {
    width: 44px;
    height: 44px;
    line-height: 44px;
    font-size: 22px;
}

html.mobile-layout .leaflet-control-attribution {
    font-size: 10px;
    max-width: 55%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

html.mobile-layout .map-markers-toggle {
    bottom: calc(12px + env(safe-area-inset-bottom, 0));
    right: calc(10px + env(safe-area-inset-right, 0));
    padding: 11px 14px;
    font-size: 13px;
    min-height: 44px;
}

html.mobile-layout .map-world-view-btn {
    bottom: calc(58px + env(safe-area-inset-bottom, 0));
    right: calc(10px + env(safe-area-inset-right, 0));
    min-height: 44px;
    padding: 11px 14px;
    font-size: 13px;
}

html.mobile-layout .marker-cluster-small div,
html.mobile-layout .marker-cluster-medium div,
html.mobile-layout .marker-cluster-large div {
    width: 40px;
    height: 40px;
    margin-left: -20px;
    margin-top: -20px;
    line-height: 40px;
    font-size: 14px;
}

html.mobile-layout .mobile-bottom-nav {
    display: grid !important;
}

html.mobile-layout .directory-sheet-close {
    display: flex !important;
}

html.mobile-layout .directory-panel {
    display: flex !important;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: none;
    height: min(78vh, calc(100dvh - var(--mobile-nav-height) - 12px));
    z-index: 16900;
    border-left: none;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -12px 40px rgba(2, 53, 60, 0.22);
    transform: translateY(105%);
    transition: transform 0.32s cubic-bezier(0.32, 0.72, 0, 1);
    padding-bottom: env(safe-area-inset-bottom, 0);
    background: var(--light-elevated);
    isolation: isolate;
}

html.mobile-layout.directory-sheet-open .directory-panel,
html.mobile-layout body.directory-sheet-open .directory-panel {
    transform: translateY(0);
}

html.mobile-layout .content.view-directory .directory-panel {
    display: none !important;
}

html.mobile-layout .content.view-directory .map-container {
    display: none;
}

html.mobile-layout .mobile-sheet-backdrop {
    display: block;
}

html.mobile-layout .mobile-sheet-backdrop[hidden] {
    display: none !important;
}

html.mobile-layout .mobile-menu-panel {
    display: flex;
}

html.mobile-layout .mobile-menu-panel[hidden] {
    display: none !important;
}

html.mobile-layout .topbar {
    flex-wrap: wrap;
}

html.mobile-layout .search-wrap {
    flex: 1 1 100%;
    order: 1;
}

html.mobile-layout .top-btn span:not([aria-hidden]) {
    display: none;
}

html.mobile-layout .modal {
    padding: 0;
    align-items: flex-end;
}

html.mobile-layout .modal-dialog {
    max-width: none;
    width: 100%;
    max-height: 94dvh;
    border-radius: 20px 20px 0 0;
}
