/* Nazareth Church Management System - Styles */

:root {
    --primary: #1e3a5f;
    --primary-light: #2c5282;
    --accent: #c53030;
    --text: #2d3748;
    --text-muted: #718096;
    --border: #e2e8f0;
    --bg: #f7fafc;
    --white: #ffffff;
}

/* Clerk theme - red accent */
body.theme-clerk {
    --primary: #c53030;
    --primary-light: #e53e3e;
}

body.theme-finance {
    --primary: #3098f3;
    --primary-light: #5aadf5;
}

/* YPG / Gen Group Manager theme – ensure it wins over defaults */
body.theme-ypg {
    --primary: #f74652 !important;
    --primary-light: #fa6b75 !important;
}
body.theme-ypg .btn,
body.theme-ypg .sidebar nav a.active,
body.theme-ypg .btn-outline {
    --primary: #f74652;
    --primary-light: #fa6b75;
}

body.theme-system {
    --primary: #6366f1;
    --primary-light: #818cf8;
}

/* System admin: tablet / narrow layouts — collapsible nav (sa-8) */
body.theme-system .system-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 90;
    background: rgba(15, 23, 42, 0.45);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

body.theme-system .system-mobile-bar {
    display: none;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    margin: -0.25rem 0 1rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 40;
    background: #fafafa;
}

body.theme-system .system-mobile-bar-title {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
}

body.theme-system .system-nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.4rem 0.55rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--white);
    color: var(--text);
    cursor: pointer;
    line-height: 1;
}

body.theme-system .system-nav-toggle:hover {
    border-color: var(--primary);
    color: var(--primary);
}

@media (max-width: 1024px) {
    body.theme-system .system-mobile-bar {
        display: flex;
    }

    body.theme-system .sidebar {
        transform: translateX(-100%);
        transition: transform 0.22s ease;
        box-shadow: none;
        width: min(280px, 88vw);
    }

    body.theme-system.system-nav-open .sidebar {
        transform: translateX(0);
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.12);
    }

    body.theme-system .main {
        margin-left: 0;
        padding: 1rem 1rem;
        width: 100%;
        max-width: 100vw;
        overflow-x: hidden;
    }

    body.theme-system .header {
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: flex-start;
    }

    body.theme-system .header h1 {
        font-size: 1.25rem;
        line-height: 1.3;
        flex: 1 1 100%;
        min-width: 0;
    }

    body.theme-system .header-actions {
        display: flex;
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: center;
        width: 100%;
    }

    /* Inline grids on system dashboard cards */
    body.theme-system .main [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }
}

@media (min-width: 1025px) {
    body.theme-system #system-sidebar-backdrop {
        display: none !important;
    }
}

@media (max-width: 1024px) and (prefers-reduced-motion: reduce) {
    body.theme-system .sidebar {
        transition: none;
    }
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
    font-weight: 400;
}

a {
    color: var(--primary);
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* Login page – refined, branded, modern */
.login-page {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(1.5rem, env(safe-area-inset-top, 0px)) max(1.5rem, env(safe-area-inset-right, 0px)) max(3rem, env(safe-area-inset-bottom, 0px)) max(1.5rem, env(safe-area-inset-left, 0px));
    background: #0b1b89;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    font-weight: 400;
    position: relative;
}

.login-card {
    width: 100%;
    max-width: 360px;
    background: var(--white);
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(30, 58, 95, 0.08), 0 1px 3px rgba(0, 0, 0, 0.06);
    border: 1px solid rgba(30, 58, 95, 0.08);
    padding: 2.25rem 2rem;
}

.login-brand {
    text-align: center;
    margin-bottom: 2rem;
}

.login-logo {
    width: 64px;
    height: 64px;
    object-fit: contain;
    display: block;
    margin: 0 auto 1.25rem;
}

.login-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text, #0f172a);
    margin: 0 0 0.35rem;
    letter-spacing: -0.02em;
}

.login-motto {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-muted, #64748b);
    font-style: italic;
    margin: 0;
}

.login-form .form-group {
    margin-bottom: 1.1rem;
}

.login-form .form-group:last-of-type {
    margin-bottom: 1.5rem;
}

.login-form label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--text, #334155);
    margin-bottom: 0.4rem;
}

.login-form input {
    max-width: none;
    width: 100%;
    padding: 0.65rem 0.875rem;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 400;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #fff;
}

