:root {
    /* MAC theme colors */
    --mac-primary: #059669;
    --mac-primary-dark: #047857;
    --mac-secondary: #0284c7;
    --mac-accent: #d97706;
    --mac-danger: #dc2626;
    --mac-success: #16a34a;

    /* Generic theme colors */
    --primary: #2d5f3f;
    --secondary: #c9a878;
    --success: #3fa373;
    --warning: #d4a56f;
    --danger: #a75c5c;
}

* {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    min-height: 100vh;
}

/* Header */
header {
    background: linear-gradient(135deg, #047857 0%, #059669 50%, #10b981 100%);
}

body[data-center-id]:not([data-center-id="all-centers"]) header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

header:has(.portal-nav-tab) {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

body[data-center-id]:not([data-center-id="all-centers"]) header > div > .flex.justify-between {
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

body[data-center-id]:not([data-center-id="all-centers"]) header > div > .flex.justify-between > nav {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
}

header:has(.portal-nav-tab) > div > .flex.justify-between {
    flex-wrap: wrap;
    gap: 0.75rem 1.5rem;
}

header:has(.portal-nav-tab) > div > .flex.justify-between > nav {
    width: 100%;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Center dashboard utilities */
body[data-center-id] .card-header {
    border-left: 4px solid var(--primary);
}

body[data-center-id] .btn-primary {
    background: var(--primary);
    color: #ffffff;
}

body[data-center-id] .btn-primary:hover {
    background: #1f4228;
}

body[data-center-id] .status-red {
    background: rgba(167, 92, 92, 0.1);
    color: var(--danger);
}

body[data-center-id] .status-green {
    background: rgba(63, 163, 115, 0.1);
    color: var(--success);
}

body[data-center-id] .status-yellow {
    background: rgba(212, 165, 111, 0.1);
    color: var(--warning);
}

body[data-center-id] .chart-container {
    position: relative;
    height: 300px;
    margin: 20px 0;
}

body[data-center-id] .kpi-value {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--primary);
}

body[data-center-id] .kpi-label {
    font-size: 0.875rem;
    color: #020202;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 600;
}

body[data-center-id] .formula-box {
    display: none;
    margin-top: 16px;
    padding: 16px;
    background: #f0f4f8;
    border-radius: 8px;
}

body[data-center-id] .formula-box.active {
    display: block;
}

body[data-center-id] .formula-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    margin-top: 8px;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    background: var(--primary);
    color: #ffffff;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

body[data-center-id] .formula-btn:hover {
    background: #1f4228;
}

body[data-center-id] .audience-card {
    cursor: pointer;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

body[data-center-id] .audience-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}

/* Modal overlay */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(4px);
}

.modal-dialog {
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 640px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    animation: modalSlideIn 0.25s ease-out;
}

@keyframes modalSlideIn {
    from { opacity: 0; transform: translateY(-30px) scale(0.95); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    padding: 20px 24px 12px;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #111827;
}

.modal-close-btn {
    background: none;
    border: none;
    font-size: 1.75rem;
    line-height: 1;
    color: #6b7280;
    cursor: pointer;
    padding: 0 4px;
    transition: color 0.15s;
}

.modal-close-btn:hover { color: #111827; }

.modal-body {
    padding: 16px 24px;
    overflow-y: auto;
    flex: 1;
}

.modal-event-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modal-event-list li {
    padding: 12px 0;
    border-bottom: 1px solid #f3f4f6;
    display: flex;
    align-items: center;
    gap: 12px;
}

.modal-event-list li:last-child { border-bottom: none; }

.modal-event-list a {
    color: #2563eb;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.95rem;
    transition: color 0.15s;
    flex: 1;
}

.modal-event-list a:hover {
    color: #1d4ed8;
    text-decoration: underline;
}

.modal-event-list .event-badge {
    font-size: 0.7rem;
    background: #f3f4f6;
    color: #6b7280;
    padding: 2px 8px;
    border-radius: 999px;
    white-space: nowrap;
}

.modal-footer {
    padding: 12px 24px 20px;
    border-top: 1px solid #e5e7eb;
    text-align: right;
}

.modal-close-footer-btn {
    background: #f3f4f6;
    color: #374151;
    border: none;
    padding: 8px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.modal-close-footer-btn:hover { background: #e5e7eb; }

body[data-center-id] .interactive-row {
    transition: background-color 0.2s ease;
}

body[data-center-id] .interactive-row:hover {
    background: #f0f4f8 !important;
    cursor: pointer;
}

body[data-center-id] .card {
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

body[data-center-id] .card:hover {
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
}

/* Navigation tabs */
.nav-tab {
    transition: all 0.2s ease;
    white-space: nowrap;
}

.mac-analytics {
    font-family: 'DM Sans', sans-serif;
    color: #0f172a;
    background: #ffffff;
    max-width: 100%;
}

.mac-analytics h2,
.mac-analytics h3,
.mac-analytics h4 {
    font-family: 'Space Grotesk', sans-serif;
    color: #0f172a;
}

/* Tabs navigation */
.mac-tabs-nav {
    display: flex;
    gap: 4px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 4px;
    position: relative;
    margin-bottom: 1.5rem;
}

.mac-tab-btn {
    flex: 1;
    padding: .6rem .8rem;
    border: none;
    background: transparent;
    color: #64748b;
    font-family: 'Space Grotesk', sans-serif;
    font-size: .82rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: 8px;
    transition: color .2s;
    position: relative;
    z-index: 2;
    white-space: nowrap;
}

.mac-tab-btn:hover { color: #0f172a; }
.mac-tab-btn.mac-active { color: #ffffff; }

.mac-tab-slider {
    position: absolute;
    top: 4px;
    left: 4px;
    height: calc(100% - 8px);
    background: #16a34a;
    border-radius: 8px;
    transition: transform .3s cubic-bezier(.4,0,.2,1), width .3s cubic-bezier(.4,0,.2,1);
    z-index: 1;
}

/* Panels */
.mac-panel { display: none; }
.mac-panel.mac-visible { display: block; animation: macFadeUp .3s ease; }

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

/* Metric cards */
.mac-metric-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.2rem;
    transition: border-color .2s, transform .2s;
    position: relative;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.mac-metric-card::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    background: #16a34a;
    opacity: 0;
    transition: opacity .2s;
}

.mac-metric-card:hover {
    border-color: #cbd5e1;
    transform: translateY(-1px);
}

.mac-metric-card:hover::after { opacity: 1; }

.mac-metric-card.mac-coral::after { background: #ef4444; }
.mac-metric-card.mac-amber::after { background: #f59e0b; }
.mac-metric-card.mac-blue::after { background: #3b82f6; }
.mac-metric-card.mac-purple::after { background: #8b5cf6; }

.mac-icon-box {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: .85rem;
    margin-bottom: .7rem;
}

.mac-val {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.65rem;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: .2rem;
    color: #0f172a;
}

.mac-lbl { font-size: .75rem; color: #64748b; }
.mac-sub { font-size: .68rem; color: #94a3b8; margin-top: .25rem; }

/* Chart cards */
.mac-chart-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 1rem 1.2rem .8rem;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

.mac-chart-card h3 {
    font-size: .8rem;
    font-weight: 600;
    color: #0f172a;
    margin-bottom: .1rem;
}

.mac-chart-card .mac-csub {
    font-size: .68rem;
    color: #64748b;
    margin-bottom: .8rem;
}

.mac-cw { position: relative; height: 300px; }
.mac-cw.mac-t { height: 380px; }

/* Legend */
.mac-legend {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    margin-bottom: .6rem;
}

.mac-legend-item {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: .68rem;
    color: #64748b;
}

.mac-legend-item span {
    width: 7px;
    height: 7px;
    border-radius: 2px;
    display: inline-block;
}

/* Table */
.mac-align-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.mac-at {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: .74rem;
}

.mac-at thead th {
    background: #f8fafc;
    color: #64748b;
    font-family: 'Space Grotesk', sans-serif;
    font-weight: 600;
    font-size: .64rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    padding: .55rem .45rem;
    text-align: center;
    border-bottom: 1px solid #e2e8f0;
    white-space: nowrap;
}

.mac-at thead th:first-child { text-align: left; border-radius: 6px 0 0 0; }
.mac-at thead th:last-child { border-radius: 0 6px 0 0; }

.mac-at tbody tr { transition: background .15s; }
.mac-at tbody tr:hover { background: #f8fafc; }

.mac-at tbody td {
    padding: .5rem .45rem;
    text-align: center;
    border-bottom: 1px solid #edf2f7;
}

.mac-at tbody td:first-child {
    text-align: left;
    font-weight: 600;
    color: #0f172a;
    white-space: nowrap;
    font-size: .76rem;
}

.mac-at tbody tr:last-child td { border-bottom: none; }

/* Score badges */
.mac-sc {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 5px;
    font-weight: 700;
    font-size: .7rem;
}

.mac-sc-0 { background: rgba(239,68,68,.12); color: #ef4444; }
.mac-sc-1 { background: rgba(251,146,60,.12); color: #fb923c; }
.mac-sc-2 { background: rgba(245,158,11,.12); color: #f59e0b; }
.mac-sc-3 { background: rgba(22,163,74,.12); color: #16a34a; }

/* NPS badges */
.mac-nb {
    display: inline-block;
    padding: 1px 7px;
    border-radius: 5px;
    font-weight: 700;
    font-size: .7rem;
}

.mac-nb-h { background: rgba(22,163,74,.12); color: #16a34a; }
.mac-nb-m { background: rgba(245,158,11,.12); color: #f59e0b; }
.mac-nb-l { background: rgba(251,146,60,.12); color: #fb923c; }
.mac-nb-c { background: rgba(239,68,68,.12); color: #ef4444; }

/* Mobile adjustments */
@media (max-width: 768px) {
    /* Formula responsive tweaks */
    .formula-toggle { font-size: 0.7rem; padding: 6px; }
    .formula-btn { font-size: 0.88rem; padding: 0.65rem 0.95rem; }
    .formula-content,
    .formula-box { padding: 10px; font-size: 0.7rem; }
    .formula-content h5 { font-size: 0.75rem; }
    .formula-content .formula-box { font-size: 0.65rem; padding: 6px 8px; }

    .mac-val { font-size: 1.3rem; }
    .mac-cw { height: 240px; }
    .mac-cw.mac-t { height: 300px; }
    .mac-tab-btn { font-size: .72rem; padding: .5rem .4rem; }
    .mac-tab-btn i { display: none; }
    .mac-at { font-size: .66rem; }
    .mac-at thead th { font-size: .58rem; padding: .4rem .3rem; }
    .mac-sc { width: 20px; height: 20px; font-size: .6rem; }
    .kpi-card h3 { font-size: 1.5rem; }
    header h1 { font-size: 1.25rem; }
    .nav-tab { padding: .75rem 1rem; font-size: .875rem; }

    /* Shared portal navigation on small screens: ONE centered, wrapping row used
       by every page that renders the portal nav (centre dashboards, programs &
       events, masjid calendar, KB/Q&A centre headers and their JS fallbacks). The
       active item only swaps link colors — it never changes layout, width, or
       alignment. The old data-center-id-only override (which hit the first three
       navs but not KB/Q&A) is removed so all six nav items behave exactly alike. */
    body[data-center-id]:not([data-center-id="all-centers"]) header > div > .flex.justify-between > nav,
    header:has(.portal-nav-tab) > div > .flex.justify-between > nav,
    header:not(.bg-emerald-800) nav:has(.portal-nav-tab) {
        width: 100%;
        flex-wrap: wrap;
        justify-content: center;
        align-items: center;
        gap: 0.5rem 0.375rem;
        padding-top: 0.75rem;
        border-top: 1px solid #e5e7eb;
    }
    header:not(.bg-emerald-800) nav:has(.portal-nav-tab) .portal-nav-tab {
        width: auto;
        white-space: nowrap;
    }

    /* Same treatment for the index page (MAC Executive Dashboard) header. */
    header.bg-emerald-800 > div > .flex.items-center { flex-direction: column; align-items: stretch; gap: 1rem; }
    header.bg-emerald-800 > div > .flex.items-center > .page-nav { width: 100%; flex-wrap: wrap; gap: .5rem; padding-top: 1rem; border-top: 1px solid rgba(255,255,255,.2); justify-content: flex-start; }
    header.bg-emerald-800 > div > .flex.items-center > .page-nav a { flex: 1 1 auto; text-align: center; }
}

/* Reduced motion */
@media (prefers-reduced-motion:reduce) {
    .mac-tab-slider,
    .mac-metric-card,
    .mac-panel {
        animation: none !important;
        transition: none !important;
    }
}

/* Interactive elements */
.nav-tab:hover { background-color: rgba(5,150,105,0.05); }
.nav-tab.active { color: var(--mac-primary); border-bottom-color: var(--mac-primary); background-color: rgba(5,150,105,0.05); }

.kpi-card { transition: all 0.3s ease; }
.kpi-card:hover { transform: translateY(-2px); box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1); }

.masjid-card { transition: all 0.3s ease; }
.masjid-card:hover { transform: translateY(-4px); box-shadow: 0 20px 40px -10px rgba(0,0,0,0.15); }

.masjid-card .card-header { position: relative; overflow: hidden; }
.masjid-card .card-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, transparent 0%, rgba(0,0,0,0.1) 100%);
}

.masjid-card .last-updated-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    color: #d1fae5;
    font-weight: 600;
    white-space: nowrap;
    padding: 3px 10px;
    background: rgba(255,255,255,0.1);
    border-radius: 9999px;
    line-height: 1.5;
}

.metric-mini-card {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 1.25rem 0.5rem;
    text-align: center;
    transition: border-color 0.2s, transform 0.2s;
    position: relative;
    z-index: 1;
}
.metric-mini-card:hover {
    border-color: #10b981;
    transform: translateY(-1px);
}

.metric-info-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #d1d5db;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    font-style: normal;
    cursor: help;
    line-height: 1;
    transition: background 0.2s;
    user-select: none;
}
.metric-info-icon:hover {
    background: #059669 !important;
}
.metric-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: #059669;
    line-height: 1.2;
    margin-bottom: 0.25rem;
}
.metric-label {
    font-size: 10px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
}

.btn-dashboard {
    display: inline-flex;
    align-items: center;
    background: linear-gradient(135deg, #059669, #047857);
    color: #fff;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    transition: all 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.btn-dashboard:hover {
    background: linear-gradient(135deg, #047857, #059669);
    box-shadow: 0 4px 12px rgba(5,150,105,0.3);
    transform: translateY(-1px);
}

.btn-events {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #374151;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    transition: all 0.2s;
}
.btn-events:hover {
    border-color: #10b981;
    color: #059669;
    box-shadow: 0 2px 8px rgba(5,150,105,0.15);
}

.btn-calendar {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #374151;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    transition: all 0.2s;
}
.btn-calendar:hover {
    border-color: #6366f1;
    color: #4338ca;
    box-shadow: 0 2px 8px rgba(99,102,241,0.15);
}

/* Masjid card header logo */
.masjid-card .masjid-logo-link {
    display: inline-flex;
    line-height: 0;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

.masjid-card .masjid-logo {
    width: 44px;
    height: 44px;
    object-fit: contain;
    background: #fff;
    border-radius: 50%;
    padding: 4px;
    transition: transform 0.2s ease;
}

.masjid-card .masjid-logo-link:hover .masjid-logo {
    transform: scale(1.06);
}

/* Indent the location line so it lines up with the name text (logo width + gap) */
.masjid-card .masjid-card-location {
    padding-left: 3.5rem;
}

/* Icon badge atop each mini metric card */
.metric-mini-card .metric-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    margin: 0 auto 0.5rem;
    border-radius: 50%;
    background: #ecfdf5;
    color: #059669;
    font-size: 14px;
}

/* Three action links at the bottom of each masjid card */
.masjid-card-links {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
}

.masjid-card-links > a {
    justify-content: center;
    text-align: center;
    white-space: nowrap;
}

/* Default: show the full label, hide the short one */
.masjid-card-links .btn-label-short {
    display: none;
}
.masjid-card-links .btn-label-full {
    display: inline;
}

.btn-narrative {
    display: inline-flex;
    align-items: center;
    background: #fff;
    color: #374151;
    padding: 0.625rem 1.25rem;
    border-radius: 0.5rem;
    font-weight: 600;
    font-size: 0.875rem;
    border: 1px solid #d1d5db;
    transition: all 0.2s;
}

.btn-narrative:hover {
    border-color: #f59e0b;
    color: #b45309;
    box-shadow: 0 2px 8px rgba(245,158,11,0.15);
}

/* Search suggestions dropdown */
#searchSuggestions {
    box-shadow: 0 8px 24px rgba(0,0,0,0.12);
    border: 1px solid #e5e7eb;
}
#searchSuggestions .suggestion-item {
    cursor: pointer;
    transition: background 0.15s;
}
#searchSuggestions .suggestion-item:focus {
    outline: none;
    background: #ecfdf5;
}
#searchSuggestions .suggestion-item:hover {
    background: #f0fdf4;
}

/* Center filter dropdown arrow override */
#centerFilter {
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    background-size: 1rem;
    padding-right: 2.25rem;
}

/* Province badges */
.province-qc { background-color: #dbeafe; color: #1e40af; }
.province-on { background-color: #dcfce7; color: #166534; }
.province-ab { background-color: #fef3c7; color: #92400e; }
.province-bc { background-color: #fce7f3; color: #9d174d; }

/* Status badges */
.badge-active { background-color: #dcfce7; color: #166534; }
.badge-growing { background-color: #dbeafe; color: #1e40af; }
.badge-developing { background-color: #fef3c7; color: #92400e; }

/* Table styles */
table th { font-weight: 600; letter-spacing: 0.05em; }
table tbody tr:hover { background-color: #f9fafb; }

/* Chart container */
canvas { max-width: 100%; }

/* Print styles */
@media print {
    header button, nav { display: none !important; }
    .tab-content { display: block !important; page-break-inside: avoid; }
    .kpi-card, .masjid-card { break-inside: avoid; }
    body { background: white; }
    .shadow-sm, .shadow-lg { box-shadow: none !important; border: 1px solid #e5e7eb; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #f1f5f9; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* Loading spinner */
.loading-spinner {
    border: 3px solid #f3f3f3;
    border-top: 3px solid var(--mac-primary);
    border-radius: 50%;
    width: 30px;
    height: 30px;
    animation: spin 1s linear infinite;
}

@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Feature icons */
.feature-icon {
    width: 24px;
    height: 24px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 12px;
}

.feature-icon.available { background-color: #dcfce7; color: #166534; }
.feature-icon.unavailable { background-color: #fee2e2; color: #991b1b; }

/* Programs accordion */
.program-toggle { cursor: pointer; }
.program-toggle .fa-chevron-down { transition: transform 0.3s ease; }
.program-toggle .fa-chevron-down.rotate-180 { transform: rotate(180deg); }
#programsAccordion > div { transition: all 0.3s ease; }
#programsAccordion > div:hover { box-shadow: 0 4px 15px rgba(0,0,0,0.1); }

/* Decision center */
.decision-card { border-left: 4px solid; }
.decision-card.high { border-left-color: var(--mac-danger); }
.decision-card.medium { border-left-color: var(--mac-accent); }
.decision-card.low { border-left-color: var(--mac-success); }

/* Info links */
.info-link {
    display: inline-flex;
    align-items: center;
    color: var(--mac-secondary);
    font-size: 0.875rem;
    text-decoration: none;
    transition: all 0.2s ease;
}
.info-link:hover { color: var(--mac-primary); text-decoration: underline; }

/* Tooltip */
.tooltip { position: relative; }
.tooltip::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    padding: 0.5rem 1rem;
    background: #1f2937;
    color: white;
    font-size: 0.75rem;
    border-radius: 4px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: all 0.2s ease;
}
.tooltip:hover::after { opacity: 1; visibility: visible; }

/* Capacity bar */
.capacity-bar { height: 8px; background-color: #e5e7eb; border-radius: 4px; overflow: hidden; }
.capacity-bar-fill { height: 100%; background: linear-gradient(90deg, var(--mac-primary), var(--mac-secondary)); border-radius: 4px; transition: width 0.5s ease; }

/* Service tag */
.service-tag {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.75rem;
    background-color: #f3f4f6;
    border-radius: 9999px;
    font-size: 0.75rem;
    color: #4b5563;
    margin: 0.25rem;
}
.service-tag i { margin-right: 0.375rem; color: var(--mac-primary); }

/* Highlight box */
.highlight-box { background: linear-gradient(135deg, #ecfdf5 0%, #f0f9ff 100%); border: 1px solid #a7f3d0; }

/* View details button */
.view-details-btn {
    display: block;
    width: 100%;
    background: linear-gradient(135deg, #059669 0%, #10b981 100%);
    color: white;
    text-align: center;
    padding: 0.75rem 1rem;
    border-radius: 0.5rem;
    font-weight: 500;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    text-decoration: none;
}
.view-details-btn:hover { background: linear-gradient(135deg, #047857 0%, #059669 100%); box-shadow: 0 4px 8px rgba(0,0,0,0.15); transform: translateY(-1px); }
.view-details-btn i { margin-right: 0.5rem; }

/* Formula / Metrics explanation */
.formula-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    border-radius: 0.5rem;
    color: #64748b;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.formula-toggle:hover {
    background: #f1f5f9;
    border-color: #94a3b8;
    color: #475569;
}

.formula-toggle i {
    margin-right: 0.375rem;
    transition: transform 0.3s ease;
}

.formula-toggle.active i {
    transform: rotate(180deg);
}

.formula-content {
    display: none;
    margin-top: 0.75rem;
    padding: 1rem;
    background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
    border: 1px solid #e2e8f0;
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: #475569;
    animation: slideDown 0.3s ease;
}

.formula-content.show {
    display: block;
}

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

.formula-content h5 {
    display: flex;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: #334155;
}

.formula-content h5 i {
    margin-right: 0.375rem;
    color: var(--mac-primary);
}

.formula-content ul {
    margin: 0;
    padding-left: 1rem;
    list-style: disc;
}

.formula-content li {
    margin-bottom: 0.25rem;
    line-height: 1.4;
}

.formula-content .formula-box {
    margin: 0.5rem 0;
    padding: 0.5rem 0.75rem;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 0.375rem;
    color: #1e293b;
    font-family: "Consolas", "Monaco", monospace;
    font-size: 0.7rem;
}

.formula-content .interpretation {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px dashed #cbd5e1;
}

.formula-content .interpretation-item {
    display: flex;
    align-items: center;
    margin-bottom: 0.25rem;
}

.formula-content .interpretation-item .dot {
    width: 8px;
    height: 8px;
    margin-right: 0.5rem;
    border-radius: 50%;
    flex-shrink: 0;
}

.formula-content .interpretation-item .dot.red { background-color: #ef4444; }
.formula-content .interpretation-item .dot.yellow { background-color: #f59e0b; }
.formula-content .interpretation-item .dot.green { background-color: #22c55e; }
.formula-content .interpretation-item .dot.blue { background-color: #3b82f6; }
.formula-content .interpretation-item .dot.pink { background-color: #ec4899; }
.formula-content .interpretation-item .dot.purple { background-color: #8b5cf6; }
.formula-content .interpretation-item .dot.indigo { background-color: #6366f1; }
.formula-content .interpretation-item .dot.teal { background-color: #14b8a6; }

.formula-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.7rem 1rem;
    margin-top: 0.25rem;
    background: #214e2f;
    border: 0;
    border-radius: 0.75rem;
    color: #fff;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(33, 78, 47, 0.18);
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.formula-btn:hover {
    background: #183d24;
    box-shadow: 0 8px 18px rgba(33, 78, 47, 0.24);
    transform: translateY(-1px);
}

.formula-btn:active {
    transform: translateY(0);
    box-shadow: 0 4px 10px rgba(33, 78, 47, 0.16);
}

.formula-btn:focus-visible {
    outline: 2px solid rgba(33, 78, 47, 0.35);
    outline-offset: 2px;
}

.formula-box {
    display: none;
    margin-top: 1rem;
    padding: 1.1rem 1.25rem;
    background: #eef2f7;
    border: 1px solid #e1e8f0;
    border-radius: 1rem;
    color: #111827;
    line-height: 1.65;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.formula-box.active {
    display: block;
}

.formula-box p {
    margin: 0;
}

.formula-box ul {
    margin: 0.5rem 0 0;
    padding-left: 1.15rem;
}

.formula-box li + li {
    margin-top: 0.45rem;
}

.formula-box strong {
    color: #0f172a;
}

.data-source-link {
    color: #2563eb;
    text-decoration: underline;
    font-weight: 500;
}

body.events-page {
    --green: #059669; /* Matches Westmount Emerald-600 */
    --green-hover: #047857;
    --dark: #064e3b;
    --gold: #d97706;
    --gold-light: #fef3c7;
    --ink: #111827;
    --muted: #4b5563;
    --line: #e5e7eb;
    --bg: #f9fafb;
    margin: 0;
    background-color: var(--bg) !important;
    color: var(--ink) !important;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

body.events-page * { box-sizing: border-box; }
body.events-page:not([data-center-id="all-centers"]) a:not(.portal-nav-tab):not(.event-link) { color: inherit; text-decoration: none; }

/* Keep dashboard portal nav labels on a single line */
.portal-nav-tab { white-space: nowrap; }

body.events-page .skip {
    position: absolute; left: -999px;
}
body.events-page .skip:focus {
    left: 12px; top: 12px; background: #fff; padding: 10px; z-index: 9;
}

body.events-page .max-width-container {
    max-width: 1536px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}
@media(min-width: 640px) {
    body.events-page .max-width-container {
        padding-left: 2rem !important;
        padding-right: 2rem !important;
    }
}
@media(min-width: 1024px) {
    body.events-page .max-width-container {
        padding-left: 3rem !important;
        padding-right: 3rem !important;
    }
}

body.events-page:not([data-center-id="all-centers"]) header {
    background: #ffffff !important;
    border-bottom: 1px solid #f3f4f6 !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

body.events-page .hero {
    background: linear-gradient(135deg, #064e3b 0%, #059669 100%) !important;
    color: #ffffff !important;
    padding: 3rem 0 !important;
    margin-bottom: 2.5rem !important;
}
body.events-page .hero-content {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
body.events-page .eyebrow {
    color: #fef08a !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.1em !important;
}
body.events-page h1 {
    line-height: 1.15 !important;
    margin: 0.25rem 0 0.75rem 0 !important;
}
body.events-page .hero p {
    font-size: 1.125rem !important;
    max-width: 56rem !important;
    color: #d1fae5 !important;
    line-height: 1.6 !important;
    margin: 0 !important;
}

body.events-page .main {
    padding-bottom: 5rem !important;
}

/* ===== STAT CARDS (Goal 2, 4) ===== */
body.events-page .metrics {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 0.75rem !important;
    margin-bottom: 0 !important;
    padding: 0.65rem !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}

body.events-page .metric {
    background: #ffffff !important;
    border: none !important;
    background: #ffffff !important;
    border: 1px solid #f3f4f6 !important;
    border-radius: 0.75rem !important;
    padding: 0.75rem 0.9rem !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03) !important;
    transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.65rem !important;
    position: relative !important;
}

body.events-page .metric:hover {
    transform: translateY(-2px) !important;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04) !important;
}

body.events-page .metrics.has-active-stat .metric:not(.stat-active) {
    opacity: 0.45 !important;
}

body.events-page .metrics.has-active-stat .metric.stat-active:hover,
body.events-page .metrics.has-active-stat .metric:not(.stat-active):hover {
    opacity: 1 !important;
}

body.events-page .metric.stat-active {
    border: 1px solid #059669 !important;
    box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15), 0 4px 6px -1px rgba(0,0,0,0.05) !important;
}

body.events-page .metric-icon {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    flex-shrink: 0;
}
body.events-page .metric-icon-blue { background: #dbeafe; color: #2563eb; }
body.events-page .metric-icon-purple { background: #ede9fe; color: #7c3aed; }
body.events-page .metric-icon-pink { background: #fce7f3; color: #db2777; }
body.events-page .metric-icon-amber { background: #fef3c7; color: #d97706; }
body.events-page .metric-icon-teal { background: #ccfbf1; color: #0d9488; }

body.events-page .metric-body {
    flex: 1;
    min-width: 0;
}

body.events-page .metric b {
    display: block !important;
    font-size: 1.5rem !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    margin-bottom: 0.05rem !important;
    color: #111827 !important;
}

body.events-page .metric span {
    color: #6b7280 !important;
    font-size: 0.68rem !important;
    font-weight: 600 !important;
}

body.events-page .metric.metric-clickable {
    cursor: pointer !important;
}

body.events-page .metric.metric-clickable:hover {
    border-color: #d1d5db !important;
}

body.events-page .metric-chevron {
    position: absolute;
    right: 1rem;
    bottom: 1rem;
    font-size: 0.7rem;
    color: #d1d5db;
    opacity: 0;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

body.events-page .metric.metric-clickable:hover .metric-chevron {
    opacity: 1;
    transform: translateX(2px);
}

/* ===== SECTION STYLING ===== */
body.events-page section {
    margin-bottom: 4rem !important;
}

body.events-page .section-head {
    display: flex !important;
    justify-content: space-between !important;
    align-items: flex-end !important;
    gap: 1.5rem !important;
    margin-bottom: 1.5rem !important;
    border-bottom: 1px solid #f3f4f6 !important;
    padding-bottom: 0.75rem !important;
}

body.events-page h2 {
    font-size: 1.75rem !important;
    font-weight: 800 !important;
    margin: 0 !important;
    letter-spacing: -0.025em !important;
}

body.events-page .section-head p {
    margin: 0.25rem 0 0 0 !important;
    color: #6b7280 !important;
    font-size: 0.95rem !important;
}

body.events-page .section-head > span {
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    color: var(--green) !important;
    background-color: #ecfdf5 !important;
    padding: 0.25rem 0.75rem !important;
    border-radius: 9999px !important;
    white-space: nowrap !important;
}

/* ===== HEADER TOOLBAR (Goal 1) ===== */
body.events-page .toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 2rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    padding: 0.5rem;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

body.events-page .toolbar-segments {
    display: flex;
    gap: 2px;
    background: #f1f5f9;
    border-radius: 8px;
    padding: 2px;
    flex-shrink: 0;
}

body.events-page .toolbar-seg {
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    font-family: inherit;
}
body.events-page .toolbar-seg:hover { color: #0f172a; }
body.events-page .toolbar-seg.active {
    background: #ffffff;
    color: #059669;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
body.events-page .toolbar-seg:focus-visible {
    outline: 2px solid #059669;
    outline-offset: 2px;
}

body.events-page .toolbar-search {
    flex: 1;
    position: relative;
    display: flex;
    align-items: center;
}

body.events-page .toolbar-search input {
    width: 100%;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.45rem 0.75rem 0.45rem 2.25rem;
    font-size: 0.875rem;
    font-family: inherit;
    color: #0f172a;
    outline: none;
    background: #f8fafc;
    transition: border-color 0.2s ease, background 0.2s ease;
}
body.events-page .toolbar-search input:focus {
    border-color: #059669;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(5,150,105,0.1);
}
body.events-page .toolbar-search input::placeholder { color: #94a3b8; }

body.events-page .toolbar-search-icon {
    position: absolute;
    left: 0.75rem;
    color: #94a3b8;
    font-size: 0.85rem;
    pointer-events: none;
}

body.events-page .toolbar-search-clear {
    display: none;
    position: absolute;
    right: 0.5rem;
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.75rem;
    border-radius: 4px;
}
body.events-page .toolbar-search input:not(:placeholder-shown) ~ .toolbar-search-clear {
    display: flex;
}
body.events-page .toolbar-search-clear:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* Calendar page search: inline clear button */
.calendar-search-clear {
    display: none;
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.2rem;
    font-size: 0.75rem;
    border-radius: 4px;
}
#searchFilter:not(:placeholder-shown) ~ .calendar-search-clear {
    display: flex;
    align-items: center;
    justify-content: center;
}
.calendar-search-clear:hover {
    color: #ef4444;
    background: #fef2f2;
}

/* ===== BROWSE CHIPS (Goal 10, 6, 7) ===== */
body.events-page .browse {
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 0.75rem !important;
    margin-top: 1rem !important;
}

body.events-page .chip {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    border-radius: 9999px !important;
    padding: 0.5rem 1.25rem !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    color: #4b5563 !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
}

body.events-page .chip i { font-size: 0.9rem; }

body.events-page .chip:hover {
    border-color: var(--green) !important;
    color: var(--green) !important;
    transform: translateY(-1px) !important;
}

body.events-page .chip span {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    padding: 0.125rem 0.5rem !important;
    border-radius: 9999px !important;
}

body.events-page .chip:hover span {
    background-color: #ecfdf5 !important;
    color: var(--green) !important;
}

body.events-page .chip.active {
    background-color: #059669 !important;
    border-color: #059669 !important;
    color: #ffffff !important;
}

body.events-page .chip.active span {
    background-color: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
}

/* ===== EVENTS TIME-FILTER BUTTONS (Goal 6: unified green) ===== */
body.events-page .events-time-btn {
    padding: 0.5rem 1.25rem !important;
    font-size: 0.875rem !important;
    font-weight: 700 !important;
    border: 1px solid #d1d5db !important;
    border-radius: 9999px !important;
    background: #fff !important;
    color: #4b5563 !important;
    cursor: pointer !important;
    transition: all 0.2s ease !important;
    line-height: 1.5 !important;
    box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05) !important;
}

body.events-page .events-time-btn:hover {
    border-color: var(--green) !important;
    color: var(--green) !important;
    transform: translateY(-1px) !important;
}

body.events-page .events-time-btn.active {
    background-color: #059669 !important;
    border-color: #059669 !important;
    color: #ffffff !important;
}

/* ===== COLLAPSIBLE SECTIONS ===== */
body.events-page .collapse-section .collapse-content {
    overflow: hidden !important;
    max-height: 0 !important;
    opacity: 0 !important;
    transition: max-height 0.35s ease, opacity 0.3s ease, margin 0.3s ease !important;
    margin: 0 !important;
}
body.events-page .collapse-section .section-head {
    cursor: pointer !important;
    user-select: none !important;
    margin-bottom: 0 !important;
}
body.events-page .collapse-section .section-head .collapse-icon {
    font-size: 1rem !important;
    color: #9ca3af !important;
    transition: transform 0.3s ease !important;
    flex-shrink: 0 !important;
}
body.events-page .collapse-section:not(.collapsed) .collapse-icon {
    transform: rotate(180deg) !important;
}
body.events-page .collapse-section:not(.collapsed) .collapse-content {
    max-height: 600px !important;
    opacity: 1 !important;
    margin-top: 1.25rem !important;
}

/* Section nav - fixed sidebar below sticky header */
.section-nav {
    position: fixed !important;
    right: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 0.125rem !important;
    z-index: 40 !important;
    background: rgba(255, 255, 255, 0.92) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(229, 231, 235, 0.6) !important;
    border-radius: 14px !important;
    padding: 0.5rem !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08) !important;
    max-height: calc(100vh - 10rem) !important;
    overflow-y: auto !important;
    width: 190px !important;
    transition: transform 0.3s ease !important;
}

/* Collapsed section nav — slides right, only the toggle button row stays visible */
.section-nav.collapsed {
    transform: translateX(calc(100% - 36px)) !important;
    overflow: hidden !important;
}
.section-nav.collapsed .section-nav-link,
.section-nav.collapsed .section-nav-group {
    opacity: 0 !important;
    pointer-events: none !important;
}

/* Section nav toggle button row (always visible, at the top of the nav) */
.section-nav-toggle {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.3rem !important;
    background: none !important;
    border: none !important;
    cursor: pointer !important;
    font-size: 0.7rem !important;
    padding: 0.3rem 0.2rem !important;
    color: #6b7280 !important;
    transition: color 0.2s ease !important;
    margin-bottom: 0.2rem !important;
    border-bottom: 1px solid #e5e7eb !important;
    width: 100% !important;
    flex-shrink: 0 !important;
}
.section-nav-toggle:hover {
    color: #059669 !important;
}
.section-nav-toggle .toggle-label {
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
    font-weight: 600 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.05em !important;
    font-size: 0.65rem !important;
    transition: opacity 0.2s ease !important;
}
.section-nav-toggle .toggle-label i {
    font-size: 0.7rem !important;
    color: #9ca3af !important;
    transition: color 0.2s ease !important;
}
.section-nav-toggle:hover .toggle-label i {
    color: #059669 !important;
}
.section-nav-toggle .toggle-chevron {
    font-size: 0.6rem !important;
    color: #9ca3af !important;
    transition: transform 0.3s ease !important;
}
.section-nav.collapsed .section-nav-toggle {
    justify-content: flex-start !important;
    border-bottom-color: transparent !important;
    padding: 0.65rem 0 0.65rem 0.65rem !important;
}
.section-nav.collapsed .section-nav-toggle .toggle-label {
    display: none !important;
}
.section-nav.collapsed .section-nav-toggle .toggle-chevron {
    display: none !important;
}

.section-nav-link {
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    padding: 0.4rem 0.6rem !important;
    border-radius: 6px !important;
    font-size: 0.78rem !important;
    font-weight: 500 !important;
    color: #4b6351 !important;
    text-decoration: none !important;
    transition: all 0.2s ease !important;
    border-left: 3px solid transparent !important;
}

.section-nav-link span {
    opacity: 1 !important;
    width: auto !important;
    overflow: visible !important;
    white-space: normal !important;
    line-height: 1.3 !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
    overflow-wrap: break-word !important;
}

.section-nav-link i {
    width: 1.1rem !important;
    text-align: center !important;
    color: #9ca3af !important;
    font-size: 0.85rem !important;
    transition: color 0.2s ease !important;
    flex-shrink: 0 !important;
}

.section-nav-link:hover {
    background: #f0fdf4 !important;
    color: #059669 !important;
}
.section-nav-link:hover i {
    color: #059669 !important;
}

.section-nav-link.active {
    background: #f0fdf4 !important;
    color: #166534 !important;
    font-weight: 600 !important;
    border-left: 3px solid #16a34a !important;
    border-radius: 6px !important;
}
.section-nav-link.active i {
    color: #16a34a !important;
}

/* Group heading within section nav */
.section-nav-group {
    font-size: 0.65rem !important;
    font-weight: 700 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.08em !important;
    color: #9ca3af !important;
    padding: 0.5rem 0.6rem 0.2rem !important;
    margin-top: 0.25rem !important;
    border-top: 1px solid #e5e7eb !important;
    pointer-events: none !important;
}

@media (max-width: 1024px) {
    .section-nav {
        display: none !important;
    }
}

/* Mobile section nav - bottom fixed bar */
.mobile-section-nav {
    display: none !important;
}

@media (max-width: 1024px) {
    .mobile-section-nav {
        display: flex !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        z-index: 999 !important;
        background: rgba(255, 255, 255, 0.96) !important;
        border-top: 1px solid #e5e7eb !important;
        padding: 0.5rem 0.75rem !important;
        overflow-x: auto !important;
        gap: 0.375rem !important;
        -webkit-overflow-scrolling: touch !important;
        scrollbar-width: none !important;
        box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.06) !important;
    }
    .mobile-section-nav::-webkit-scrollbar {
        display: none !important;
    }
    .mobile-section-nav-link {
        flex-shrink: 0 !important;
        padding: 0.4rem 0.75rem !important;
        font-size: 0.78rem !important;
        font-weight: 500 !important;
        color: #4b6351 !important;
        background: #f3f4f6 !important;
        border-radius: 999px !important;
        text-decoration: none !important;
        white-space: nowrap !important;
        transition: all 0.2s ease !important;
        border: 1px solid transparent !important;
    }
    .mobile-section-nav-link i {
        margin-right: 0.25rem !important;
    }
    .mobile-section-nav-link.active {
        background: #f0fdf4 !important;
        color: #166534 !important;
        font-weight: 600 !important;
        border-color: #16a34a !important;
    }
    body {
        padding-bottom: 4rem !important;
    }
}

body.events-page #browse-by-audience {
    margin-top: 2.5rem;
}

/* Smooth fade-in for event grid cards */
body.events-page .grid > .card {
    animation: cardFadeIn 0.35s ease forwards;
}

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

body.events-page .grid > .card:nth-child(2) { animation-delay: 0.03s; }
body.events-page .grid > .card:nth-child(3) { animation-delay: 0.06s; }
body.events-page .grid > .card:nth-child(4) { animation-delay: 0.09s; }
body.events-page .grid > .card:nth-child(5) { animation-delay: 0.12s; }
body.events-page .grid > .card:nth-child(6) { animation-delay: 0.15s; }

/* ===== INFO BANNER (Goal 9: neutral colors) ===== */
body.events-page .note {
    background-color: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-left: 4px solid #94a3b8 !important;
    color: #475569 !important;
    border-radius: 0.5rem !important;
    padding: 1rem 1.25rem !important;
    font-size: 0.95rem !important;
    margin-bottom: 3rem !important;
}

/* ===== TIME FILTER SECTION ===== */
body.events-page .time-filter-section {
    margin-bottom: 2rem;
}

body.events-page .time-filter-section .section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: default;
    padding: 0.5rem 0;
}

body.events-page .time-filter-section h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
}

body.events-page .time-filter-section p {
    font-size: 0.85rem;
    color: #6b7280;
    margin: 0;
}

body.events-page .time-filter-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid #e5e7eb;
}

/* ===== ACTIVE FILTERS SUMMARY BAR (Goal 8) ===== */
body.events-page .active-filters-bar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem 0.75rem;
    margin-bottom: 1.5rem;
    padding: 0.6rem 1rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
}

body.events-page .active-filters-bar .af-count {
    color: #64748b;
    font-weight: 600;
    white-space: nowrap;
}

body.events-page .active-filters-bar .af-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    flex: 1;
}

body.events-page .active-filters-bar .af-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem 0.2rem 0.75rem;
    background: #ffffff;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    font-size: 0.775rem;
    font-weight: 600;
    color: #374151;
}

body.events-page .active-filters-bar .af-chip .af-remove {
    border: none;
    background: transparent;
    color: #94a3b8;
    cursor: pointer;
    padding: 0;
    font-size: 0.8rem;
    line-height: 1;
    border-radius: 50%;
    transition: color 0.15s;
}
body.events-page .active-filters-bar .af-chip .af-remove:hover {
    color: #ef4444;
}

body.events-page .active-filters-bar .af-clear {
    border: none;
    background: transparent;
    color: #059669;
    font-weight: 600;
    font-size: 0.8rem;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 6px;
    transition: background 0.15s;
    white-space: nowrap;
}
body.events-page .active-filters-bar .af-clear:hover {
    background: #ecfdf5;
}

/* ===== EVENTS CARD GRID LAYOUT ===== */
body.events-page .grid {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 1.75rem !important;
}

@media(max-width: 1200px) {
    body.events-page .grid {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

@media(max-width: 768px) {
    body.events-page .grid {
        grid-template-columns: 1fr !important;
    }
    body.events-page .metrics {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
    body.events-page .formula-strip {
        grid-template-columns: repeat(2, 1fr) !important;
    }
    /* Stack the toolbar on mobile: search goes full-width, selects wrap below. */
    body.events-page .toolbar {
        flex-wrap: wrap !important;
    }
    body.events-page .toolbar-search {
        flex: 1 1 100% !important;
    }
    body.events-page .toolbar select {
        flex: 1 1 auto !important;
    }
}

@media(max-width: 480px) {
    body.events-page .metrics {
        grid-template-columns: 1fr !important;
    }
    body.events-page .formula-strip {
        grid-template-columns: 1fr !important;
    }
}

/* Small screens: group each metric card with its formula button.
   calendar-events.js rebuilds `.metrics` into `.metric-group` blocks (card +
   formula button + definition box) and adds `formula-interleaved` to <body> only
   at ≤768px; here those groups stack to a single column. */
body.events-page.formula-interleaved .metrics {
    grid-template-columns: repeat(5, 1fr) !important;
}
body.events-page.formula-interleaved .metric-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    min-width: 0 !important;
}
body.events-page.formula-interleaved .metric-group > .formula-btn {
    margin-top: 0 !important;
}
body.events-page.formula-interleaved .metric-group > .formula-box {
    grid-column: auto !important;
    margin-top: 0 !important;
    align-self: stretch !important;
}
@media(max-width: 768px) {
    body.events-page.formula-interleaved .metrics {
        grid-template-columns: 1fr !important;
    }
}

/* Event Card Design */
body.events-page .card {
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 0.75rem !important;
    overflow: hidden !important;
    box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05), 0 2px 4px -1px rgba(0,0,0,0.03) !important;
    display: flex !important;
    flex-direction: column !important;
    transition: transform 0.25s ease, box-shadow 0.25s ease !important;
}

body.events-page .card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.08), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    border-color: #d1d5db !important;
}

/* Card Specific ACCENTS based on category */
body.events-page .card.ramadan { border-top: 4px solid #4f46e5 !important; }   /* Indigo */
body.events-page .card.class { border-top: 4px solid #d97706 !important; }     /* Amber */
body.events-page .card.youth { border-top: 4px solid #db2777 !important; }     /* Pink */
body.events-page .card.prayer { border-top: 4px solid #2563eb !important; }    /* Blue */
body.events-page .card.community { border-top: 4px solid #059669 !important; } /* Emerald */

body.events-page .art {
    color: rgb(31, 36, 31) !important;
    display: flex !important;
    align-items: flex-end !important;
    padding: 0.65rem 0.75rem !important;
    position: relative !important;
    border-bottom: 0.5px solid #ccc !important;
}

body.events-page .art b {
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    letter-spacing: -0.01em !important;
    text-shadow: 0 2px 4px rgba(0,0,0,0.3) !important;
    z-index: 10 !important;
    padding: 0.45rem 0.6rem !important;
    
}

body.events-page[data-center-id="all-centers"] .art {
    align-items: center !important;
    gap: 0.6rem !important;
    padding: 0.5rem 0.8rem !important;
}
body.events-page[data-center-id="all-centers"] .art .center-logo-link {
    display: inline-flex !important;
    flex-shrink: 0 !important;
    position: relative !important;
    z-index: 2 !important;
    border-radius: 50% !important;
    transition: transform 0.15s ease, box-shadow 0.15s ease !important;
}
body.events-page[data-center-id="all-centers"] .art .center-logo-link:hover {
    transform: scale(1.08) !important;
    box-shadow: 0 0 0 2px rgba(255,255,255,0.6) !important;
}
body.events-page[data-center-id="all-centers"] .art .center-logo {
    width: 28px !important;
    height: 28px !important;
    border-radius: 50% !important;
    object-fit: contain !important;
    background: #ffffff !important;
    padding: 3px !important;
    display: block !important;
}
body.events-page[data-center-id="all-centers"] .art .art-info {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.5rem !important;
    line-height: 1.15 !important;
    position: relative !important;
    z-index: 2 !important;
}
body.events-page[data-center-id="all-centers"] .art .art-info b {
    font-size: 0.95rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.02em !important;
    text-shadow: none !important;
    text-transform: uppercase !important;
}
body.events-page[data-center-id="all-centers"] .art .art-info .art-category {
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    letter-spacing: 0.04em !important;
    text-transform: uppercase !important;
    text-shadow: none !important;
    opacity: 0.92 !important;
}

/* Program/Event image shown on the card header (same poster_url source as the
   Program/Event Details modal). Falls back to the colored art block when absent. */
body.events-page .art.has-img {
    display: block !important;
    padding: 0 !important;
    align-items: stretch !important;
    overflow: hidden !important;
}
body.events-page .card .art-img {
    width: 100% !important;
    height: auto !important;
    max-height: 220px !important;
    object-fit: cover !important;
    display: block !important;
    border-bottom: 0.5px solid #ccc !important;
}
body.events-page[data-center-id="all-centers"] .art.has-img {
    display: block !important;
    padding: 0 !important;
    align-items: stretch !important;
}
body.events-page .card .m-hero-frame {
    width: 100% !important;
    height: auto !important;
    min-height: 320px !important;
    border: 0 !important;
    display: block !important;
    border-bottom: 0.5px solid #ccc !important;
}

/* Card Body spacing & content */
body.events-page .card .body {
    padding: 0.75rem !important;
    display: flex !important;
    flex: 1 !important;
    flex-direction: column !important;
    gap: 0.3rem !important;
}

body.events-page .tags {
    display: flex !important;
    gap: 0.5rem !important;
    flex-wrap: wrap !important;
    margin-bottom: 0.15rem !important;
}

body.events-page .tag {
    background-color: #f3f4f6 !important;
    color: #4b5563 !important;
    font-size: 0.82rem !important;
    font-weight: 700 !important;
    border-radius: 9px !important;
    padding-right: 0.55rem !important;
    padding-left: 0.35rem !important;
}

body.events-page .tag.ghost {
    background-color: #f0fdf4 !important;
    color: #166534 !important;
}

body.events-page .card h3 {
    font-size: 0.9rem !important;
    font-weight: 800 !important;
    color: #111827 !important;
    line-height: 1.25 !important;
    margin: 0 !important;
}

body.events-page .card .date {
    color: #c2410c !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    margin: 5px 0 !important;
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    padding-right: 25px !important;

    /* gap: 5rem !important; */
}

body.events-page .card .meta {
    color: #6b7280 !important;
    font-size: 0.8rem !important;
    font-weight: 800 !important;
    margin: 5px 0 !important;
    padding-right: 25px !important;
    display: flex !important;
    justify-content: space-between !important;
}

body.events-page .card .desc {
    color: #4b5563 !important;
    font-size: 0.7rem !important;
    line-height: 1.35 !important;
    margin: 0 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

body.events-page .card .event-link {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-top: 0.35rem;
    padding: 0.3rem 0.65rem;
    background: #214e2f;
    border: 0;
    border-radius: 0.4rem;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s ease;
    align-self: center;
}

body.events-page .card .event-link:hover {
    background: #183d24;
    color: #fff;
    text-decoration: none;
}

body.events-page .card .event-link i {
    font-size: 0.55rem;
}

body.events-page .facts {
    display: grid !important;
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.5rem 1rem !important;
    margin-bottom: 1.5rem !important;
    padding-top: 1rem !important;
    border-top: 1px solid #f3f4f6 !important;
}

body.events-page .facts span {
    font-size: 0.8rem !important;
    color: #4b5563 !important;
}

body.events-page .facts b {
    color: #374151 !important;
    font-weight: 700 !important;
}

/* Card footer/cta button */
body.events-page .foot {
    margin-top: auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 0.75rem !important;
    padding-top: 1rem !important;
    border-top: 1px solid #f3f4f6 !important;
}

body.events-page .foot strong {
    font-size: 1rem !important;
    font-weight: 800 !important;
    color: #111827 !important;
}

body.events-page .button {
    background-color: var(--green) !important;
    color: #ffffff !important;
    text-decoration: none !important;
    border-radius: 0.375rem !important;
    padding: 0.5rem 1rem !important;
    font-size: 0.8125rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: background-color 0.2s ease !important;
}

body.events-page .button:hover {
    background-color: var(--green-hover) !important;
}

/* Non-events placeholder */
body.events-page .no-events {
    grid-column: 1 / -1 !important;
    text-align: center !important;
    color: #6b7280 !important;
    padding: 3rem 1.5rem !important;
    background-color: #ffffff !important;
    border: 1px dashed #d1d5db !important;
    border-radius: 0.5rem !important;
    font-size: 0.95rem !important;
    font-weight: 600 !important;
}

.sort-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 4px;
    font-size: 0.75rem;
    transition: all 0.15s ease;
    vertical-align: middle;
    margin-left: 4px;
}

.sort-toggle.active.asc {
    background: #dbeafe;
    color: #2563eb;
}

.sort-toggle.active.desc {
    background: #dbeafe;
    color: #2563eb;
}

.sort-toggle i {
    line-height: 1;
}

/* Clickable category table rows */
.category-row {
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.category-row:hover {
    background: #eef2ff !important;
    transform: translateX(4px);
}

.category-row:active {
    background: #e0e7ff !important;
    transform: translateX(2px);
}

.category-row .category-row-label {
    transition: color 0.2s ease;
}

.category-row:hover .category-row-label {
    color: #2563eb;
}

.category-row .category-row-arrow {
    display: inline-block;
    font-size: 0.7rem;
    margin-left: 6px;
    opacity: 0;
    transition: all 0.2s ease;
    color: #2563eb;
    font-weight: 700;
}

.category-row:hover .category-row-arrow {
    opacity: 1;
    transform: translateX(2px);
}

.category-row .category-row-count {
    font-weight: 700;
    color: #1e40af;
    background: #eff6ff;
    padding: 2px 12px;
    border-radius: 999px;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    display: inline-block;
}

.category-row:hover .category-row-count {
    background: #2563eb;
    color: #ffffff;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.25);
}

.sort-toggle i {
    line-height: 1;
}

select.header-filter {
    background: transparent;
    font-size: 0.8125rem;
    font-weight: 600;
    text-align: center;
    cursor: pointer;
    border: none;
    outline: none;
    color: inherit;
    max-width: 100%;
    padding: 2px 4px;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
}

select.header-filter:hover {
    background: #e5e7eb;
    color: #2563eb;
}

select.header-filter option {
    font-weight: 400;
    color: #374151;
    background: #fff;
}

/* Programs table: equal-width columns that always fill their card. The min-width
   keeps the columns usable on narrow viewports (horizontal scroll instead of
   crushing the header filter selects). */
#card-programs-table table {
    min-width: 900px;
}

.time-filter-btn {
    padding: 4px 14px;
    font-size: 0.8125rem;
    font-weight: 500;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: all 0.15s;
    line-height: 1.5;
}

.time-filter-btn:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.time-filter-btn.active {
    background: #2563eb;
    color: #fff;
    border-color: #2563eb;
}

.time-filter-link {
    padding: 4px 14px;
    font-size: 0.8125rem;
    font-weight: 600;
    color: #2563eb;
    text-decoration: none;
    border-radius: 9999px;
    transition: all 0.15s;
    line-height: 1.5;
    white-space: nowrap;
}

.time-filter-link:hover {
    background: #eff6ff;
    text-decoration: underline;
}

/* ==========================================================================
   PAGE NAVIGATION (shared between index.html and FAQ)
   ========================================================================== */
.page-nav {
    display: flex;
    gap: 0.1rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, 0.15);
}

/* Hero header (index / all-centers events / knowledge-base / FAQ): keep the
   page nav on the same row as the title. */
header.bg-emerald-800 > div > .flex.items-center.justify-between {
    flex-wrap: nowrap;
}

header.bg-emerald-800 > div > .flex.items-center.justify-between > .page-nav {
    width: auto;
    flex-wrap: nowrap;
    border-top: none;
    padding-top: 0;
}

.page-nav-link {
    padding: 0.5rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.875rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.page-nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.page-nav-link.active {
    color: #047857;
    background: #fff;
}

.page-nav-link.active:hover {
    color: #065f46;
}

/* Mobile: let the hero page-nav (a sibling of the title row, not a child) wrap
   so its nowrap pills stack instead of overflowing small viewports. */
@media (max-width: 768px) {
    header.bg-emerald-800 > div > .page-nav {
        flex-wrap: wrap;
        justify-content: flex-start;
        row-gap: 0.5rem;
    }
}

/* Mobile: the Adelaide centre dashboard keeps its own sibling <nav> (#portalNav)
   outside .flex.justify-between, so none of the shared header fallbacks match.
   Wrap its pills on small screens. */
@media (max-width: 768px) {
    header #portalNav {
        flex-wrap: wrap;
        gap: 0.5rem 1rem;
    }
}

/* ==========================================================================
   FAQ PAGE STYLES (SCOPED UNDER body.faq-page / .faq-content)
   ========================================================================== */
body.faq-page {
    --green-950: #073b31;
    --green-800: #0b5d4b;
    --green-700: #11705a;
    --green-100: #dff3ec;
    --green-50: #f3fbf8;
    --gold: #a67c1e;
    --gold-light: #fef3c7;
    --ink: #17221f;
    --muted: #5c6a66;
    --line: #e2e8e7;
    --white: #fff;
    --shadow-sm: 0 1px 3px rgba(7, 59, 49, 0.06);
    --shadow-md: 0 4px 16px rgba(7, 59, 49, 0.08);
    --shadow-lg: 0 8px 30px rgba(7, 59, 49, 0.1);
    --radius: 12px;
    background: #f4f8f6;
    color: var(--ink);
    line-height: 1.6;
}

body.faq-page * { box-sizing: border-box; }

body.faq-page button,
body.faq-page input { font: inherit; }

body.faq-page button { cursor: pointer; }

body.faq-page .skip-link {
    position: absolute;
    left: -9999px;
    top: 8px;
    background: #fff;
    color: #000;
    padding: 0.7rem 1rem;
    z-index: 100;
}

body.faq-page .skip-link:focus { left: 8px; }

/* ── Hero ── */
body.faq-page .faq-content .hero {
    background: #fff;
    padding: 3rem 1.2rem 3.5rem;
    border-bottom: 1px solid var(--line);
    width: 100% !important;
}

body.faq-page .faq-content .wrap {
    width: min(900px, calc(100% - 2rem));
    margin: auto;
}

body.faq-page .faq-content .hero .wrap {
    text-align: center;
}

body.faq-page .faq-content .eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--green-700);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    font-size: 0.72rem;
}

body.faq-page .faq-content .hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    line-height: 1.15;
    margin: 0.6rem 0 0.6rem;
    color: var(--green-950);
    font-weight: 800;
    letter-spacing: -0.02em;
}

body.faq-page .faq-content .lead {
    font-size: clamp(0.95rem, 1.5vw, 1.1rem);
    max-width: 600px;
    color: var(--muted);
    margin: 0 auto;
}

body.faq-page .faq-content .meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1.25rem;
    justify-content: center;
}

body.faq-page .faq-content .pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid var(--line);
    background: var(--green-50);
    color: var(--green-800);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-weight: 600;
    font-size: 0.82rem;
}

/* ── Toolbar card ── */
body.faq-page .faq-content .panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.25rem;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.75rem;
    align-items: center;
}

body.faq-page .faq-content .search {
    position: relative;
    display: flex;
    align-items: center;
}

body.faq-page .faq-content .search i {
    position: absolute;
    left: 1rem;
    color: var(--muted);
    font-size: 0.85rem;
    pointer-events: none;
}

body.faq-page .faq-content .search input {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.75rem 1rem 0.75rem 2.6rem;
    outline: none;
    background: #fafcfb;
    font-size: 0.92rem;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

body.faq-page .faq-content .search input:focus {
    border-color: var(--green-700);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(17, 112, 90, 0.1);
}

body.faq-page .faq-content .search input::placeholder {
    color: #96a8a2;
}

body.faq-page .faq-content .actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
}

body.faq-page .faq-content .btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    border-radius: 9px;
    padding: 0.65rem 0.85rem;
    font-weight: 600;
    font-size: 0.85rem;
    transition: all 0.2s;
}

body.faq-page .faq-content .btn:hover {
    background: var(--green-50);
    border-color: #b8d4ca;
}

body.faq-page .faq-content .btn.primary {
    background: var(--green-800);
    color: #fff;
    border-color: var(--green-800);
}

body.faq-page .faq-content .btn.primary:hover {
    background: var(--green-950);
    border-color: var(--green-950);
}

/* ── Main content ── */
body.faq-page .faq-content main {
    padding: 1.5rem 0 3.5rem;
}

/* ── Category chips ── */
body.faq-page .faq-content .category-nav {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin: 0 0 1rem;
}

@media (max-width: 48rem) {
    body.faq-page .faq-content .category-nav {
        margin: 0 0.75rem 1rem;
    }
}

body.faq-page .faq-content .chip {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--muted);
    padding: 0.45rem 0.9rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.84rem;
    transition: all 0.2s;
}

body.faq-page .faq-content .chip:hover {
    border-color: #b8d4ca;
    color: var(--green-800);
}

body.faq-page .faq-content .chip[aria-pressed="true"] {
    background: var(--green-800);
    border-color: var(--green-800);
    color: #fff;
}

/* ── Status bar ── */
body.faq-page .faq-content .status {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin: 0 0.75rem 1rem;
    color: var(--muted);
    font-size: 0.85rem;
}

@media (max-width: 48rem) {
    body.faq-page .faq-content .status {
        margin: 0 0.75rem 1rem 1.25rem;
    }
}

body.faq-page .faq-content .progress {
    height: 4px;
    background: var(--line);
    border-radius: 99px;
    overflow: hidden;
    min-width: 120px;
    max-width: 200px;
    flex: 1;
}

body.faq-page .faq-content .progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--green-700);
    transition: width 0.25s;
}

/* ── FAQ accordion list ── */
body.faq-page .faq-content .faq-list {
    display: grid;
    gap: 0.6rem;
}

body.faq-page .faq-content details {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s;
}

body.faq-page .faq-content details[open] {
    border-color: #c5ddd4;
    box-shadow: var(--shadow-md);
}

body.faq-page .faq-content summary {
    list-style: none;
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 0.8rem;
    align-items: center;
    padding: 0.9rem 1.1rem;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: background 0.2s;
}

body.faq-page .faq-content summary::-webkit-details-marker { display: none; }

body.faq-page .faq-content summary:hover {
    background: #fafcfb;
}

body.faq-page .faq-content .num {
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 8px;
    background: var(--green-100);
    color: var(--green-800);
    display: grid;
    place-items: center;
    font-size: 0.72rem;
    font-weight: 700;
    flex-shrink: 0;
}

body.faq-page .faq-content .chev {
    font-size: 1.15rem;
    color: #b8d4ca;
    transition: transform 0.25s, color 0.2s;
    flex-shrink: 0;
}

body.faq-page .faq-content details[open] .chev {
    transform: rotate(45deg);
    color: var(--green-700);
}

/* ── Answer block ── */
body.faq-page .faq-content .answer {
    border-top: 1px solid var(--line);
    padding: 1rem 1.1rem 1.1rem 3.5rem;
    color: #2a3d38;
    font-size: 0.9rem;
    line-height: 1.65;
}

body.faq-page .faq-content .answer p {
    margin: 0 0 0.6rem;
}

body.faq-page .faq-content .answer ul {
    margin: 0.3rem 0 0.7rem;
    padding-left: 1.25rem;
    columns: 2;
    column-gap: 2rem;
}

body.faq-page .faq-content .answer li {
    break-inside: avoid;
    margin: 0.2rem 0;
}

body.faq-page .faq-content .plain {
    background: var(--green-50);
    border-left: 3px solid var(--gold);
    padding: 0.6rem 0.8rem;
    border-radius: 0 8px 8px 0;
    margin: 0.6rem 0;
    font-size: 0.88rem;
}

body.faq-page .faq-content .narrate {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--green-700);
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.25rem 0.5rem;
    border-radius: 6px;
    transition: all 0.2s;
}

body.faq-page .faq-content .narrate:hover {
    background: var(--green-50);
    border-color: var(--line);
}

/* ── Empty state ── */
body.faq-page .faq-content .empty {
    display: none;
    text-align: center;
    background: #fff;
    padding: 2.5rem 2rem;
    border-radius: 10px;
    border: 1px dashed #c5ddd4;
    color: var(--muted);
}

body.faq-page .faq-content .empty.show { display: block; }

/* ── Toast ── */
body.faq-page .toast {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    background: #142b25;
    color: #fff;
    padding: 0.7rem 1.1rem;
    border-radius: 10px;
    box-shadow: var(--shadow-lg);
    transform: translateY(150%);
    transition: transform 0.3s;
    z-index: 50;
    font-size: 0.9rem;
}

body.faq-page .toast.show { transform: translateY(0); }

body.faq-page mark { background: #fef7d6; padding: 0 0.1em; }

/* ── Responsive ── */
@media (max-width: 760px) {
    body.faq-page .faq-content .panel { grid-template-columns: 1fr; }
    body.faq-page .faq-content .actions .btn { flex: 1; justify-content: center; }
    body.faq-page .faq-content .answer { padding-left: 1.1rem; }
    body.faq-page .faq-content .answer ul { columns: 1; }
    body.faq-page .faq-content .status { align-items: flex-start; flex-direction: column; }
    body.faq-page .faq-content .progress { width: 100%; max-width: none; }
    body.faq-page .faq-content .hero { padding: 1.5rem 1.2rem 2rem; }
    body.faq-page .faq-content .meta { justify-content: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
    body.faq-page * { scroll-behavior: auto !important; transition: none !important; }
}

/* ===== EVENTS PAGE 2-COLUMN LAYOUT ===== */
body.events-page .events-layout {
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: flex-start !important;
    gap: 1.5rem !important;
    width: 100% !important;
    box-sizing: border-box !important;
}

body.events-page .events-main {
    flex: 1 1 auto !important;
    min-width: 0 !important;
}

/* Hide the redundant in-toolbar segment toggle now that the sidebar handles it */
body.events-page .toolbar-segments { display: none !important; }

/* Suppress the JS-injected legacy section-nav on event pages — our .events-sidebar replaces it */
body.events-page .section-nav-suppressed,
body.events-page .section-nav { display: none !important; }

/* Anchor-scroll target offset so cards clear the sticky header + metrics */
body.events-page .scroll-mt-32 {
    scroll-margin-top: 100px !important;
}
body.events-page .grid > .card {
    scroll-margin-top: 160px !important;
}

/* ===== FIXED EVENT-TYPES SIDEBAR ===== */
body.events-page .events-sidebar {
    position: sticky !important;
    top: 430px !important;
    flex: 0 0 260px !important;
    width: 260px !important;
    max-height: calc(100vh - 4rem) !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 1rem !important;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05) !important;
    align-self: flex-start !important;
    box-sizing: border-box !important;
}

body.events-page .events-sidebar h3 {
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    color: #6b7280 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    margin: 0 0 0.6rem 0 !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.4rem !important;
}

body.events-page .events-sidebar h3 i { color: #059669; }

body.events-page .event-type-btn {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    padding: 0.55rem 0.75rem !important;
    border-radius: 8px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    font-weight: 600 !important;
    font-size: 0.875rem !important;
    color: #374151 !important;
    cursor: pointer !important;
    margin-bottom: 0.4rem !important;
    transition: all 0.15s ease !important;
    font-family: inherit !important;
    text-align: left !important;
}

body.events-page .event-type-btn:last-child { margin-bottom: 0 !important; }

body.events-page .event-type-btn:hover {
    border-color: #059669 !important;
    color: #059669 !important;
}

body.events-page .event-type-btn.active {
    background: #059669 !important;
    color: #ffffff !important;
    border-color: #059669 !important;
}

body.events-page .event-type-btn .count {
    background: #ffffff !important;
    color: #4b5563 !important;
    padding: 0.05rem 0.55rem !important;
    border-radius: 999px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    border: 1px solid #e5e7eb !important;
    min-width: 1.5rem !important;
    text-align: center !important;
}

body.events-page .event-type-btn.active .count {
    background: rgba(255,255,255,0.22) !important;
    color: #ffffff !important;
    border-color: transparent !important;
}

body.events-page .event-type-btn i { margin-right: 0.4rem; }

/* ===== SIDEBAR NAV LINK ===== */
body.events-page .events-sidebar .sidebar-section {
    margin-bottom: 1rem !important;
}
body.events-page .events-sidebar .sidebar-section:last-child {
    margin-bottom: 0 !important;
}
body.events-page .events-sidebar .sidebar-divider {
    border: none !important;
    border-top: 1px solid #e5e7eb !important;
    margin: 0.75rem 0 !important;
}
body.events-page .events-sidebar .sidebar-month-select {
    width: 100% !important;
    margin-top: 0.5rem !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    padding: 0.4rem 0.5rem !important;
    font-size: 0.8125rem !important;
    font-family: inherit !important;
    color: #475569 !important;
    background: #f8fafc !important;
    outline: none !important;
    cursor: pointer !important;
    box-sizing: border-box !important;
}
body.events-page .events-sidebar .sidebar-month-select:focus {
    border-color: #059669 !important;
    background: #ffffff !important;
}

/* ===== 'SHOWING N EVENTS' LABEL ===== */
body.events-page .showing-label {
    font-size: 0.85rem !important;
    color: #6b7280 !important;
    font-weight: 600 !important;
    margin: 0 0 0.75rem 0 !important;
}

body.events-page .showing-label b {
    color: #059669 !important;
    font-weight: 800 !important;
}

/* ===== AUDIENCE TAG ON CARDS ===== */
body.events-page .tag.audience {
    background-color: #ede9fe !important;
    color: #6d28d9 !important;
}

/* ===== NEW METRIC ICON COLORS (for 8-card row 2) ===== */
body.events-page .metric-icon-emerald { background: #d1fae5; color: #059669; }
body.events-page .metric-icon-indigo { background: #e0e7ff; color: #4f46e5; }
body.events-page .metric-icon-rose { background: #fce7f3; color: #e11d48; }
body.events-page .metric-icon-orange { background: #ffedd5; color: #ea580c; }
body.events-page .metric-icon-cyan { background: #cffafe; color: #0891b2; }

/* ===== FORMULA BUTTON & BOX (events-page, matching main dashboard) ===== */
body.events-page .formula-strip {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding: 0.5rem 0.65rem;
    border-top: 1px dashed #e5e7eb;
}
body.events-page .formula-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.35rem 0.5rem;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    color: #374151;
    font-size: 0.7rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    width: 100%;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}
body.events-page .formula-btn:hover {
    background: #f0fdf4;
    border-color: #059669;
    color: #059669;
}
body.events-page .formula-btn.active {
    background: #f0fdf4;
    border-color: #059669;
    color: #059669;
    font-weight: 600;
    box-shadow: 0 0 0 1px rgba(5, 150, 105, 0.15);
}
body.events-page .formula-box {
    display: none;
    margin-top: 0;
    padding: 0.55rem 0.75rem;
    background: #f8fafc;
    border: 1px solid #e9edf2;
    border-radius: 0.5rem;
    color: #374151;
    line-height: 1.5;
    box-shadow: none;
    font-size: 0.7rem;
    grid-column: 1 / -1;
}
body.events-page .formula-box.active {
    display: block;
}
body.events-page .formula-box ul {
    margin: 0.25rem 0 0;
    padding-left: 1rem;
}
body.events-page .formula-box li + li {
    margin-top: 0.2rem;
}
body.events-page .formula-box strong {
    color: #1e293b;
}
body.events-page .formula-box .data-source-link {
    color: #2563eb !important;
    text-decoration: underline !important;
    font-weight: 500 !important;
}

/* ===== FILTER PANEL (replaces old sidebar) ===== */
body.events-page .filter-panel {
    position: sticky !important;
    top: 100px !important;
    flex: 0 0 260px !important;
    width: 260px !important;
    max-height: calc(100vh - 120px) !important;
    overflow-y: auto !important;
    background: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    border-radius: 12px !important;
    padding: 1.25rem !important;
    box-shadow: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05) !important;
    align-self: flex-start !important;
    box-sizing: border-box !important;
}
body.events-page .filter-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}
body.events-page .filter-panel-header h3 {
    font-size: 0.78rem !important;
    font-weight: 800 !important;
    color: #6b7280 !important;
    text-transform: uppercase !important;
    letter-spacing: 0.06em !important;
    margin: 0 !important;
}
body.events-page .filter-panel-header .active-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: #059669;
    background: #f0fdf4;
    padding: 0.1rem 0.5rem;
    border-radius: 999px;
}

body.events-page .filter-divider {
    border: none;
    border-top: 1px solid #e5e7eb;
    margin: 0.75rem 0;
}
body.events-page .filter-group {
    margin-bottom: 0.5rem;
}
body.events-page .filter-group-title {
    font-size: 0.72rem;
    font-weight: 700;
    color: #374151;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 0.3rem;
}
body.events-page .filter-group-title:hover {
    color: #059669;
}
body.events-page .filter-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
body.events-page .filter-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.825rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    user-select: none;
}
body.events-page .filter-checkbox:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}
body.events-page .filter-checkbox.active {
    background: #f0fdf4;
    border-color: #059669;
    color: #059669;
    font-weight: 600;
}
body.events-page .filter-checkbox .check-indicator {
    width: 16px;
    height: 16px;
    border-radius: 4px;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    font-size: 0.55rem;
    color: transparent;
}
body.events-page .filter-checkbox.active .check-indicator {
    background: #059669;
    border-color: #059669;
    color: #ffffff;
}
body.events-page .filter-checkbox .filter-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}
body.events-page .filter-checkbox .filter-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    min-width: 1.2rem;
    text-align: center;
}
body.events-page .filter-checkbox.active .filter-count {
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
}
body.events-page .filter-checkbox.stat-linked {
    background: #f0fdfa;
    border: 1px dashed #0d9488;
    color: #0d9488;
}
body.events-page .filter-checkbox.stat-linked .check-indicator {
    border-color: #0d9488;
}
body.events-page .filter-checkbox.stat-linked .filter-count {
    background: rgba(13, 148, 136, 0.15);
    color: #0d9488;
}
body.events-page .filter-checkbox i {
    font-size: 0.75rem;
    width: 1rem;
    text-align: center;
    color: #9ca3af;
}
body.events-page .filter-checkbox.active i {
    color: #059669;
}

/* ===== Sidebar radio button filters ===== */
body.events-page .filter-radio-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
body.events-page .filter-radio {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.825rem;
    font-weight: 500;
    color: #374151;
    transition: all 0.15s ease;
    border: 1px solid transparent;
    user-select: none;
}
body.events-page .filter-radio:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
}
body.events-page .filter-radio.active {
    background: #f0fdf4;
    border-color: #059669;
    color: #059669;
    font-weight: 600;
}
body.events-page .filter-radio .radio-indicator {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid #d1d5db;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s ease;
    font-size: 0.5rem;
    color: transparent;
}
body.events-page .filter-radio.active .radio-indicator {
    border-color: #059669;
    color: #059669;
}
body.events-page .filter-radio.active .radio-indicator i {
    color: #059669;
    font-size: 0.45rem;
}
body.events-page .filter-radio .filter-label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
}
body.events-page .filter-radio .filter-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 0.05rem 0.45rem;
    border-radius: 999px;
    min-width: 1.2rem;
    text-align: center;
}
body.events-page .filter-radio.active .filter-count {
    background: rgba(5, 150, 105, 0.15);
    color: #059669;
}
body.events-page .filter-radio.stat-linked {
    background: #f0fdfa;
    border: 1px dashed #0d9488;
    color: #0d9488;
}
body.events-page .filter-radio.stat-linked .radio-indicator {
    border-color: #0d9488;
}
body.events-page .filter-radio.stat-linked .filter-count {
    background: rgba(13, 148, 136, 0.15);
    color: #0d9488;
}
body.events-page .filter-radio i {
    font-size: 0.75rem;
    width: 1rem;
    text-align: center;
    color: #9ca3af;
}
body.events-page .filter-radio.active i {
    color: #059669;
}
body.events-page .filter-radio.count-zero {
    opacity: 0.45;
    cursor: pointer;
}
body.events-page .filter-radio.count-zero:hover {
    background: #f9fafb;
    border-color: #e5e7eb;
    opacity: 0.8;
}

body.events-page .filter-clear-btn {
    display: block;
    width: 100%;
    margin-top: 0.75rem;
    padding: 0.5rem;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #ffffff;
    color: #059669;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: inherit;
    text-align: center;
}
body.events-page .filter-clear-btn:hover {
    background: #f0fdf4;
    border-color: #059669;
}

body.events-page .results-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    gap: 1rem;
}
body.events-page .results-count {
    font-size: 0.9rem;
    font-weight: 600;
    color: #374151;
}
body.events-page .results-count b {
    color: #059669;
    font-weight: 800;
}
body.events-page .results-sort {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #6b7280;
    font-weight: 500;
}
body.events-page .results-sort select {
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.35rem 0.5rem;
    font-size: 0.8125rem;
    font-family: inherit;
    color: #374151;
    background: #f8fafc;
    outline: none;
    cursor: pointer;
}
body.events-page .results-sort select:focus {
    border-color: #059669;
    background: #ffffff;
}

/* ===== TOOLBAR DROPDOWN STYLES ===== */
body.events-page .toolbar select {
    flex-shrink: 0;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 0.4rem 0.5rem;
    font-size: 0.825rem;
    font-family: inherit;
    color: #475569;
    background: #f8fafc;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
}
body.events-page .toolbar select:focus {
    border-color: #059669;
    background: #ffffff;
}

/* ===== ENHANCED EMPTY STATE ===== */
body.events-page .no-events {
    grid-column: 1 / -1 !important;
    text-align: center !important;
    padding: 3rem 1.5rem !important;
    background-color: #ffffff !important;
    border: 1px dashed #d1d5db !important;
    border-radius: 12px !important;
}
body.events-page .no-events i {
    font-size: 2.5rem;
    color: #d1d5db;
    margin-bottom: 0.75rem;
    display: block;
}
body.events-page .no-events p {
    color: #6b7280;
    font-size: 0.95rem;
    font-weight: 600;
    margin: 0 0 1rem 0;
}
body.events-page .no-events .no-events-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.25rem;
    border: none;
    border-radius: 8px;
    background: #059669;
    color: #ffffff;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
body.events-page .no-events .no-events-btn:hover {
    background: #047857;
}

@media (max-width: 1024px) {
    body.events-page .events-layout {
        flex-direction: column !important;
    }
    body.events-page .filter-panel {
        position: static !important;
        flex: 0 0 auto !important;
        width: 100% !important;
        margin-bottom: 1rem !important;
        order: -1;
    }
}

body > div.min-h-screen {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}
body > div.min-h-screen > main {
    flex: 1 0 auto;
    width: 100%;
}
body > div.min-h-screen > footer {
    flex-shrink: 0;
}

body > main {
    flex: 1 0 auto;
    width: 100%;
}

body > footer {
    flex-shrink: 0;
    margin-top: 0 !important;
}

#card-programs-table .overflow-x-auto {
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-x: contain;
}

@media (max-width: 640px) {
    #card-programs-table table {
        table-layout: auto;
    }
    #card-programs-table thead th,
    #card-programs-table tbody td {
        white-space: nowrap;
        padding: 0.5rem 0.6rem;
    }
    #card-programs-table thead th {
        font-size: 0.75rem;
    }
}

/* Shrink chart canvases on narrow screens */
@media (max-width: 640px) {
    body[data-center-id] .chart-container {
        height: 240px !important;
        margin: 12px 0;
    }
}

@media (max-width: 640px) {
    .masjid-card-links {
        grid-template-columns: 1fr;
    }
    .masjid-card-links > a,
    .masjid-card-links > a:last-child {
        grid-column: auto;
        justify-self: stretch;
        width: 100%;
        max-width: 100%;
        justify-content: center;
        flex-wrap: wrap;
        white-space: normal;
        text-align: center;
    }
    .btn-dashboard,
    .btn-events,
    .btn-narrative {
        font-size: 0.8125rem;
        padding: 0.55rem 0.75rem;
    }
}

/* On small screens, swap the full labels for the short ones */
@media (max-width: 480px) {
    .masjid-card-links .btn-label-full {
        display: none;
    }
    .masjid-card-links .btn-label-short {
        display: inline;
    }
}

/* Metric info icon: tooltip is rendered by JS (js/main.js) as a fixed,
   viewport-clamped element so it never overflows its card or the page. */
.metric-info-icon {
    z-index: 3;
}
.metric-tooltip {
    position: fixed;
    padding: 0.5rem 0.75rem;
    background: #1f2937;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.4;
    text-align: left;
    white-space: normal;
    overflow-wrap: anywhere;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
    pointer-events: none;
    z-index: 99999;
    animation: tooltip-in 0.15s ease;
}
@keyframes tooltip-in {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================================
   EN / FR / AR language toggle (js/i18n.js)
   ============================================================= */
.i18n-toggle {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 3px;
    border: 1px solid #d1d5db;
    border-radius: 9999px;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
}
.i18n-toggle-btn {
    border: 0;
    background: transparent;
    color: #047857;
    padding: 6px 12px;
    border-radius: 9999px;
    cursor: pointer;
    font: inherit;
    transition: background 0.15s ease, color 0.15s ease;
}
.i18n-toggle-btn:hover {
    background: #ecfdf5;
    color: #065f46;
}
.i18n-toggle-btn:focus-visible {
    outline: 2px solid #047857;
    outline-offset: 1px;
}
.i18n-toggle-btn.is-active {
    background: #047857;
    color: #fff;
}
.i18n-toggle-btn.is-active:hover {
    background: #065f46;
    color: #fff;
}

/* === Scroll-to-top button (added by i18n.js) === */
#scrollTopBtn {
    position: fixed;
bottom: 4.5rem;
    right: 2rem;
    width: 44px;
    height: 44px;
    border-radius: 9999px;
    background: #059669;
    color: #fff;
    border: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease, transform 0.25s ease;
    z-index: 9998;
    transform: translateY(8px);
}
#scrollTopBtn.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
#scrollTopBtn:hover {
    background: #047857;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.25);
}
#scrollTopBtn:active {
    transform: translateY(0);
}