.login-form input:focus {
    outline: none;
    border-color: var(--primary, #1e3a5f);
    box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.login-form input::placeholder {
    color: #94a3b8;
}

.login-page .btn-block {
    width: 100%;
    padding: 0.75rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border-radius: 8px;
    transition: background-color 0.2s, transform 0.05s;
}

.login-page .btn-primary {
    background: #ed131a;
    border: none;
    color: #fff;
}

.login-page .btn-primary:hover {
    background: #c90f15;
}

.login-page .btn-primary:active {
    transform: scale(0.99);
}

.login-footer {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.8125rem;
    color: rgba(255, 255, 255, 0.75);
}

.login-extra-link {
    margin: 1rem 0 0;
    text-align: center;
    font-size: 0.875rem;
}

.login-extra-link a {
    color: var(--primary, #1e3a5f);
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.login-hint {
    margin: 0 0 1.25rem;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-muted, #64748b);
}

.login-alert {
    margin-bottom: 1.25rem;
    padding: 0.875rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    line-height: 1.5;
}

.login-alert--success {
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
}

.login-alert--error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
}

.btn-block {
    width: 100%;
}

.btn-primary {
    padding: 0.625rem 1rem;
    font-weight: 400;
    border-radius: 6px;
}

/* Landing page */
.landing {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.landing-logo {
    max-width: 120px;
    margin-bottom: 1.5rem;
}

.landing h1 {
    font-size: 1.75rem;
    color: var(--primary);
    margin: 0 0 0.5rem;
}

.landing .subtitle {
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.landing .motto {
    font-style: italic;
    color: var(--primary-light);
    margin-bottom: 2rem;
}

.btn {
    display: inline-block;
    padding: 0.35rem 0.75rem;
    background: var(--primary);
    color: var(--white) !important;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8125rem;
    text-decoration: none !important;
}
.btn:hover {
    background: var(--primary-light);
    text-decoration: none !important;
}

.btn-secondary {
    background: var(--text-muted);
}
.btn-secondary:hover {
    background: var(--text);
}

.btn-sm {
    padding: 0.2rem 0.4rem;
    font-size: 0.6875rem;
}

.btn-outline {
    background: transparent !important;
    border: 1px solid var(--primary);
    color: var(--primary) !important;
}
.btn-outline:hover {
    background: var(--primary) !important;
    color: var(--white) !important;
    border-color: var(--primary);
}

.btn-outline-danger {
    background: transparent !important;
    border: 1px solid #c53030;
    color: #c53030 !important;
}
.btn-outline-danger:hover {
    background: #c53030 !important;
    color: var(--white) !important;
    border-color: #c53030;
}

.btn-success {
    background: #28a745;
    color: #fff !important;
}
.btn-success:hover {
    background: #218838;
    color: #fff !important;
}
.btn-info {
    background: #17a2b8;
    color: #fff !important;
}
.btn-info:hover {
    background: #138496;
    color: #fff !important;
}
.btn-outline-secondary {
    background: transparent !important;
    border: 1px solid #6c757d;
    color: #6c757d !important;
}
.btn-outline-secondary:hover {
    background: #6c757d !important;
    color: #fff !important;
}
.btn i {
    margin-right: 0.35rem;
}

/* Layout - Dashboard */
.layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 240px;
    height: 100vh;
    overflow-y: auto;
    z-index: 100;
    background: var(--white);
    border-right: 1px solid var(--border);
    padding: 1.25rem 0;
    display: flex;
    flex-direction: column;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* Pin Settings to bottom of sidebar, separated from main nav */
.sidebar nav a.sidebar-bottom {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
}

/* Support: manifest / PWA / session notes (sa-7) */
.sidebar nav a.sidebar-mobile-help {
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.sidebar nav a.sidebar-mobile-help:hover,
.sidebar nav a.sidebar-mobile-help.active {
    color: var(--primary);
}

.sidebar-brand {
    padding: 0 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
    text-align: center;
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    object-fit: contain;
    display: block;
    margin: 0 auto 0.75rem;
}

.sidebar-name {
    font-size: 0.75rem;
    color: var(--text-muted);
    line-height: 1.4;
    margin: 0;
}

.sidebar nav a {
    display: block;
    padding: 0.5rem 1rem;
    color: var(--text);
    text-decoration: none !important;
    font-size: 0.9375rem;
    border-right: 3px solid transparent;
}
.sidebar nav .sidebar-parent {
    display: flex;
    flex-direction: column;
}
.sidebar nav .sidebar-sub {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
}
.sidebar nav .sidebar-sub a {
    padding: 0.35rem 1rem;
    font-size: 0.875rem;
    color: var(--text-muted);
}
.sidebar nav .sidebar-sub a:hover {
    color: var(--primary);
}
.sidebar nav .sidebar-sub a.active {
    color: var(--primary);
    border-right-color: var(--primary);
}
.sidebar nav .sidebar-sub-sub {
    padding-left: 1.5rem;
}
.sidebar nav .sidebar-sub-sub a {
    font-size: 0.8125rem;
    padding: 0.25rem 1rem;
}
.sidebar nav a:hover {
    color: var(--primary);
}
.sidebar nav a.active {
    color: var(--primary);
    border-right-color: var(--primary);
}

.main {
    flex: 1;
    margin-left: 240px;
    padding: 1.5rem 2rem;
    background: #fafafa;
    min-height: 100vh;
}

.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border);
}

.header h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 400;
}

.header-actions a {
    margin-left: 1rem;
}

/* Screen reader only (visually hidden, available to assistive tech) */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}
.form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-muted);
}
.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.5rem 0.75rem;
    border: 1px solid #e5e5e5;
    border-radius: 6px;
    font-size: 0.9375rem;
    font-weight: 400;
    transition: border-color 0.15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #999;
}
.form-control {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 0.9375rem;
    font-weight: 400;
    line-height: 1.5;
    color: var(--text);
    background-color: var(--white);
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.form-control:focus {
    color: var(--text);
    background-color: var(--white);
    border-color: #80bdff;
    outline: 0;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
.form-control::placeholder {
    color: #6c757d;
    opacity: 1;
}
.form-group textarea {
    min-height: 64px;
    resize: vertical;
}

.form-group.checkbox-row label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin-bottom: 0;
    cursor: pointer;
}
.form-group.checkbox-row input[type="checkbox"] {
    width: auto;
}

/* Checkbox list (e.g. managed fellowships) – each row: checkbox + label aligned */
.checkbox-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.checkbox-group .checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0;
    cursor: pointer;
    font-size: 0.9375rem;
    color: var(--text);
    font-weight: 400;
}
.checkbox-group .checkbox-label input[type="checkbox"] {
    width: auto;
    flex-shrink: 0;
}

/* Member search autocomplete - modern combobox */
.member-search-wrap {
    position: relative;
    flex: 1;
    max-width: 280px;
}
.member-search-wrap .member-search-input {
    width: 100%;
    padding: 0.625rem 0.875rem;
    border: 1px solid #ced4da;
    border-radius: 0.375rem;
    font-size: 0.9375rem;
    background: var(--white);
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
    font-weight: 400;
    color: var(--text);
    line-height: 1.5;
    display: block;
}
.member-search-wrap .member-search-input::placeholder {
    color: #6c757d;
    opacity: 1;
    font-weight: 400;
}
.member-search-wrap .member-search-input:focus {
    outline: 0;
    border-color: #80bdff;
    box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
    background-color: var(--white);
}
.member-search-wrap .member-search-input.selected {
    border-color: #28a745;
    background-color: #d4edda;
}
.member-search-wrap .member-search-input:disabled {
    background-color: #e9ecef;
    opacity: 1;
    cursor: not-allowed;
}
.member-search-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 2px;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    max-height: 240px;
    overflow-y: auto;
    z-index: 1000;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}
.member-search-dropdown.is-open {
    display: block;
}
.member-search-dropdown .autocomplete-item {
    padding: 0.5rem 0.875rem;
    cursor: pointer;
    font-size: 0.9375rem;
    border-bottom: 1px solid #f1f5f9;
    transition: background 0.1s;
}
.member-search-dropdown .autocomplete-item:last-child {
    border-bottom: none;
}
.member-search-dropdown .autocomplete-item:hover,
.member-search-dropdown .autocomplete-item.highlight {
    background: #f1f5f9;
}
.member-search-dropdown .autocomplete-empty {
    padding: 0.75rem 0.875rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-card {
    background: var(--white);
    border-radius: 8px;
    border: 1px solid var(--border);
    padding: 1.5rem;
    max-width: 560px;
    margin: 0 auto;
}

/* Wider card option (used by Birthday messages settings) */
.form-card.form-card-wide {
    max-width: 980px;
}

.settings-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.75rem;
}
.settings-nav a {
    padding: 0.5rem 1rem;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9375rem;
}
.settings-nav a:hover {
    background: var(--bg);
    color: var(--text);
}
.settings-nav a.active {
    background: transparent;
    color: var(--text);
    border-bottom: 2px solid var(--primary);
    border-radius: 0;
}

/* Fund summary tabs (General funds | Target offerings) */
.fund-summary-tabs a.fund-summary-tab {
    color: var(--text-muted);
    text-decoration: none;
}
.fund-summary-tabs a.fund-summary-tab:hover {
    color: var(--text);
}
.fund-summary-tabs a.fund-summary-tab.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
    font-weight: 600;
}

.settings-section {
    margin-bottom: 1.5rem;
}
.settings-section:last-child {
    margin-bottom: 0;
}

.sms-balance-box {
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    background: var(--bg, #f8fafc);
    border-radius: 6px;
    border: 1px solid var(--border, #e2e8f0);
    font-size: 0.9375rem;
}

/* ========== Dashboard – modern layout with stat cards ========== */
.dash-page {
    max-width: 1280px;
    margin: 0 auto;
}

.dash-header {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}
.dash-title {
    margin: 0 0 0.25rem;
    font-size: 1.625rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.02em;
}
.dash-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #718096;
}
.dash-header-right {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 0.75rem;
}
.dash-period {
    font-size: 0.875rem;
    color: #718096;
    margin-right: 0.25rem;
    padding: 0.35rem 0.5rem;
    background: #f7fafc;
    border-radius: 6px;
}
.dash-user {
    font-size: 0.875rem;
    color: #4a5568;
    font-weight: 500;
}
.dash-logout {
    font-size: 0.875rem;
    color: #718096;
    text-decoration: none;
}
.dash-logout:hover {
    color: var(--primary);
}

/* Stat cards – always visible as distinct cards */
.dash-stat-cards {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1.25rem;
    margin-bottom: 2rem;
}
@media (max-width: 1100px) {
    .dash-stat-cards {
        grid-template-columns: repeat(3, 1fr);
    }
}
@media (max-width: 640px) {
    .dash-stat-cards {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}
.dash-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 96px;
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.dash-stat-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.08);
    color: inherit;
}
.dash-stat-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}
.dash-stat-card-1 .dash-stat-icon { background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%); }
.dash-stat-card-2 .dash-stat-icon { background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%); }
.dash-stat-card-3 .dash-stat-icon { background: linear-gradient(135deg, #d69e2e 0%, #b7791f 100%); }
.dash-stat-card-4 .dash-stat-icon { background: linear-gradient(135deg, #38a169 0%, #276749 100%); }
.dash-stat-card-5 .dash-stat-icon { background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%); }
.dash-stat-inner {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.dash-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
}
.dash-stat-number {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

/* Content row */
.dash-content {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}
@media (max-width: 900px) {
    .dash-content {
        grid-template-columns: 1fr;
    }
}
.dash-main {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.dash-aside {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Content cards */
.dash-box {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.dash-box:last-child {
    margin-bottom: 0;
}
.dash-box-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: #fafafa;
    border-bottom: 1px solid #e2e8f0;
}
.dash-box-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
}
.dash-box > .dash-box-title {
    padding: 1rem 1.25rem;
    background: #fafafa;
    border-bottom: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
}
.dash-box-action {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}
.dash-box-action:hover {
    text-decoration: underline;
}
.dash-box-action + .dash-box-action {
    margin-left: 0.75rem;
}
.dash-box-body {
    padding: 1.25rem;
}
.dash-box-body.p-0 {
    padding: 0;
}
.dash-box-muted {
    font-size: 0.875rem;
    color: #718096;
    margin: 0 0 0.75rem;
}
.dash-box-footer {
    margin: 0.75rem 0 0;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-muted);
}
.dash-box-footer a {
    color: var(--primary);
    text-decoration: none;
}
.dash-box-footer a:hover {
    text-decoration: underline;
}
.dash-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    margin: 0 0 0.5rem;
    letter-spacing: -0.02em;
}
.dash-empty {
    margin: 0;
    color: #718096;
    font-size: 0.9375rem;
}

/* New members list (reference: avatar + name + meta) */
.dash-members-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.dash-members-list li {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--border);
}
.dash-members-list li:last-child {
    border-bottom: none;
}
.dash-member-avatar {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    font-size: 0.875rem;
    font-weight: 600;
}
.dash-member-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.dash-member-info a {
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}
.dash-member-info a:hover {
    color: var(--primary);
}
.dash-member-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

/* Activity list */
.dash-activity-list {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9375rem;
}
.dash-activity-list li {
    padding: 0.5rem 0;
    border-bottom: 1px solid var(--border);
}
.dash-activity-list li:last-child {
    border-bottom: none;
}
.dash-activity-list a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.dash-activity-list a:hover {
    text-decoration: underline;
}
.dash-activity-meta {
    color: #718096;
    font-size: 0.875rem;
    font-weight: 400;
}

/* Recent activity: grouped sections, horizontal layout */
.dash-activity-box .dash-box-title {
    padding: 1rem 1.25rem;
    background: #fafafa;
    border-bottom: 1px solid #e2e8f0;
    margin: 0;
}
.dash-activity-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}
@media (max-width: 900px) {
    .dash-activity-grid {
        grid-template-columns: 1fr;
    }
}
.dash-activity-section {
    min-width: 0;
}
.dash-activity-section:last-child {
    margin-bottom: 0;
}
.dash-activity-section-title {
    margin: 0 0 0.5rem;
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: #718096;
}
.dash-activity-section .dash-activity-list {
    margin: 0;
}
.dash-activity-section .dash-activity-list li:first-child {
    padding-top: 0;
}
.dash-activity-more {
    margin: 0.5rem 0 0;
    font-size: 0.8125rem;
}
.dash-activity-more a {
    color: var(--primary);
    text-decoration: none;
}
.dash-activity-more a:hover {
    text-decoration: underline;
}

/* Quick links in sidebar */
.dash-links {
    margin: 0;
    padding: 0;
    list-style: none;
}
.dash-links li {
    border-bottom: 1px solid var(--border);
}
.dash-links li:last-child {
    border-bottom: none;
}
.dash-links a {
    display: block;
    padding: 0.6rem 0;
    font-size: 0.9375rem;
    color: var(--text);
    text-decoration: none;
}
.dash-links a:hover {
    color: var(--primary);
}

/* Upcoming list (reference: icon + title + action) */
.dash-upcoming-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.dash-upcoming-item {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
}
.dash-upcoming-item:last-child {
    border-bottom: none;
}
.dash-upcoming-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 50%;
}
.dash-upcoming-birthday .dash-upcoming-icon { background: #f59e0b; }
.dash-upcoming-event .dash-upcoming-icon { background: #e53e3e; }
.dash-upcoming-preaching .dash-upcoming-icon { background: #38a169; }
.dash-upcoming-body {
    flex: 1;
    min-width: 0;
    font-size: 0.9375rem;
}
.dash-upcoming-body a {
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}
.dash-upcoming-body a:hover {
    color: var(--primary);
}
.dash-upcoming-action {
    display: block;
    font-size: 0.8125rem;
    color: var(--primary);
    margin-top: 0.2rem;
}
.dash-upcoming-date {
    font-size: 0.8125rem;
    color: var(--text-muted);
    margin-left: 0.35rem;
}

/* Groups list (reference: name + View ▸) */
.dash-groups-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.dash-group-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
}
.dash-group-item:last-child {
    border-bottom: none;
}
.dash-group-name {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
}
.dash-group-view {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
}
.dash-group-view:hover {
    text-decoration: underline;
}

/* ========== Membership Analytics page ========== */
.analytics-page {
    max-width: 1280px;
    margin: 0 auto;
}
.analytics-header {
    margin-bottom: 1.75rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid #e2e8f0;
}
.analytics-back {
    display: inline-block;
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    margin-bottom: 0.5rem;
}
.analytics-back:hover {
    text-decoration: underline;
}
.analytics-title {
    margin: 0 0 0.25rem;
    font-size: 1.625rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.02em;
}
.analytics-subtitle {
    margin: 0;
    font-size: 0.875rem;
    color: #718096;
}

/* Analytics stat cards – match dashboard style */
.analytics-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1.25rem;
    margin-bottom: 2rem;
}
@media (min-width: 900px) {
    .analytics-stats {
        grid-template-columns: repeat(6, 1fr);
    }
}
@media (max-width: 640px) {
    .analytics-stats {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}
.analytics-stat-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    min-height: 96px;
    padding: 1.25rem 1.5rem;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
}
.analytics-stat-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.25rem;
}
.analytics-stat-card-1 .analytics-stat-icon { background: linear-gradient(135deg, #3182ce 0%, #2c5282 100%); }
.analytics-stat-card-2 .analytics-stat-icon { background: linear-gradient(135deg, #e53e3e 0%, #c53030 100%); }
.analytics-stat-card-3 .analytics-stat-icon { background: linear-gradient(135deg, #38a169 0%, #276749 100%); }
.analytics-stat-card-4 .analytics-stat-icon { background: linear-gradient(135deg, #d69e2e 0%, #b7791f 100%); }
.analytics-stat-card-5 .analytics-stat-icon { background: linear-gradient(135deg, #805ad5 0%, #6b46c1 100%); }
.analytics-stat-card-6 .analytics-stat-icon { background: linear-gradient(135deg, #00b5d8 0%, #0987a0 100%); }
.analytics-stat-inner {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    min-width: 0;
}
.analytics-stat-label {
    font-size: 0.6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
}
.analytics-stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1a202c;
    line-height: 1.2;
    letter-spacing: -0.02em;
}
.analytics-stat-unit {
    font-size: 0.875rem;
    font-weight: 500;
    color: #718096;
}
.analytics-stat-meta {
    font-size: 0.75rem;
    color: #718096;
    margin-top: 0.15rem;
}

/* Charts grid */
.analytics-charts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}
@media (max-width: 768px) {
    .analytics-charts {
        grid-template-columns: 1fr;
    }
}
.analytics-chart-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    padding: 1.25rem;
    overflow: hidden;
}
.analytics-chart-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
}
.analytics-chart-wrap {
    position: relative;
    max-height: 260px;
    min-height: 200px;
}

/* Streamlit-style metrics (replacing doughnut/pie for Status and Gender) */
.analytics-metrics-card .analytics-chart-title {
    margin-bottom: 1rem;
}
.analytics-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}
.analytics-metric {
    flex: 1;
    min-width: 120px;
    padding: 1rem 1.25rem;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 0;
    border-left-width: 4px;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.analytics-metric-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: #718096;
    text-transform: capitalize;
}
.analytics-metric-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: #1a202c;
    letter-spacing: -0.02em;
    line-height: 1.2;
}
.analytics-metric-delta {
    font-size: 0.8125rem;
    color: #718096;
}

/* Status metric colors */
.analytics-metric-blue { border-left-color: #3b82f6; background: #eff6ff; }
.analytics-metric-blue .analytics-metric-label { color: #1d4ed8; }
.analytics-metric-green { border-left-color: #10b981; background: #ecfdf5; }
.analytics-metric-green .analytics-metric-label { color: #047857; }
.analytics-metric-orange { border-left-color: #f59e0b; background: #fffbeb; }
.analytics-metric-orange .analytics-metric-label { color: #b45309; }
.analytics-metric-indigo { border-left-color: #6366f1; background: #eef2ff; }
.analytics-metric-indigo .analytics-metric-label { color: #4f46e5; }
.analytics-metric-slate { border-left-color: #64748b; background: #f1f5f9; }
.analytics-metric-slate .analytics-metric-label { color: #475569; }
.analytics-metric-gray { border-left-color: #6b7280; background: #f3f4f6; }
.analytics-metric-gray .analytics-metric-label { color: #4b5563; }

/* Gender metric colors */
.analytics-metric-male { border-left-color: #3b82f6; background: #eff6ff; }
.analytics-metric-male .analytics-metric-label { color: #1d4ed8; }
.analytics-metric-female { border-left-color: #ec4899; background: #fdf2f8; }
.analytics-metric-female .analytics-metric-label { color: #be185d; }

/* Analytics content cards */
.analytics-card {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    margin-bottom: 1.5rem;
    overflow: hidden;
}
.analytics-card:last-child {
    margin-bottom: 0;
}
.analytics-card-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 1rem 1.25rem;
    background: #fafafa;
    border-bottom: 1px solid #e2e8f0;
}
.analytics-card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #1a202c;
}
.analytics-card-action {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--primary);
    text-decoration: none;
}
.analytics-card-action:hover {
    text-decoration: underline;
}
.analytics-card-body {
    padding: 1.25rem;
}
.analytics-empty {
    margin: 0;
    color: #718096;
    font-size: 0.9375rem;
}
.analytics-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9375rem;
}
.analytics-table th,
.analytics-table td {
    padding: 0.65rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid #e2e8f0;
}
.analytics-table th {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #718096;
}
.analytics-table tbody tr:hover {
    background: #fafafa;
}
.analytics-table-totals td {
    font-weight: 600;
    border-top: 2px solid #e2e8f0;
    padding-top: 0.75rem;
    background: #f8fafc;
}
.analytics-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.analytics-table-note {
    margin: 0.75rem 0 0;
    font-size: 0.8125rem;
    color: #718096;
}

/* Data quality strip */
.analytics-quality-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 1rem;
}
.analytics-quality-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: #f7fafc;
    border-radius: 8px;
    border: 1px solid #e2e8f0;
}
.analytics-quality-item.has-issue {
    background: #fff5f5;
    border-color: #feb2b2;
}
.analytics-quality-item.ok {
    background: #f0fff4;
    border-color: #9ae6b4;
}
.analytics-quality-icon {
    font-size: 1.25rem;
}
.analytics-quality-item.has-issue .analytics-quality-value {
    color: #c53030;
    font-weight: 600;
}
.analytics-quality-label {
    display: block;
    font-size: 0.8125rem;
    color: #718096;
}
.analytics-quality-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: #1a202c;
}

/* Head of household type-ahead */
.form-group-head { position: relative; }
.head-member-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 100;
    max-height: 220px;
    overflow-y: auto;
    background: #fff;
    border: 1px solid var(--border, #e2e8f0);
    border-top: none;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    margin: 0;
    padding: 0;
    list-style: none;
}
.head-member-item {
    padding: 0.5rem 0.75rem;
    cursor: pointer;
    font-size: 0.9375rem;
    border-bottom: 1px solid #f1f5f9;
}
.head-member-item:last-child { border-bottom: none; }
.head-member-item:hover,
.head-member-item:focus {
    background: #f1f5f9;
    outline: none;
}

/* Definition list inline (e.g. household view) */
.dl-inline { margin: 0; }
.dl-inline dt { font-weight: 600; font-size: 0.8125rem; color: var(--text-muted); margin-top: 0.75rem; }
.dl-inline dt:first-child { margin-top: 0; }
.dl-inline dd { margin: 0.25rem 0 0; font-size: 0.9375rem; }

/* Card (generic – used by other pages) */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    box-shadow: 0 0 1px rgba(0,0,0,0.125), 0 1px 3px rgba(0,0,0,0.2);
    margin-bottom: 1.5rem;
}
.card-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: #f8f9fa;
    border-bottom: 1px solid var(--border);
    border-radius: 4px 4px 0 0;
}
.card-header-success {
    background: #d4edda;
    border-bottom-color: #c3e6cb;
}
.card-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}
.card-title i {
    margin-right: 0.4rem;
    color: var(--text-muted);
}
.card-tools {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.btn-tool {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--primary);
    background: transparent;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
}
.btn-tool:hover {
    background: rgba(0,0,0,0.05);
    color: var(--primary);
}
.card-body {
    padding: 1rem;
}
.card-body.p-0 {
    padding: 0;
}
.card-body.text-center {
    text-align: center;
}
.card-amount {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 1rem;
}
.card-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.card-actions .btn {
    margin: 0;
}

/* Quick links (generic) */
.quick-links {
    margin: 0;
    padding: 0;
    list-style: none;
}
.quick-links li {
    border-bottom: 1px solid var(--border);
}
.quick-links li:last-child {
    border-bottom: none;
}
.quick-links a {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s, color 0.15s;
}
.quick-links a:hover {
    background: #f8f9fa;
    color: var(--primary);
}
.quick-links a i {
    width: 1.25rem;
    text-align: center;
    color: var(--text-muted);
}

/* Finance accounting overview */
.finance-accounting-summary {
    margin-bottom: 1.5rem;
}
.finance-accounting-title {
    margin: 0 0 1rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-muted);
}
.finance-summary-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}
@media (max-width: 640px) {
    .finance-summary-cards {
        grid-template-columns: 1fr;
    }
}
.finance-summary-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}
.finance-summary-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
}
.finance-summary-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
}
.finance-summary-meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.member-form .form-row .form-group {
    margin-bottom: 1.25rem;
}

.test-form {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}
.test-form input {
    margin: 0;
}

/* Member view – clean profile layout */
.member-view-wrapper {
    max-width: 700px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    padding: 0;
}
.member-view { 
    width: 100%;
    padding: 0;
}
.member-view-hero {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    margin-bottom: 2rem;
    padding-bottom: 2rem;
    border-bottom: 1px solid var(--border);
}
.member-view-photo {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    border: 2px solid var(--border);
    transition: opacity 0.2s;
}
.member-view-photo:hover {
    opacity: 0.8;
}
.member-view-photo-placeholder {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: var(--text-muted);
}
.member-view-hero-text { flex: 1; min-width: 0; }
.member-view-name { 
    margin: 0 0 0.5rem; 
    font-size: 1.5rem; 
    font-weight: 500; 
    color: var(--text);
    line-height: 1.3;
}
.member-view-meta { 
    margin: 0; 
    font-size: 0.9375rem; 
    color: var(--text-muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}
.member-view-meta span {
    display: inline-block;
}
.member-view-meta span:not(:last-child)::after {
    content: ' · ';
    margin: 0 0.25rem;
}
.member-view-cards { 
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.member-view-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1.5rem;
}
.member-view-card-title {
    margin: 0 0 1rem;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.member-view-list { list-style: none; margin: 0; padding: 0; }
.member-view-list li {
    display: flex;
    gap: 1rem;
    padding: 0.5rem 0;
    font-size: 0.9375rem;
    border-bottom: 1px solid #f5f5f5;
}
.member-view-list li:last-child { border-bottom: none; }
.member-view-label {
    flex: 0 0 120px;
    color: var(--text-muted);
    font-size: 0.875rem;
}
.member-view-list li > *:not(.member-view-label) {
    flex: 1;
    min-width: 0;
    word-break: break-word;
    color: var(--text);
}
.member-view-list a { 
    color: var(--primary);
    text-decoration: none;
}
.member-view-list a:hover {
    text-decoration: underline;
}
.member-view-empty { 
    margin: 0; 
    font-size: 0.9375rem; 
    color: var(--text-muted);
    font-style: italic;
    padding: 0.5rem 0;
}
.member-view-notes { 
    margin: 0; 
    font-size: 0.9375rem; 
    line-height: 1.6; 
    color: var(--text);
}

@media (max-width: 768px) {
    .member-view-wrapper {
        max-width: 100%;
    }
    .member-view-hero {
        flex-direction: column;
        text-align: center;
        gap: 1rem;
    }
    .member-view-photo,
    .member-view-photo-placeholder {
        width: 80px;
        height: 80px;
    }
    .member-view-name {
        font-size: 1.25rem;
    }
    .member-view-card {
        padding: 1.25rem;
    }
    .member-view-label {
        flex: 0 0 100px;
    }
}

/* Image Modal */
.image-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    box-sizing: border-box;
}
.image-modal[hidden] {
    display: none;
}
.image-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    cursor: pointer;
}
.image-modal-content {
    position: relative;
    max-width: min(90vw, 560px);
    max-height: 90vh;
    z-index: 10001;
    display: flex;
    flex-direction: column;
    background: var(--white);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08);
}
.image-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.25rem 1.5rem;
    background: var(--primary);
    color: var(--white);
}
.image-modal-title {
    margin: 0;
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--white);
    letter-spacing: 0.01em;
    line-height: 1.3;
    flex: 1;
    min-width: 0;
    padding-right: 0.5rem;
}
.image-modal-close {
    flex-shrink: 0;
    width: 40px;
    height: 40px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    color: var(--white);
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s;
}
.image-modal-close:hover {
    background: rgba(255, 255, 255, 0.3);
}
.image-modal-close span {
    line-height: 1;
    margin-top: -2px;
}
.image-modal-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    max-height: calc(90vh - 88px);
    overflow: auto;
    background: #f8f9fa;
}
.image-modal-content img {
    max-width: 100%;
    max-height: calc(90vh - 136px);
    object-fit: contain;
    border-radius: 8px;
    display: block;
}

.birthday-list { list-style: none; margin: 0; padding: 0; }
.birthday-list li { padding: 0.35rem 0; border-bottom: 1px solid #f0f4f8; }
.birthday-list li:last-child { border-bottom: none; }

.member-list-photo {
    width: 32px;
    height: 32px;
    object-fit: cover;
    border-radius: 4px;
    vertical-align: middle;
    margin-right: 0.5rem;
}

/* Member photo upload – clickable shape */
.member-photo-upload {
    position: relative;
    display: inline-block;
}

.member-photo-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 140px;
    height: 160px;
    border: 2px dashed var(--border, #e2e8f0);
    border-radius: 8px;
    background: #fafafa;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
    padding: 0.5rem;
    box-sizing: border-box;
}

.member-photo-placeholder:hover {
    border-color: var(--primary, #1e3a5f);
    background: #f0f4f8;
}

.member-photo-placeholder .member-photo-existing {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 6px;
}

.member-photo-placeholder .member-photo-default {
    width: 100%;
    flex: 1;
    min-height: 0;
    object-fit: cover;
    border-radius: 6px 6px 0 0;
}

.member-photo-placeholder-text {
    font-size: 0.8125rem;
    color: var(--text-muted, #718096);
}

.member-photo-placeholder .member-photo-hint {
    font-size: 0.75rem;
    color: var(--text-muted, #718096);
    margin-top: 0.25rem;
}

.member-photo-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.member-photo-preview {
    position: absolute;
    top: 0;
    left: 0;
    width: 140px;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    border: 2px solid var(--border);
    display: none;
    z-index: 1;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.form-actions .btn,
.form-actions .btn-ghost {
    padding: 0.4rem 1rem;
    font-size: 0.875rem;
}

.btn-ghost {
    background: transparent !important;
    color: var(--text-muted) !important;
}
.btn-ghost:hover {
    background: #f5f5f5 !important;
    color: var(--text) !important;
}

.link-muted {
    color: var(--text-muted);
}
.link-muted:hover {
    color: var(--primary);
}

/* Tables */
.table-wrap {
    overflow-x: auto;
}
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--white);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid var(--border);
}
th, td {
    padding: 0.75rem 1rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}
th {
    background: var(--bg);
    font-weight: 400;
}
tr:hover td {
    background: #fafafa;
}
.actions a {
    margin-right: 0.75rem;
}

/* Icon buttons - outline style */
.actions .btn-icon,
.btn-icon {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    margin-right: 0.5rem !important;
    background: var(--white) !important;
    border: 1px solid var(--border) !important;
    border-radius: 4px !important;
    color: var(--primary) !important;
    text-decoration: none !important;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    vertical-align: middle;
}
.actions .btn-icon:hover,
.btn-icon:hover {
    background: var(--primary) !important;
    color: var(--white) !important;
    border-color: var(--primary) !important;
    text-decoration: none !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
}
.actions .btn-icon:active,
.btn-icon:active {
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(1px);
}
.actions .btn-icon svg,
.btn-icon svg {
    width: 16px;
    height: 16px;
    display: block;
    flex-shrink: 0;
}
.actions .btn-icon-danger,
.btn-icon-danger {
    border-color: #c53030 !important;
    color: #c53030 !important;
}
.actions .btn-icon-danger:hover,
.btn-icon-danger:hover {
    background: #c53030 !important;
    color: var(--white) !important;
    border-color: #c53030 !important;
}
.actions {
    white-space: nowrap;
}
.actions .btn-icon:last-child {
    margin-right: 0 !important;
}

/* Cards */
.card {
    background: var(--white);
    border-radius: 6px;
    padding: 1.5rem;
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.modal[hidden] {
    display: none;
}
.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
}
.modal-content {
    position: relative;
    background: var(--white);
    border-radius: 8px;
    padding: 1.5rem;
    max-width: 360px;
    width: 100%;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}
.modal-content-form {
    max-width: 420px;
}
.modal-content-preview {
    max-width: 520px;
}
.email-preview-meta {
    font-size: 0.9375rem;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border, #e5e7eb);
}
.email-preview-meta strong {
    color: var(--text-muted, #6b7280);
    font-weight: 500;
}
.email-preview-body {
    background: var(--bg-subtle, #f9fafb);
    border: 1px solid var(--border, #e5e7eb);
    border-radius: 8px;
    padding: 1.25rem 1.5rem;
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--text);
    max-height: 50vh;
    overflow-y: auto;
}
.email-preview-body p {
    margin: 0 0 0.75em;
}
.email-preview-body p:last-child {
    margin-bottom: 0;
}
.modal-heading {
    margin: 0 0 0.5rem;
    font-size: 1.125rem;
}
.form-errors {
    font-size: 0.875rem;
    color: var(--danger, #c00);
    margin-bottom: 0.5rem;
}
.modal-message {
    margin: 0 0 1.25rem;
    font-size: 0.9375rem;
    color: var(--text);
}
.modal-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Voting: image-based next/previous for low-literacy users */
.vote-nav-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem;
    width: 64px;
    height: 64px;
    min-width: 64px;
    max-width: 64px;
    min-height: 64px;
    max-height: 64px;
    border-radius: 8px;
    border: 2px solid var(--border, #e2e8f0);
    background: #fff;
    cursor: pointer;
    transition: all 0.2s;
    text-decoration: none;
    color: inherit;
    flex-shrink: 0;
    box-sizing: border-box;
}
.vote-nav-btn:hover { background: #f1f5f9; border-color: #cbd5e1; }
/* Back / Previous: red, left arrow */
.vote-nav-btn.vote-nav-prev { border-color: #dc2626; background: #dc2626; color: #fff; }
.vote-nav-btn.vote-nav-prev:hover { filter: brightness(1.1); }
.vote-nav-btn.vote-nav-prev i.fas { color: #fff; }
/* Next / Continue / Submit: green, right arrow */
.vote-nav-btn.vote-nav-next { border-color: #16a34a; background: #16a34a; color: #fff; }
.vote-nav-btn.vote-nav-next:hover { filter: brightness(1.1); }
.vote-nav-btn.vote-nav-next i.fas { color: #fff; }
.vote-nav-btn i.fas {
    font-size: 1.5rem;
    line-height: 1;
}

/* Toast notifications */
.toast-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    padding: 0.75rem 0.75rem;
    border-radius: 6px;
    font-size: 0.875rem;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    animation: toast-in 0.2s ease;
    transition: opacity 0.2s, transform 0.2s;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    max-width: min(520px, calc(100vw - 2rem));
}

.toast-message {
    flex: 1 1 auto;
    white-space: pre-wrap;
    word-break: break-word;
}

.toast-close {
    flex: 0 0 auto;
    appearance: none;
    border: 0;
    background: transparent;
    color: inherit;
    font-size: 1.1rem;
    line-height: 1;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    cursor: pointer;
    opacity: 0.9;
}
.toast-close:hover { opacity: 1; background: rgba(255,255,255,0.12); }

.toast-success {
    background: #276749;
    color: #fff;
}

.toast-error {
    background: #c53030;
    color: #fff;
}

@keyframes toast-in {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

/* Modal UX */
body.modal-open {
    overflow: hidden;
}

/* Small-screen polish (clerk-friendly) */
@media (max-width: 640px) {
    .header {
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: flex-start;
    }
    .header-actions {
        width: 100%;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 0.5rem;
    }
    .filter-bar {
        gap: 0.75rem;
    }
    .filter-bar form {
        width: 100%;
    }
    .filter-bar input {
        min-width: 0;
        width: 100%;
    }
    .btn {
        padding: 0.5rem 0.85rem;
        font-size: 0.9rem;
    }
    .btn-sm {
        padding: 0.4rem 0.65rem;
        font-size: 0.82rem;
    }
    .toast-container {
        left: 1rem;
        right: 1rem;
        top: 0.75rem;
    }
    .toast {
        max-width: 100%;
    }
}

/* Inline alerts (for pages without layout, e.g. login) - fallback */
.alert {
    padding: 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
}
.alert-error {
    background: #fed7d7;
    color: #c53030;
}
.alert-success {
    background: #c6f6d5;
    color: #276749;
}

.badge {
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--text-muted);
}

/* Pagination */
.pagination {
    display: flex;
    gap: 0.5rem;
    margin-top: 1rem;
}
.pagination a,
.pagination span {
    padding: 0.4rem 0.8rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--white);
}
.pagination .current {
    background: var(--primary);
    color: var(--white);
    border-color: var(--primary);
}

/* Search/filter bar */
.filter-bar {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.filter-bar input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    min-width: 200px;
}

/* —— Registration progress (modern dashboard) —— */
.reg-progress-page {
    --rp-ink: #0f172a;
    --rp-muted: #64748b;
    --rp-line: #e2e8f0;
    --rp-card: #ffffff;
    --rp-surface: #f8fafc;
    --rp-teal: #0d9488;
    --rp-teal-soft: rgba(13, 148, 136, 0.12);
    --rp-indigo: #4f46e5;
    --rp-indigo-soft: rgba(79, 70, 229, 0.1);
    --rp-amber: #d97706;
    --rp-radius: 16px;
    --rp-radius-sm: 12px;
    --rp-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 4px 24px rgba(15, 23, 42, 0.06);
    --rp-shadow-hover: 0 8px 32px rgba(15, 23, 42, 0.08);
    max-width: 1400px;
    margin: 0 auto;
    padding-bottom: 2.5rem;
}

.reg-progress-hero {
    position: relative;
    overflow: hidden;
    border-radius: var(--rp-radius);
    padding: 1.75rem 1.75rem 1.5rem;
    margin-bottom: 1.25rem;
    background:
        radial-gradient(1200px 400px at 100% -20%, rgba(79, 70, 229, 0.14), transparent 55%),
        radial-gradient(800px 320px at -10% 120%, rgba(13, 148, 136, 0.12), transparent 50%),
        linear-gradient(165deg, #ffffff 0%, #f1f5f9 100%);
    border: 1px solid rgba(226, 232, 240, 0.9);
    box-shadow: var(--rp-shadow);
}

.reg-progress-hero::after {
    content: "";
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
    opacity: 0.5;
    pointer-events: none;
    border-radius: inherit;
}

.reg-progress-hero-inner {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1.25rem;
}

.reg-progress-eyebrow {
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--rp-teal);
    margin: 0 0 0.35rem;
}

.reg-progress-title {
    font-size: clamp(1.5rem, 2.5vw, 1.875rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--rp-ink);
    margin: 0 0 0.35rem;
    line-height: 1.15;
}

.reg-progress-lede {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--rp-muted);
    max-width: 36rem;
    line-height: 1.5;
}

.reg-progress-hero-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
}

.reg-progress-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--rp-ink);
    background: rgba(255, 255, 255, 0.75);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 999px;
    backdrop-filter: blur(8px);
}

.reg-progress-pill i {
    color: var(--rp-indigo);
    font-size: 0.7rem;
}

.reg-progress-hero-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reg-progress-hero-actions .btn {
    border-radius: 10px;
    font-weight: 500;
}

.reg-progress-details {
    margin-bottom: 1.5rem;
    border-radius: var(--rp-radius-sm);
    border: 1px solid var(--rp-line);
    background: var(--rp-card);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.reg-progress-details summary {
    cursor: pointer;
    list-style: none;
    padding: 0.85rem 1.1rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--rp-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

.reg-progress-details summary::-webkit-details-marker {
    display: none;
}

.reg-progress-details summary::before {
    content: "\f078";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.65rem;
    transition: transform 0.2s ease;
    color: var(--rp-teal);
}

.reg-progress-details[open] summary::before {
    transform: rotate(180deg);
}

.reg-progress-details .reg-progress-details-body {
    padding: 0 1.1rem 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--rp-muted);
    border-top: 1px solid var(--rp-line);
}

.reg-progress-details .reg-progress-details-body code {
    font-size: 0.76rem;
    padding: 0.1rem 0.35rem;
    border-radius: 4px;
    background: var(--rp-surface);
    color: var(--rp-ink);
}

.reg-progress-kpi-primary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

@media (max-width: 900px) {
    .reg-progress-kpi-primary {
        grid-template-columns: 1fr;
    }
}

.reg-progress-kpi-tile {
    position: relative;
    border-radius: var(--rp-radius);
    padding: 1.35rem 1.35rem 1.25rem;
    background: var(--rp-card);
    border: 1px solid var(--rp-line);
    box-shadow: var(--rp-shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    overflow: hidden;
}

.reg-progress-kpi-tile:hover {
    transform: translateY(-2px);
    box-shadow: var(--rp-shadow-hover);
}

.reg-progress-kpi-tile::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    border-radius: var(--rp-radius) var(--rp-radius) 0 0;
    opacity: 0.9;
}

.reg-progress-kpi-tile--households::before {
    background: linear-gradient(90deg, var(--rp-indigo), #818cf8);
}

.reg-progress-kpi-tile--members::before {
    background: linear-gradient(90deg, var(--rp-teal), #2dd4bf);
}

.reg-progress-kpi-tile--avg::before {
    background: linear-gradient(90deg, var(--rp-amber), #fbbf24);
}

.reg-progress-kpi-tile--team::before {
    background: linear-gradient(90deg, #7c3aed, #a78bfa);
}

.reg-progress-kpi-label {
    display: block;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--rp-muted);
    margin-bottom: 0.5rem;
}

.reg-progress-kpi-value {
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    font-weight: 700;
    letter-spacing: -0.04em;
    color: var(--rp-ink);
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.reg-progress-kpi-hint {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    color: var(--rp-muted);
    line-height: 1.4;
}

.reg-progress-kpi-secondary {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0.25rem 0 0.75rem;
    margin-bottom: 1.5rem;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.reg-progress-kpi-secondary::-webkit-scrollbar {
    height: 4px;
}

.reg-progress-kpi-secondary::-webkit-scrollbar-thumb {
    background: var(--rp-line);
    border-radius: 4px;
}

.reg-progress-kpi-chip {
    flex: 0 0 auto;
    scroll-snap-align: start;
    min-width: 8.5rem;
    padding: 0.9rem 1rem;
    border-radius: var(--rp-radius-sm);
    background: var(--rp-card);
    border: 1px solid var(--rp-line);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.reg-progress-kpi-chip-label {
    display: block;
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rp-muted);
    margin-bottom: 0.35rem;
}

.reg-progress-kpi-chip-value {
    font-size: 1.35rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--rp-ink);
    font-variant-numeric: tabular-nums;
}

.reg-progress-panel {
    border-radius: var(--rp-radius);
    background: var(--rp-card);
    border: 1px solid var(--rp-line);
    box-shadow: var(--rp-shadow);
    overflow: hidden;
}

.reg-progress-panel-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1.1rem 1.25rem;
    border-bottom: 1px solid var(--rp-line);
    background: linear-gradient(180deg, #fafbfc 0%, #ffffff 100%);
}

.reg-progress-panel-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--rp-ink);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.reg-progress-panel-title i {
    color: var(--rp-teal);
    font-size: 0.95rem;
}

.reg-progress-panel-sub {
    margin: 0.25rem 0 0;
    font-size: 0.75rem;
    color: var(--rp-muted);
    max-width: 28rem;
    line-height: 1.45;
}

.reg-progress-panel-body {
    padding: 1rem 1.25rem 1.25rem;
}

.reg-progress-chart-wrap {
    position: relative;
    width: 100%;
    min-height: 300px;
    height: 360px;
}

.reg-progress-chart-wrap--tall {
    min-height: 320px;
    height: 400px;
}

.reg-progress-chart-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
    font-size: 0.875rem;
    color: var(--rp-muted);
    pointer-events: none;
    background: linear-gradient(180deg, transparent, rgba(248, 250, 252, 0.85));
}

.reg-progress-chart-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.reg-progress-callout {
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    border-radius: var(--rp-radius-sm);
    font-size: 0.8125rem;
    line-height: 1.5;
    background: var(--rp-indigo-soft);
    border: 1px solid rgba(79, 70, 229, 0.2);
    color: #3730a3;
}

.reg-progress-section-title {
    font-size: 0.8125rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--rp-muted);
    margin: 2rem 0 0.75rem;
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--rp-line);
}

.reg-progress-page .reg-progress-table-wrap {
    border-radius: var(--rp-radius);
    border: 1px solid var(--rp-line);
    overflow: hidden;
    box-shadow: var(--rp-shadow);
    background: var(--rp-card);
    margin-bottom: 1.5rem;
}

.reg-progress-page .reg-progress-table-wrap table {
    margin: 0;
}

.reg-progress-page .reg-progress-table-wrap thead th {
    background: var(--rp-surface);
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--rp-muted);
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--rp-line);
}

.reg-progress-page .reg-progress-table-wrap tbody td {
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    border-bottom: 1px solid rgba(226, 232, 240, 0.7);
    vertical-align: middle;
}

.reg-progress-page .reg-progress-table-wrap tbody tr:last-child td {
    border-bottom: none;
}

.reg-progress-page .reg-progress-table-wrap tbody tr:hover td {
    background: rgba(248, 250, 252, 0.85);
}

.reg-progress-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.55rem;
    font-size: 0.6875rem;
    font-weight: 600;
    border-radius: 999px;
}

.reg-progress-badge--ok {
    background: rgba(13, 148, 136, 0.12);
    color: #0f766e;
}

.reg-progress-badge--off {
    background: rgba(100, 116, 139, 0.12);
    color: var(--rp-muted);
}

.reg-progress-quality {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.reg-progress-quality-item {
    padding: 0.85rem 1rem;
    border-radius: var(--rp-radius-sm);
    background: var(--rp-card);
    border: 1px solid var(--rp-line);
    font-size: 0.8125rem;
}

.reg-progress-quality-item strong {
    display: block;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--rp-ink);
    margin-top: 0.25rem;
    font-variant-numeric: tabular-nums;
}

.reg-progress-quality-item span {
    color: var(--rp-muted);
    font-size: 0.75rem;
}

/* Registration progress: full-width (no sidebar), tablet-first */
.layout.layout--reg-progress .sidebar {
    display: none !important;
}

.layout.layout--reg-progress .main {
    margin-left: 0;
    width: 100%;
    max-width: 100%;
    flex: 1;
    min-width: 0;
    padding: max(0.5rem, env(safe-area-inset-top, 0px)) max(0.75rem, env(safe-area-inset-right, 0px)) max(1rem, env(safe-area-inset-bottom, 0px)) max(0.75rem, env(safe-area-inset-left, 0px));
    background: linear-gradient(180deg, #f1f5f9 0%, #f8fafc 48%, #fafafa 100%);
}

@media (min-width: 600px) {
    .layout.layout--reg-progress .main {
        padding: 1rem 1.25rem 1.75rem;
    }
}

@media (min-width: 900px) {
    .layout.layout--reg-progress .main {
        padding: 1.25rem 2rem 2rem;
    }
}

.reg-progress-topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.85rem;
    margin: 0 0 1rem;
    background: rgba(255, 255, 255, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: 14px;
    box-shadow: 0 2px 16px rgba(15, 23, 42, 0.06);
}

.reg-progress-topbar-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    text-decoration: none;
    color: var(--rp-ink, #0f172a);
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: -0.02em;
    min-height: 44px;
    padding: 0 0.25rem;
}

.reg-progress-topbar-brand img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    border-radius: 6px;
}

.reg-progress-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.reg-progress-topbar-actions a,
.reg-progress-topbar-actions .reg-progress-link-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 0.65rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: #475569;
    text-decoration: none;
    background: none;
    border: none;
    border-radius: 8px;
    font-family: inherit;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
}

.reg-progress-topbar-actions a:hover,
.reg-progress-topbar-actions .reg-progress-link-btn:hover {
    color: #0f172a;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.reg-progress-topbar-actions a.reg-progress-topbar-logout {
    font-weight: 600;
    color: #64748b;
}

.reg-progress-topbar-actions a.reg-progress-topbar-logout:hover {
    color: #b91c1c;
}

@media print {
    .reg-progress-topbar-actions {
        display: none !important;
    }

    .layout.layout--reg-progress .main {
        background: #fff;
        padding: 0.5rem;
    }

    .reg-progress-topbar {
        box-shadow: none;
        border: none;
        position: static;
    }
}

/* Tablet portrait: comfortable tap targets, single-column tables */
@media (max-width: 899px) {
    .reg-progress-page .reg-progress-table-wrap table {
        font-size: 0.8125rem;
    }

    .reg-progress-page .reg-progress-table-wrap th,
    .reg-progress-page .reg-progress-table-wrap td {
        padding: 0.65rem 0.75rem;
    }

    .reg-progress-hero {
        padding: 1.25rem 1.1rem;
    }

    .reg-progress-chart-wrap--tall {
        min-height: 260px !important;
        height: 280px !important;
    }
}

@media (orientation: portrait) and (max-width: 900px) {
    .reg-progress-kpi-primary {
        grid-template-columns: 1fr;
    }

    .reg-progress-kpi-secondary {
        padding-bottom: 0.5rem;
    }
}

/* Roster analytics */
.reg-progress-roster-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.reg-progress-roster-tile {
    padding: 1rem 1.1rem;
    border-radius: var(--rp-radius-sm, 12px);
    background: var(--rp-card, #fff);
    border: 1px solid var(--rp-line, #e2e8f0);
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.reg-progress-roster-tile .v {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: var(--rp-ink, #0f172a);
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.reg-progress-roster-tile .l {
    font-size: 0.65rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--rp-muted, #64748b);
    margin-top: 0.35rem;
}

.reg-progress-split-charts {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

@media (min-width: 768px) {
    .reg-progress-split-charts {
        grid-template-columns: 1fr 1fr;
    }
}
