/* ==========================================================================
   CCA Design System — mobile first
   Base rules target phones. Larger screens are progressive enhancements:
     sm  >= 576px   large phones / small tablets
     md  >= 768px   tablets (tables leave card mode)
     lg  >= 992px   notebooks (sidebar + white topbar, bottom nav hidden)
     xl  >= 1200px  desktops

   1. Tokens            5. Components
   2. Bootstrap bridge  6. Pages (dashboard, profile, login)
   3. Base              7. Utilities
   4. App shell
   ========================================================================== */

/* 1. Tokens ================================================================ */
:root {
    /* Brand - green */
    --green-950: #06271d;
    --green-900: #0b3d2e;
    --green-800: #0f4a38;
    --green-700: #145c44;
    --green-600: #1b7356;
    --green-200: #bfdccd;
    --green-100: #dcefe5;
    --green-50: #eef7f2;

    /* Brand - gold (accent) */
    --gold-700: #8a6508;
    --gold-600: #b8860b;
    --gold-500: #d4a017;
    --gold-400: #e6b93b;
    --gold-100: #faeecb;
    --gold-50: #fdf8e8;

    /* Neutrals (slightly green-tinted greys) */
    --gray-0: #ffffff;
    --gray-25: #fafbfa;
    --gray-50: #f4f6f5;
    --gray-100: #ebefed;
    --gray-200: #e1e6e3;
    --gray-300: #cdd5d0;
    --gray-400: #9ba69f;
    --gray-500: #6b7671;
    --gray-600: #4d5853;
    --gray-700: #36403b;
    --gray-800: #222a26;
    --gray-900: #141916;

    /* Semantic roles */
    --color-primary: var(--green-900);
    --color-primary-hover: var(--green-700);
    --color-primary-active: var(--green-950);
    --color-primary-soft: var(--green-50);
    --color-primary-soft-strong: var(--green-100);
    --color-accent: var(--gold-500);
    --color-accent-hover: var(--gold-400);
    --color-accent-text: var(--gold-700);
    --color-accent-soft: var(--gold-50);

    --color-success: #15803d;
    --color-success-soft: #e8f6ed;
    --color-danger: #c0392b;
    --color-danger-hover: #a52f23;
    --color-danger-soft: #fdecea;
    --color-warning: #a16207;
    --color-warning-soft: #fdf4dc;
    --color-info: #1d5fd1;
    --color-info-soft: #e9f0fd;

    --color-bg: var(--gray-50);
    --color-surface: var(--gray-0);
    --color-surface-muted: var(--gray-25);
    --color-border: var(--gray-200);
    --color-border-strong: var(--gray-300);
    --color-text: var(--gray-900);
    --color-text-secondary: var(--gray-600);
    --color-text-tertiary: var(--gray-500);
    --color-text-disabled: var(--gray-400);
    --color-focus: #2f7d5f;
    --focus-ring: 0 0 0 3px rgba(27, 115, 86, .28);
    --focus-ring-danger: 0 0 0 3px rgba(192, 57, 43, .22);

    /* Typography */
    --font-sans: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    --font-display: var(--font-sans);
    --font-mono: Consolas, 'Cascadia Mono', ui-monospace, Menlo, monospace;
    --text-2xs: .75rem;    /* 12px */
    --text-xs: .8125rem;   /* 13px */
    --text-sm: .875rem;    /* 14px */
    --text-base: .9375rem; /* 15px */
    --text-md: 1rem;       /* 16px */
    --text-input: 1rem;    /* 16px (also prevents iOS zoom on focus) */
    --text-lg: 1.125rem;   /* 18px */
    --text-xl: 1.375rem;   /* 22px */
    --text-2xl: 1.625rem;  /* 26px */
    --text-3xl: 2rem;      /* 32px */
    --weight-regular: 400;
    --weight-medium: 500;
    --weight-semibold: 600;
    --weight-bold: 700;
    --leading-tight: 1.25;
    --leading-normal: 1.5;

    /* Spacing (4px scale) */
    --space-1: .25rem;
    --space-2: .5rem;
    --space-3: .75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Radius */
    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-pill: 999px;

    /* Elevation */
    --shadow-xs: 0 1px 2px rgba(16, 24, 20, .05);
    --shadow-sm: 0 1px 3px rgba(16, 24, 20, .07), 0 1px 2px rgba(16, 24, 20, .04);
    --shadow-md: 0 6px 16px -4px rgba(16, 24, 20, .10), 0 2px 4px -2px rgba(16, 24, 20, .05);
    --shadow-lg: 0 16px 40px -8px rgba(16, 24, 20, .18), 0 4px 10px -4px rgba(16, 24, 20, .08);
    --shadow-up: 0 -6px 20px -6px rgba(16, 24, 20, .12);

    /* Icons */
    --icon-xs: 13px;
    --icon-sm: 15px;
    --icon-md: 17px;
    --icon-lg: 21px;
    --icon-box-sm: 38px;
    --icon-box-md: 46px;

    /* Controls: touch-sized by default (44px), compact on pointer screens */
    --control-h-sm: 40px;
    --control-h-md: 48px;
    --control-h-lg: 52px;

    /* Layout */
    --sidebar-w: 276px;
    --sidebar-w-collapsed: 76px;
    --topbar-h: 62px;
    --bottom-nav-h: 72px;
    /* The work area should use the available desktop space without turning
       reading-heavy screens into a single very long line. */
    --content-max: 1560px;
    --content-narrow: 1040px;
    --gutter: var(--space-4);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);

    /* Motion */
    --ease: cubic-bezier(.2, .8, .2, 1);
    --dur-fast: 120ms;
    --dur: 200ms;

    /* Layers */
    --z-sticky: 5;
    --z-topbar: 1030;
    --z-bottom-nav: 1035;
    --z-sidebar: 1045;
    --z-flyout: 1070;
    --z-toast: 1090;
    --z-progress: 2000;
}

@media (min-width: 768px) {
    :root {
        --text-input: var(--text-base);
        --control-h-sm: 36px;
        --control-h-md: 42px;
        --control-h-lg: 48px;
        --gutter: var(--space-6);
    }
}
@media (min-width: 992px) {
    :root { --topbar-h: 68px; --bottom-nav-h: 0px; }
}
@media (min-width: 1200px) {
    :root {
        --content-max: 1720px;
        --gutter: clamp(var(--space-8), 3vw, 4.5rem);
    }
}
@media (min-width: 1600px) {
    :root { --content-max: 1840px; --content-narrow: 1180px; }
}

/* 2. Bootstrap bridge ====================================================== */
:root {
    --bs-body-font-family: var(--font-sans);
    --bs-body-font-size: var(--text-base);
    --bs-body-color: var(--color-text);
    --bs-body-bg: var(--color-bg);
    --bs-border-color: var(--color-border);
    --bs-secondary-color: var(--color-text-secondary);
    --bs-primary-rgb: 11, 61, 46;
    --bs-link-color: var(--color-primary);
    --bs-link-color-rgb: 11, 61, 46;
    --bs-link-hover-color: var(--color-primary-hover);
    --bs-border-radius: var(--radius-md);
    --bs-focus-ring-color: rgba(27, 115, 86, .28);
}

/* 3. Base ================================================================== */
*, *::before, *::after { box-sizing: border-box; }

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

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--text-base);
    line-height: var(--leading-normal);
    color: var(--color-text);
    background: var(--color-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-display);
    color: var(--color-text);
    letter-spacing: -.01em;
    line-height: var(--leading-tight);
    margin: 0;
}

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

code, .cca-code {
    font-family: var(--font-mono);
    font-size: .92em;
    color: var(--gray-700);
    background: var(--gray-100);
    padding: .1em .4em;
    border-radius: var(--radius-xs);
}

:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important; width: 1px !important; height: 1px !important;
    overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important;
}

.cca-skip-link {
    position: fixed; top: var(--space-2); left: var(--space-2); z-index: 3000;
    background: var(--color-surface); color: var(--color-primary);
    padding: var(--space-2) var(--space-4); border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg); font-weight: var(--weight-semibold);
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* 4. App shell ============================================================= */

/* 4.1 Brand */
.cca-brand-mark {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: var(--radius-md);
    background: var(--gold-500);
    color: var(--green-900);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--icon-lg);
    box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .12);
}
.cca-brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; white-space: nowrap; }
.cca-brand-text strong { font-size: var(--text-lg); font-weight: 800; letter-spacing: .02em; }
.cca-brand-text small { font-size: var(--text-xs); color: rgba(255, 255, 255, .6); font-weight: var(--weight-medium); overflow: hidden; text-overflow: ellipsis; }

/* 4.2 Sidebar — base: off-canvas drawer opened from the bottom nav "Menu" */
.cca-sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: var(--z-sidebar);
    width: min(304px, 86vw);
    display: flex;
    flex-direction: column;
    padding-top: var(--safe-top);
    padding-bottom: var(--safe-bottom);
    background: var(--green-900);
    background-image: linear-gradient(180deg, var(--green-900) 0%, var(--green-950) 100%);
    color: rgba(255, 255, 255, .78);
    transform: translateX(-100%);
    visibility: hidden;
    transition: width var(--dur) var(--ease), transform var(--dur) var(--ease), visibility 0s linear var(--dur);
}
html.sidebar-open .cca-sidebar { transform: none; visibility: visible; box-shadow: var(--shadow-lg); transition: transform var(--dur) var(--ease), visibility 0s; }
html.sidebar-open { overflow: hidden; }

.cca-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: calc(var(--z-sidebar) - 1);
    background: rgba(8, 20, 15, .5);
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--dur) ease;
}
html.sidebar-open .cca-sidebar-backdrop { opacity: 1; pointer-events: auto; }

.cca-sidebar-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: var(--topbar-h);
    padding: 0 var(--space-2) 0 var(--space-4);
    flex-shrink: 0;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
    color: #fff;
    overflow: hidden;
}
.cca-sidebar-brand a:hover { color: #fff; }
.btn.cca-sidebar-close { margin-left: auto; --bs-btn-color: rgba(255, 255, 255, .8); --bs-btn-hover-color: #fff; --bs-btn-hover-bg: rgba(255, 255, 255, .1); --bs-btn-active-bg: rgba(255, 255, 255, .16); --bs-btn-active-color: #fff; }

.cca-sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    padding: var(--space-3) var(--space-3) var(--space-4);
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .15) transparent;
}

.cca-nav-group + .cca-nav-group { margin-top: var(--space-4); }
.cca-nav-group-label {
    display: block;
    padding: 0 var(--space-3) var(--space-2);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255, 255, 255, .45);
    white-space: nowrap;
}
.cca-nav-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }

.cca-nav-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    width: 100%;
    min-height: 50px;
    padding: 0 var(--space-3);
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: rgba(255, 255, 255, .78);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cca-nav-link:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.cca-nav-link:focus-visible { outline: 2px solid var(--gold-400); outline-offset: -2px; }
.cca-nav-icon { width: 24px; flex-shrink: 0; text-align: center; font-size: var(--icon-lg); opacity: .9; }
.cca-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.cca-nav-chevron { font-size: 12px; opacity: .55; transition: transform var(--dur) var(--ease); }
.cca-nav-link[aria-expanded="true"] .cca-nav-chevron { transform: rotate(90deg); }

.cca-nav-item.is-current > .cca-nav-link { color: #fff; }
.cca-nav-item.is-current > .cca-nav-link .cca-nav-icon { color: var(--gold-400); opacity: 1; }
.cca-nav-link.is-active,
.cca-nav-item.is-current:not(.has-children) > .cca-nav-link {
    background: rgba(255, 255, 255, .11);
    color: #fff;
    font-weight: var(--weight-semibold);
}
.cca-nav-link.is-active::before,
.cca-nav-item.is-current:not(.has-children) > .cca-nav-link::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 10px;
    bottom: 10px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--gold-500);
}

.cca-nav-sub {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1px;
    margin: 2px 0 var(--space-2) 23px;
    padding: 0 0 0 var(--space-2);
    border-left: 1px solid rgba(255, 255, 255, .12);
    animation: cca-nav-open var(--dur) var(--ease);
}
.cca-nav-sub[hidden] { display: none; }
@keyframes cca-nav-open { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.cca-nav-sublink {
    position: relative;
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-sm);
    color: rgba(255, 255, 255, .66);
    font-size: var(--text-md);
    font-weight: var(--weight-medium);
    white-space: nowrap;
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cca-nav-sublink:hover { color: #fff; background: rgba(255, 255, 255, .06); }
.cca-nav-sublink:focus-visible { outline: 2px solid var(--gold-400); outline-offset: -2px; }
.cca-nav-sublink.is-active { color: #fff; background: rgba(255, 255, 255, .11); font-weight: var(--weight-semibold); }
.cca-nav-sublink.is-active::before {
    content: '';
    position: absolute;
    left: calc(-1 * var(--space-2) - 1px);
    top: 8px;
    bottom: 8px;
    width: 2px;
    border-radius: 2px;
    background: var(--gold-500);
}

.cca-sidebar-footer { display: none; flex-shrink: 0; padding: var(--space-3); border-top: 1px solid rgba(255, 255, 255, .06); }
.cca-sidebar-toggle { color: rgba(255, 255, 255, .6); font-size: var(--text-sm); }
.cca-sidebar-toggle .cca-nav-icon { transition: transform var(--dur) var(--ease); }

/* Flyout (collapsed rail, desktop only) */
.cca-flyout { display: none; }

/* 4.3 Topbar — base: green compact header */
.cca-app {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
    transition: padding-left var(--dur) var(--ease);
}

.cca-topbar {
    position: sticky;
    top: 0;
    z-index: var(--z-topbar);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    height: calc(var(--topbar-h) + var(--safe-top));
    padding: var(--safe-top) var(--space-2) 0 var(--space-3);
    background: var(--green-900);
    color: #fff;
    box-shadow: 0 1px 0 rgba(0, 0, 0, .12), 0 4px 16px -8px rgba(6, 39, 29, .5);
}
.cca-topbar :focus-visible { outline-color: var(--gold-400); }

.cca-topbar-compact { flex: 1; min-width: 0; display: flex; align-items: center; }
.cca-topbar-brand { display: flex; align-items: center; gap: var(--space-3); min-width: 0; color: #fff; }
.cca-topbar-brand:hover { color: #fff; }
.cca-topbar-brand .cca-brand-mark { width: 38px; height: 38px; font-size: 20px; }
.cca-topbar-back {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 44px;
    min-width: 0;
    padding: 0 var(--space-3) 0 var(--space-2);
    margin-left: calc(-1 * var(--space-2));
    border-radius: var(--radius-md);
    color: #fff;
    font-size: var(--text-md);
    font-weight: var(--weight-semibold);
}
.cca-topbar-back span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-topbar-back:hover, .cca-topbar-back:active { color: #fff; background: rgba(255, 255, 255, .1); }
.cca-topbar-back i { font-size: var(--icon-lg); }

.cca-topbar-context { display: none; flex: 1; min-width: 0; }
.cca-topbar-actions { display: flex; align-items: center; gap: var(--space-2); flex-shrink: 0; }
.cca-topbar-divider { display: none; width: 1px; height: 24px; background: var(--color-border); margin: 0 var(--space-1); }

.cca-breadcrumb { list-style: none; display: flex; align-items: center; flex-wrap: nowrap; gap: var(--space-2); margin: 0; padding: 0; font-size: var(--text-sm); min-width: 0; }
.cca-breadcrumb li { display: inline-flex; align-items: center; gap: var(--space-2); color: var(--color-text-tertiary); white-space: nowrap; min-width: 0; }
.cca-breadcrumb li + li::before { content: '/'; color: var(--color-border-strong); }
.cca-breadcrumb a { color: var(--color-text-secondary); font-weight: var(--weight-medium); border-radius: var(--radius-xs); }
.cca-breadcrumb a:hover { color: var(--color-text); }
.cca-breadcrumb [aria-current="page"] { color: var(--color-text); font-weight: var(--weight-semibold); overflow: hidden; text-overflow: ellipsis; }
.cca-breadcrumb .fa-house { font-size: var(--icon-sm); }

/* Language menu: CSS flags avoid the platform-dependent emoji rendering in <select>. */
.cca-language-picker { position: relative; flex: 0 0 auto; color: #fff; }
.cca-language-picker summary { display: flex; align-items: center; justify-content: center; gap: 5px; width: 54px; height: 38px; border: 1px solid rgba(255, 255, 255, .28); border-radius: var(--radius-md); background: rgba(255, 255, 255, .12); cursor: pointer; list-style: none; }
.cca-language-picker summary::-webkit-details-marker { display: none; }
.cca-language-picker summary i { font-size: 10px; }
.cca-language-picker[open] summary { background: rgba(255, 255, 255, .22); }
.cca-language-picker:focus-within summary { outline: 3px solid var(--gold-400); outline-offset: 2px; }
.cca-language-menu { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; width: 132px; padding: 4px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-lg); }
.cca-language-menu a { display: flex; align-items: center; gap: var(--space-2); min-height: 36px; padding: 0 var(--space-2); border-radius: var(--radius-sm); color: var(--color-text); font-size: var(--text-sm); font-weight: var(--weight-medium); }
.cca-language-menu a:hover, .cca-language-menu a.is-current { background: var(--green-50); color: var(--green-900); }
.cca-flag { position: relative; display: inline-block; flex: 0 0 24px; width: 24px; height: 16px; overflow: hidden; border: 1px solid rgba(0, 0, 0, .16); border-radius: 2px; box-shadow: 0 1px 1px rgba(0, 0, 0, .12); }
.cca-flag--pt { background: #1d7d4d; }
.cca-flag--pt::before { content: ''; position: absolute; top: 2px; right: 5px; width: 12px; height: 12px; background: #f7d348; transform: rotate(45deg); }
.cca-flag--pt::after { content: ''; position: absolute; top: 5px; right: 8px; width: 6px; height: 6px; border-radius: 50%; background: #20539a; }
.cca-flag--en { background: linear-gradient(transparent 44%, #c8102e 44% 56%, transparent 56%), linear-gradient(90deg, transparent 44%, #c8102e 44% 56%, transparent 56%), linear-gradient(transparent 39%, #fff 39% 61%, transparent 61%), linear-gradient(90deg, transparent 39%, #fff 39% 61%, transparent 61%), linear-gradient(33deg, transparent 45%, #c8102e 45% 55%, transparent 55%), linear-gradient(-33deg, transparent 45%, #c8102e 45% 55%, transparent 55%), linear-gradient(33deg, transparent 39%, #fff 39% 61%, transparent 61%), linear-gradient(-33deg, transparent 39%, #fff 39% 61%, transparent 61%), #012169; }
.cca-flag--fr { background: linear-gradient(90deg, #1f4e9d 0 33.33%, #fff 33.33% 66.66%, #e13b3f 66.66%); }
.cca-login-lang summary { background: var(--gray-100); border-color: var(--color-border); }
.cca-login-lang:focus-within summary { outline-color: var(--color-focus); }

/* User menu */
.cca-user-trigger {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    height: 48px;
    padding: 0 6px;
    border: 0;
    border-radius: var(--radius-pill);
    background: transparent;
    color: inherit;
    transition: background var(--dur-fast) ease;
}
.cca-user-trigger:hover, .cca-user-trigger[aria-expanded="true"] { background: rgba(255, 255, 255, .1); }
.cca-user-trigger .cca-user-meta, .cca-user-trigger .fa-chevron-down { display: none; }
.cca-user-trigger .cca-user-meta { flex-direction: column; align-items: flex-start; line-height: 1.2; text-align: left; }
.cca-user-trigger .cca-user-name { font-size: var(--text-base); font-weight: var(--weight-semibold); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-user-trigger .cca-user-role { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.cca-user-trigger .fa-chevron-down { font-size: 10px; color: var(--color-text-tertiary); }

.cca-avatar {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green-100);
    color: var(--green-800);
    font-size: var(--text-xs);
    font-weight: var(--weight-bold);
    letter-spacing: .02em;
}
.cca-avatar-lg { width: 68px; height: 68px; font-size: var(--text-xl); }
.cca-topbar .cca-user-trigger > .cca-avatar { background: var(--gold-500); color: var(--green-950); }

.cca-dropdown-header-user { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3); }
.cca-dropdown-header-user .cca-user-name { font-weight: var(--weight-semibold); font-size: var(--text-sm); }
.cca-dropdown-header-user .cca-user-email { font-size: var(--text-xs); color: var(--color-text-tertiary); overflow: hidden; text-overflow: ellipsis; max-width: 190px; }

/* 4.4 Bottom navigation (base) */
.cca-bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: var(--z-bottom-nav);
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    height: calc(var(--bottom-nav-h) + var(--safe-bottom));
    padding: 0 var(--space-1) var(--safe-bottom);
    background: rgba(255, 255, 255, .96);
    backdrop-filter: saturate(180%) blur(12px);
    -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid var(--color-border);
    box-shadow: var(--shadow-up);
    transition: transform var(--dur) var(--ease);
}
.cca-bottom-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 0;
    padding: 0 2px;
    border: 0;
    background: none;
    color: var(--gray-500);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1.1;
    transition: color var(--dur-fast) ease;
}
.cca-bottom-nav-item > span:last-child { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-bottom-nav-item > i { font-size: 23px; transition: transform var(--dur-fast) ease; }
.cca-bottom-nav-item:hover { color: var(--gray-700); }
.cca-bottom-nav-item:active > i { transform: scale(.92); }
.cca-bottom-nav-item.is-active { color: var(--green-900); }
.cca-bottom-nav-item.is-active > i { transform: translateY(-1px); }
.cca-bottom-nav-item.is-active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 36px;
    height: 4px;
    margin-left: -18px;
    border-radius: 0 0 4px 4px;
    background: var(--gold-500);
}
.cca-bottom-nav-item:focus-visible { outline-offset: -4px; border-radius: var(--radius-md); }
/* Center "Register" button (raised) */
.cca-bottom-nav-register { color: var(--green-900); }
.cca-bottom-nav-register.is-active::before { display: none; }
.cca-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-top: -26px;
    border-radius: 18px;
    background: var(--green-900);
    color: var(--gold-400);
    font-size: 24px;
    box-shadow: 0 0 0 4px var(--color-surface), 0 8px 18px -6px rgba(6, 39, 29, .55);
    transition: transform var(--dur-fast) ease, background var(--dur-fast) ease;
}
.cca-bottom-nav-register:active .cca-fab { transform: scale(.92); }
.cca-bottom-nav-register[aria-expanded="true"] .cca-fab { background: var(--green-700); }
.cca-bottom-nav-register[aria-expanded="true"] .cca-fab i { transform: rotate(45deg); }
.cca-fab i { transition: transform var(--dur) var(--ease); }
/* Hide the bar while the on-screen keyboard is open (focused text field) */
html.keyboard-open .cca-bottom-nav { transform: translateY(110%); }
html.keyboard-open .cca-app { padding-bottom: 0; }

/* 4.5 Bottom sheet (offcanvas-bottom) */
.cca-sheet.offcanvas-bottom {
    height: auto;
    max-height: 85vh;
    border: 0;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding-bottom: calc(var(--space-3) + var(--safe-bottom));
    box-shadow: var(--shadow-lg);
}
.cca-sheet-handle { display: block; width: 40px; height: 4px; margin: var(--space-2) auto 0; border-radius: 4px; background: var(--gray-300); }
.cca-sheet-header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) var(--space-3) var(--space-2) var(--space-5); }
.cca-sheet-title { font-size: var(--text-lg); font-weight: 700; }
.cca-sheet-desc { margin: 2px 0 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.cca-sheet-list { padding: 0 var(--space-3); }
.cca-sheet-list .cca-link-item { min-height: 64px; }
.cca-sheet-list .cca-link-item[aria-current="page"] { background: var(--color-primary-soft); }
.offcanvas-backdrop.show { opacity: .45; }

/* 4.6 Content container */
.cca-content { flex: 1; width: 100%; }
.cca-page {
    width: 100%;
    max-width: calc(var(--content-max) + var(--gutter) * 2);
    margin: 0 auto;
    padding: var(--space-5) var(--gutter) var(--space-6);
}
.cca-page--narrow { max-width: calc(var(--content-narrow) + var(--gutter) * 2); }
.cca-page--xs { max-width: calc(560px + var(--gutter) * 2); }
.cca-stack { display: flex; flex-direction: column; gap: var(--space-5); }
.cca-stack-sm { display: flex; flex-direction: column; gap: var(--space-3); }

@media (min-width: 768px) {
    .cca-page { padding: var(--space-8) var(--gutter) var(--space-12); }
    .cca-stack { gap: var(--space-6); }
    .cca-stack-sm { gap: var(--space-4); }
    .cca-topbar { padding-left: var(--gutter); padding-right: var(--space-4); }
}

/* Data entry is the primary workflow.  On a wide screen, registration pages
   become a comfortable work surface instead of a small card floating in the
   middle, while profile and password pages retain their focused reading width. */
@media (min-width: 1200px) {
    body.is-form-page .cca-page--narrow {
        max-width: calc(1280px + var(--gutter) * 2);
    }
}

/* 4.7 Desktop shell (lg): persistent sidebar, white topbar, no bottom nav */
@media (min-width: 992px) {
    .cca-sidebar { width: var(--sidebar-w); transform: none; visibility: visible; padding: 0; transition: width var(--dur) var(--ease); }
    .cca-sidebar-backdrop, .btn.cca-sidebar-close, .cca-nav-account, .cca-bottom-nav, .cca-sheet { display: none !important; }
    .cca-sidebar-footer { display: block; }
    .cca-app { padding-left: var(--sidebar-w); padding-bottom: 0; }
    html.keyboard-open .cca-app { padding-bottom: 0; }

    .cca-nav-link { min-height: 44px; font-size: var(--text-md); }
    .cca-nav-sublink { min-height: 38px; font-size: var(--text-base); }
    .cca-nav-link.is-active::before,
    .cca-nav-item.is-current:not(.has-children) > .cca-nav-link::before { top: 10px; bottom: 10px; }
    .cca-nav-sublink.is-active::before { top: 9px; bottom: 9px; }

    .cca-topbar {
        gap: var(--space-3);
        height: var(--topbar-h);
        padding: 0 var(--gutter);
        background: rgba(255, 255, 255, .88);
        backdrop-filter: saturate(180%) blur(8px);
        -webkit-backdrop-filter: saturate(180%) blur(8px);
        color: var(--color-text);
        border-bottom: 1px solid var(--color-border);
        box-shadow: none;
    }
    .cca-topbar :focus-visible { outline-color: var(--color-focus); }
    .cca-topbar-compact { display: none; }
    .cca-topbar-context { display: block; }
    .cca-topbar-divider { display: block; }
    .cca-topbar .cca-language-picker summary { height: 36px; background: var(--gray-100); border-color: var(--color-border); }
    .cca-topbar .cca-language-picker:focus-within summary { outline-color: var(--color-focus); }
    .cca-user-trigger { height: 48px; padding: 0 var(--space-3) 0 4px; }
    .cca-user-trigger:hover, .cca-user-trigger[aria-expanded="true"] { background: var(--gray-100); }
    .cca-user-trigger .cca-user-meta { display: flex; }
    .cca-user-trigger .fa-chevron-down { display: inline-block; }
    .cca-topbar .cca-user-trigger > .cca-avatar { background: var(--green-100); color: var(--green-800); }

    /* Flyout for the collapsed rail */
    .cca-flyout {
        display: block;
        position: fixed;
        z-index: var(--z-flyout);
        min-width: 210px;
        padding: var(--space-1);
        background: var(--gray-900);
        color: #fff;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-lg);
        opacity: 0;
        transform: translateX(-4px);
        pointer-events: none;
        transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
    }
    .cca-flyout.is-open { opacity: 1; transform: none; pointer-events: auto; }
    .cca-flyout-title { display: block; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); font-weight: var(--weight-semibold); white-space: nowrap; }
    .cca-flyout.has-links .cca-flyout-title { font-size: var(--text-2xs); text-transform: uppercase; letter-spacing: .06em; color: rgba(255, 255, 255, .5); padding-bottom: var(--space-1); }
    .cca-flyout-link { display: block; padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); color: rgba(255, 255, 255, .82); font-size: var(--text-sm); white-space: nowrap; }
    .cca-flyout-link:hover, .cca-flyout-link:focus-visible { background: rgba(255, 255, 255, .1); color: #fff; outline: none; }
    .cca-flyout-link.is-active { color: var(--gold-400); font-weight: var(--weight-semibold); }

    /* Collapsed rail */
    html.sidebar-collapsed .cca-sidebar { width: var(--sidebar-w-collapsed); }
    html.sidebar-collapsed .cca-app { padding-left: var(--sidebar-w-collapsed); }
    html.sidebar-collapsed .cca-sidebar-brand { padding: 0 18px; }
    html.sidebar-collapsed .cca-brand-text,
    html.sidebar-collapsed .cca-nav-label,
    html.sidebar-collapsed .cca-nav-chevron,
    html.sidebar-collapsed .cca-nav-sub { display: none; }
    html.sidebar-collapsed .cca-nav-group-label { height: 1px; padding: 0; margin: 0 var(--space-2) var(--space-3); background: rgba(255, 255, 255, .1); overflow: hidden; color: transparent; }
    html.sidebar-collapsed .cca-nav-link { justify-content: center; padding: 0; }
    html.sidebar-collapsed .cca-nav-item.is-current > .cca-nav-link { background: rgba(255, 255, 255, .11); }
    html.sidebar-collapsed .cca-nav-item.is-current > .cca-nav-link::before {
        content: ''; position: absolute; left: -12px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold-500);
    }
    html.sidebar-collapsed .cca-sidebar-toggle .cca-nav-icon { transform: rotate(180deg); }
}

/* No transitions on first paint (state restored from storage) */
html.no-transitions .cca-sidebar, html.no-transitions .cca-app { transition: none !important; }

/* 5. Components ============================================================ */

/* 5.1 Page header */
.cca-page-header {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: var(--space-3);
    margin-bottom: var(--space-4);
}
.cca-page-header.has-actions { grid-template-columns: minmax(0, 1fr) auto; }
.cca-page-heading { min-width: 0; }
.cca-page-eyebrow { display: block; font-size: var(--text-2xs); font-weight: var(--weight-semibold); color: var(--color-accent-text); text-transform: uppercase; letter-spacing: .08em; margin-bottom: 2px; }
.cca-page-title { font-size: var(--text-xl); font-weight: 700; overflow-wrap: anywhere; }
.cca-page-description { margin: 2px 0 0; color: var(--color-text-secondary); font-size: var(--text-sm); max-width: 64ch; }
.cca-page-actions { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
.cca-label-full { display: none; }

@media (min-width: 576px) {
    .cca-label-short { display: none; }
    .cca-label-full { display: inline; }
}
@media (min-width: 768px) {
    .cca-page-header, .cca-page-header.has-actions { display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap; gap: var(--space-4); margin-bottom: var(--space-6); }
    .cca-page-eyebrow { font-size: var(--text-xs); margin-bottom: var(--space-1); }
    .cca-page-title { font-size: var(--text-2xl); }
    .cca-page-description { margin-top: var(--space-1); font-size: var(--text-base); }
}

/* 5.2 Buttons */
.btn {
    --bs-btn-padding-x: 1.05rem;
    --bs-btn-padding-y: 0;
    --bs-btn-font-size: var(--text-base);
    --bs-btn-font-weight: var(--weight-semibold);
    --bs-btn-border-radius: var(--radius-md);
    --bs-btn-focus-box-shadow: var(--focus-ring);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    height: var(--control-h-md);
    line-height: 1;
    white-space: nowrap;
    touch-action: manipulation;
    transition: background-color var(--dur-fast) ease, border-color var(--dur-fast) ease, color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, transform 60ms ease;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn i { font-size: var(--icon-sm); }
.btn:focus-visible { outline: none; }
.btn-sm { --bs-btn-padding-x: .75rem; --bs-btn-font-size: var(--text-sm); --bs-btn-border-radius: var(--radius-sm); height: var(--control-h-sm); gap: 6px; }
.btn-lg { --bs-btn-padding-x: 1.125rem; --bs-btn-font-size: var(--text-md); height: var(--control-h-lg); }

.btn-primary {
    --bs-btn-bg: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--color-primary-hover);
    --bs-btn-hover-border-color: var(--color-primary-hover);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: var(--color-primary-active);
    --bs-btn-active-border-color: var(--color-primary-active);
    --bs-btn-disabled-bg: var(--color-primary);
    --bs-btn-disabled-border-color: var(--color-primary);
    box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.btn-secondary {
    --bs-btn-bg: var(--color-surface);
    --bs-btn-border-color: var(--color-border-strong);
    --bs-btn-color: var(--color-text);
    --bs-btn-hover-bg: var(--gray-50);
    --bs-btn-hover-border-color: var(--gray-400);
    --bs-btn-hover-color: var(--color-text);
    --bs-btn-active-bg: var(--gray-100);
    --bs-btn-active-border-color: var(--gray-400);
    --bs-btn-active-color: var(--color-text);
    --bs-btn-disabled-bg: var(--color-surface);
    --bs-btn-disabled-color: var(--color-text-disabled);
    --bs-btn-disabled-border-color: var(--color-border);
    box-shadow: var(--shadow-xs);
}
.btn-ghost {
    --bs-btn-bg: transparent;
    --bs-btn-border-color: transparent;
    --bs-btn-color: var(--color-text-secondary);
    --bs-btn-hover-bg: var(--gray-100);
    --bs-btn-hover-border-color: transparent;
    --bs-btn-hover-color: var(--color-text);
    --bs-btn-active-bg: var(--gray-200);
    --bs-btn-active-border-color: transparent;
    --bs-btn-active-color: var(--color-text);
}
.btn-accent {
    --bs-btn-bg: var(--gold-500);
    --bs-btn-border-color: var(--gold-500);
    --bs-btn-color: var(--green-950);
    --bs-btn-hover-bg: var(--gold-400);
    --bs-btn-hover-border-color: var(--gold-400);
    --bs-btn-hover-color: var(--green-950);
    --bs-btn-active-bg: var(--gold-600);
    --bs-btn-active-border-color: var(--gold-600);
    --bs-btn-active-color: var(--green-950);
}
.btn-danger {
    --bs-btn-bg: var(--color-danger);
    --bs-btn-border-color: var(--color-danger);
    --bs-btn-color: #fff;
    --bs-btn-hover-bg: var(--color-danger-hover);
    --bs-btn-hover-border-color: var(--color-danger-hover);
    --bs-btn-hover-color: #fff;
    --bs-btn-active-bg: #8f271d;
    --bs-btn-active-border-color: #8f271d;
    --bs-btn-focus-box-shadow: var(--focus-ring-danger);
}
.btn-danger-outline {
    --bs-btn-bg: var(--color-surface);
    --bs-btn-border-color: #efc4bf;
    --bs-btn-color: var(--color-danger);
    --bs-btn-hover-bg: var(--color-danger-soft);
    --bs-btn-hover-border-color: #e3a39b;
    --bs-btn-hover-color: var(--color-danger-hover);
    --bs-btn-active-bg: #fad9d5;
    --bs-btn-active-border-color: #e3a39b;
    --bs-btn-active-color: var(--color-danger-hover);
    --bs-btn-focus-box-shadow: var(--focus-ring-danger);
}
.btn-icon { width: var(--control-h-md); padding: 0; }
.btn-icon.btn-sm { width: var(--control-h-sm); }

.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; pointer-events: auto; }

.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 16px;
    height: 16px;
    margin: -8px 0 0 -8px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    animation: cca-spin .6s linear infinite;
}
.btn-secondary.is-loading::after, .btn-ghost.is-loading::after, .btn-danger-outline.is-loading::after { border-color: rgba(11, 61, 46, .2); border-top-color: var(--color-primary); }
@keyframes cca-spin { to { transform: rotate(360deg); } }

/* 5.3 Cards */
.cca-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    min-width: 0;
}
.cca-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-4);
    border-bottom: 1px solid var(--color-border);
}
.cca-card-header.is-plain { border-bottom: 0; padding-bottom: 0; }
.cca-card-title { font-size: var(--text-lg); font-weight: 700; display: flex; align-items: center; gap: var(--space-2); }
.cca-card-title i { color: var(--color-text-tertiary); font-size: var(--icon-md); }
.cca-card-description { margin: 2px 0 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
.cca-card-body { padding: var(--space-4); }
.cca-card-link { font-size: var(--text-sm); font-weight: var(--weight-semibold); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; }
.cca-card-link i { font-size: 10px; transition: transform var(--dur-fast) ease; }
.cca-card--danger { border-color: #f1cdc8; }
.cca-card--danger .cca-card-header { border-bottom-color: #f6dcd8; }

@media (min-width: 768px) {
    .cca-card-header { gap: var(--space-4); padding: var(--space-4) var(--space-5); }
    .cca-card-body { padding: var(--space-5); }
}

/* 5.4 Forms */
.form-label {
    display: flex;
    align-items: baseline;
    gap: var(--space-1);
    margin-bottom: 6px;
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    color: var(--gray-700);
}
.cca-required { color: var(--color-danger); font-weight: var(--weight-bold); }
.cca-optional { font-weight: var(--weight-regular); color: var(--color-text-tertiary); font-size: var(--text-xs); }

.form-control, .form-select {
    min-height: var(--control-h-md);
    padding: .4375rem .75rem;
    font-size: var(--text-input);
    color: var(--color-text);
    background-color: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease, background-color var(--dur-fast) ease;
}
.form-select { padding-right: 2.25rem; background-position: right .75rem center; }
textarea.form-control { min-height: 96px; resize: vertical; }
input[type="date"].form-control { appearance: none; -webkit-appearance: none; }
.form-control::placeholder { color: var(--color-text-disabled); }
.form-control:focus, .form-select:focus { border-color: var(--green-600); box-shadow: var(--focus-ring); outline: none; }
.form-control:disabled, .form-select:disabled, .form-control[readonly] {
    background-color: var(--gray-50);
    color: var(--color-text-tertiary);
    border-color: var(--color-border);
    box-shadow: none;
    cursor: not-allowed;
}
.form-control-sm, .form-select-sm { min-height: var(--control-h-sm); padding-top: .25rem; padding-bottom: .25rem; border-radius: var(--radius-sm); }

.form-control.is-invalid, .form-select.is-invalid { border-color: var(--color-danger); background-image: none; padding-right: .75rem; }
.form-select.is-invalid { padding-right: 2.25rem; background-image: var(--bs-form-select-bg-img); }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: var(--focus-ring-danger); border-color: var(--color-danger); }
.invalid-feedback { font-size: var(--text-xs); color: var(--color-danger); font-weight: var(--weight-medium); margin-top: 6px; align-items: center; gap: 6px; }
.is-invalid ~ .invalid-feedback, [data-field]:has(.is-invalid) .invalid-feedback { display: flex; }
.form-text { font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 6px; }

/* Searchable church picker: type a report code or church name. */
.cca-search-select { position: relative; }
.cca-search-select-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
.cca-search-select-input { padding-right: 2.5rem; background-image: var(--bs-form-select-bg-img); background-repeat: no-repeat; background-position: right .75rem center; background-size: 16px 12px; }
.cca-search-select-list { position: absolute; z-index: 40; top: calc(100% + 4px); right: 0; left: 0; max-height: min(320px, 45vh); overflow-y: auto; overscroll-behavior: contain; padding: var(--space-1); border: 1px solid var(--green-200); border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-lg); }
.cca-search-select-option { display: block; width: 100%; min-height: 42px; padding: var(--space-2) var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text); font: inherit; font-size: var(--text-sm); text-align: left; }
.cca-search-select-option:hover, .cca-search-select-option.is-active { background: var(--color-primary-soft); color: var(--green-900); }
.cca-search-select-option[aria-selected="true"] { font-weight: var(--weight-semibold); }
.cca-filter .cca-search-select { width: 100%; }
@media (min-width: 768px) { .cca-filter .cca-search-select { width: auto; min-width: 220px; max-width: 340px; } }
[data-field]:has(.is-invalid) .form-text { display: none; }

.form-check-input { width: 1.15em; height: 1.15em; border-color: var(--color-border-strong); margin-top: .15em; }
.form-check-input:checked { background-color: var(--color-primary); border-color: var(--color-primary); }
.form-check-input:focus { box-shadow: var(--focus-ring); border-color: var(--green-600); }
.form-switch .form-check-input { width: 2.6em; height: 1.45em; margin-top: 0; cursor: pointer; }
.form-switch .form-check-input:focus { --bs-form-switch-bg: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='-4 -4 8 8'%3e%3ccircle r='3' fill='%231b7356'/%3e%3c/svg%3e"); }
.form-check-label { font-size: var(--text-base); cursor: pointer; }

.cca-input-group { position: relative; display: flex; align-items: center; }
.cca-input-group > .form-control { flex: 1; }
.cca-input-group > .cca-input-icon { position: absolute; left: .8rem; color: var(--color-text-tertiary); font-size: var(--icon-sm); pointer-events: none; }
.cca-input-group > .cca-input-icon + .form-control { padding-left: 2.35rem; }
.cca-input-group > .cca-input-action { position: absolute; right: 4px; height: calc(var(--control-h-md) - 8px); width: calc(var(--control-h-md) - 8px); }
.cca-input-group > .form-control:has(+ .cca-input-action) { padding-right: 2.75rem; }

@media (hover: hover) {
    .form-control:hover:not(:disabled):not(:focus), .form-select:hover:not(:disabled):not(:focus) { border-color: var(--gray-400); }
}

/* Form layout */
.cca-form-section {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-3);
    padding: var(--space-4);
}
.cca-form-section + .cca-form-section { border-top: 1px solid var(--color-border); }
.cca-form-section-head h2 { font-size: var(--text-md); font-weight: 700; }
.cca-form-section-head p { margin: 2px 0 0; font-size: var(--text-sm); color: var(--color-text-secondary); }

.cca-form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: var(--space-4); }
.cca-form-grid > * { grid-column: span 12; min-width: 0; }
.cca-form-grid > .is-compact { grid-column: span 4; }
.cca-form-grid { column-gap: var(--space-3); }
@media (min-width: 768px) { .cca-form-grid { column-gap: var(--space-4); } }

/* Actions: sticky above the bottom nav on touch screens, so "Save" is always reachable */
.cca-form-actions {
    position: sticky;
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom));
    z-index: var(--z-sticky);
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
    background: rgba(250, 251, 250, .96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
    box-shadow: var(--shadow-up);
}
html.keyboard-open .cca-form-actions { bottom: 0; }
.cca-form-actions .btn { flex: 1; }
.cca-form-actions .btn-primary { flex: 1.6; }
.cca-form-actions .cca-form-actions-hint { display: none; }

@media (min-width: 576px) {
    .cca-form-grid > .span-3 { grid-column: span 3; }
    .cca-form-grid > .span-4 { grid-column: span 4; }
    .cca-form-grid > .span-6 { grid-column: span 6; }
    .cca-form-grid > .span-8 { grid-column: span 8; }
    .cca-form-grid > .span-9 { grid-column: span 9; }
}
@media (min-width: 768px) {
    .cca-form-section { gap: var(--space-4); padding: var(--space-5); }
    .cca-form-section-head h2 { font-size: var(--text-base); }
    .cca-form-actions { justify-content: flex-end; padding: var(--space-4) var(--space-5); background: var(--color-surface-muted); box-shadow: none; }
    .cca-form-actions .btn, .cca-form-actions .btn-primary { flex: 0 0 auto; }
    .cca-form-actions .cca-form-actions-hint { display: block; margin-right: auto; font-size: var(--text-xs); color: var(--color-text-tertiary); }
}
@media (min-width: 992px) {
    .cca-form-actions { position: static; }
}
@media (min-width: 1100px) {
    .cca-page--narrow .cca-form-section { grid-template-columns: 240px minmax(0, 1fr); gap: var(--space-8); padding: var(--space-6); }
}
@media (min-width: 1200px) {
    body.is-form-page .cca-page--narrow .cca-form-section {
        grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
        gap: clamp(var(--space-8), 4vw, var(--space-12));
        padding: clamp(var(--space-6), 2.5vw, var(--space-8));
    }

    /* A little more separation makes consecutive groups easier to scan when
       filling a long registration on a notebook or desktop. */
    body.is-form-page .cca-form-section-head { padding-top: var(--space-1); }
}

.cca-switch-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.cca-switch-row .form-check { margin: 0; padding-left: 0; display: flex; }
.cca-switch-row .form-check-input { margin-left: 0; float: none; }
.cca-switch-row-label { font-weight: var(--weight-semibold); font-size: var(--text-base); }
.cca-switch-row-hint { font-size: var(--text-sm); color: var(--color-text-secondary); margin-top: 2px; }

/* Church registration helpers */
.cca-image-picker { display: flex; align-items: center; gap: var(--space-3); }
.cca-image-preview {
    display: flex; align-items: center; justify-content: center; flex: 0 0 76px; width: 76px; height: 76px;
    overflow: hidden; border: 1px dashed var(--color-border-strong); border-radius: var(--radius-md);
    background: var(--color-surface-muted); color: var(--color-text-tertiary); font-size: 24px;
}
.cca-image-preview.has-image { border-style: solid; }
.cca-image-preview img { width: 100%; height: 100%; object-fit: cover; }
.cca-image-picker-content { display: flex; flex: 1; flex-direction: column; align-items: flex-start; min-width: 0; gap: var(--space-1); }
.cca-image-picker-content input[type="file"] { width: 100%; }
.cca-service-editor-list { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-3); }
.cca-service-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) minmax(110px, .6fr) auto; gap: var(--space-2); align-items: end; padding: var(--space-3); border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-muted); }
.cca-service-row label { display: grid; gap: 4px; color: var(--gray-700); font-size: var(--text-xs); font-weight: var(--weight-semibold); }
.cca-service-row .btn { min-width: var(--control-h-md); }
@media (max-width: 399.98px) {
    .cca-service-row { grid-template-columns: minmax(0, 1fr) 90px auto; }
    .cca-service-row label:first-child { grid-column: 1 / -1; }
    .cca-image-picker { align-items: flex-start; }
}

.cca-readout {
    display: flex;
    align-items: center;
    min-height: var(--control-h-md);
    padding: 0 .75rem;
    border-radius: var(--radius-md);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-weight: 700;
    font-size: var(--text-lg);
    font-variant-numeric: tabular-nums;
}

/* 5.5 Alerts (inline) */
.cca-alert {
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    border: 1px solid transparent;
    font-size: var(--text-sm);
}
.cca-alert i { font-size: var(--icon-md); margin-top: 1px; }
.cca-alert--danger { background: var(--color-danger-soft); border-color: #f5cdc7; color: #8f271d; }
.cca-alert--danger i { color: var(--color-danger); }
.cca-alert--success { background: var(--color-success-soft); border-color: #c5e7d1; color: #145c2f; }
.cca-alert--success i { color: var(--color-success); }
.cca-alert--info { background: var(--color-info-soft); border-color: #cddcf8; color: #1a4aa0; }
.cca-alert--warning { background: var(--color-warning-soft); border-color: #f1dfaa; color: #7a4a05; }

/* 5.6 Badges */
.cca-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 26px;
    padding: 0 .625rem;
    border-radius: var(--radius-pill);
    font-size: var(--text-xs);
    font-weight: var(--weight-semibold);
    line-height: 1;
    white-space: nowrap;
    background: var(--gray-100);
    color: var(--gray-700);
}
.cca-badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.cca-badge--success { background: var(--color-success-soft); color: var(--color-success); }
.cca-badge--danger { background: var(--color-danger-soft); color: var(--color-danger); }
.cca-badge--warning { background: var(--color-warning-soft); color: var(--color-warning); }
.cca-badge--info { background: var(--color-info-soft); color: var(--color-info); }
.cca-badge--primary { background: var(--color-primary-soft-strong); color: var(--green-800); }
.cca-badge--accent { background: var(--gold-100); color: var(--gold-700); }
.cca-badge--neutral { background: var(--gray-100); color: var(--gray-600); }
.cca-badge--outline { background: transparent; box-shadow: inset 0 0 0 1px var(--color-border-strong); color: var(--gray-600); }
.cca-badge--mono { font-family: var(--font-mono); font-weight: var(--weight-medium); letter-spacing: 0; }

.cca-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: var(--radius-pill);
    background: var(--green-900);
    color: #fff;
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
}

/* 5.7 Chips (removable) */
.cca-chip-list { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.cca-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-height: 36px;
    padding: 0 3px 0 var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--color-surface);
    border: 1px solid var(--color-border-strong);
    font-size: var(--text-sm);
    font-weight: var(--weight-medium);
    color: var(--color-text);
}
.cca-chip form { margin: 0; display: inline-flex; }
.cca-chip-remove {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 0;
    background: transparent;
    color: var(--color-text-tertiary);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cca-chip-remove:hover { background: var(--color-danger-soft); color: var(--color-danger); }
.cca-chip-remove:focus-visible { outline: 2px solid var(--color-danger); outline-offset: 0; }

@media (min-width: 768px) {
    .cca-chip { min-height: 30px; gap: 6px; padding-right: 4px; }
    .cca-chip-remove { width: 22px; height: 22px; font-size: 11px; }
}

/* 5.8 Checklist (multi-select with filter) */
.cca-checklist { border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.cca-checklist-filter { padding: var(--space-2); border-bottom: 1px solid var(--color-border); background: var(--color-surface-muted); }
.cca-checklist-items { max-height: 320px; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-1); }
.cca-checklist-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 44px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: var(--text-base);
    transition: background var(--dur-fast) ease;
}
.cca-checklist-item[hidden] { display: none; }
.cca-checklist-item:hover { background: var(--gray-50); }
.cca-checklist-item .form-check-input { margin: 0; flex-shrink: 0; }
.cca-checklist-item:has(:checked) { background: var(--color-primary-soft); }
.cca-checklist-item-text { flex: 1; min-width: 0; }
.cca-checklist-item-meta { color: var(--color-text-tertiary); font-size: var(--text-xs); text-align: right; }
.cca-checklist-empty { padding: var(--space-4); text-align: center; font-size: var(--text-sm); color: var(--color-text-tertiary); }
.cca-checklist-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); border-top: 1px solid var(--color-border); background: var(--color-surface-muted); font-size: var(--text-xs); color: var(--color-text-tertiary); }

@media (min-width: 768px) {
    .cca-checklist-items { max-height: 264px; }
    .cca-checklist-item { min-height: 0; font-size: var(--text-sm); }
}

.cca-subheading { font-size: var(--text-xs); font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: .06em; color: var(--color-text-tertiary); margin: 0 0 var(--space-2); }

/* 5.9 List toolbar: search + collapsible filter panel */
.cca-toolbar {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    border-bottom: 1px solid var(--color-border);
}
.cca-toolbar-main { display: flex; gap: var(--space-2); min-width: 0; }
.cca-toolbar-search { position: relative; flex: 1; min-width: 0; }
.cca-toolbar-search .cca-input-icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--color-text-tertiary); font-size: var(--icon-sm); pointer-events: none; }
.cca-toolbar-search .form-control { padding-left: 2.35rem; }
.cca-filters-toggle { flex-shrink: 0; }
.cca-filters-toggle.has-active { border-color: var(--green-200); background-color: var(--color-primary-soft); color: var(--green-800); }
.cca-filters-toggle[aria-expanded="true"] { background-color: var(--gray-100); }
.cca-filters-toggle-label { display: none; }

.cca-toolbar-panel { display: none; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); padding: var(--space-2) 0 var(--space-1); }
.cca-toolbar-panel.is-open { display: grid; animation: cca-nav-open var(--dur) var(--ease); }

.cca-filter { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.cca-filter-label { font-size: var(--text-xs); font-weight: var(--weight-semibold); color: var(--color-text-secondary); white-space: nowrap; }
.cca-filter .form-select { width: 100%; font-weight: var(--weight-medium); }
.cca-filter .form-select.has-value { border-color: var(--green-200); background-color: var(--color-primary-soft); color: var(--green-800); }
.cca-filter-date-inputs { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: var(--space-2); }
.cca-filter-date-inputs .btn { grid-column: 1 / -1; }
.cca-filter-date-sep { color: var(--color-text-tertiary); font-size: var(--text-sm); }
.cca-toolbar-clear { justify-self: start; }

@media (min-width: 400px) {
    .cca-filters-toggle-label { display: inline; }
}
@media (min-width: 576px) {
    .cca-toolbar-panel.is-open { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .cca-filter-date { grid-column: 1 / -1; }
    .cca-filter-date-inputs { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto; }
    .cca-filter-date-inputs .btn { grid-column: auto; }
    .cca-toolbar-clear { grid-column: 1 / -1; }
}
@media (min-width: 768px) {
    .cca-toolbar { flex-direction: row; flex-wrap: wrap; align-items: center; padding: var(--space-3) var(--space-4); }
    .cca-toolbar-main { flex: 1 1 280px; max-width: 400px; }
    .cca-filters-toggle { display: none; }
    .cca-toolbar-panel, .cca-toolbar-panel.is-open { display: contents; animation: none; }
    .cca-filter { flex-direction: row; align-items: center; gap: var(--space-2); }
    .cca-filter-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-tertiary); }
    .cca-filter .form-select { width: auto; min-width: 150px; max-width: 240px; }
    .cca-filter-sort { display: none; }
    .cca-filter-date-inputs { display: flex; }
    .cca-filter-date-inputs .form-control { width: 170px; }
    .cca-toolbar-clear { margin-left: auto; }
}

/* 5.10 Tables — base: rows become tappable cards; real table from md */
.cca-table-wrap { position: relative; }
.cca-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--text-base); font-variant-numeric: tabular-nums; }
.cca-table, .cca-table tbody { display: block; }
.cca-table thead { display: none; }
.cca-table tbody tr {
    position: relative;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-3) var(--space-4);
    padding: var(--space-4);
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--dur-fast) ease;
}
.cca-table tbody tr:last-child { border-bottom: 0; }
.cca-table tbody tr:active { background: var(--gray-50); }
.cca-table tbody td { display: block; min-width: 0; padding: 0; border: 0; color: var(--color-text); overflow-wrap: anywhere; }
.cca-table td.is-primary, .cca-table td.is-wide { grid-column: 1 / -1; }
.cca-table tr:has(> td.is-actions .btn) > td.is-primary { padding-right: 96px; }
.cca-table td.is-actions { position: absolute; top: var(--space-2); right: var(--space-2); z-index: 2; }
.cca-table td[data-label]::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 3px;
    font-size: var(--text-2xs);
    font-weight: var(--weight-semibold);
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--color-text-tertiary);
}
.cca-table .is-hide-sm { display: none; }
/* Whole card is tappable: the primary link stretches over the row */
.cca-table td.is-primary a.cca-cell-primary::after { content: ''; position: absolute; inset: 0; z-index: 1; }

.cca-table .cca-cell-primary { font-weight: var(--weight-semibold); color: var(--color-text); font-size: var(--text-md); }
.cca-table .cca-cell-secondary { font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 1px; }
.cca-table .cca-cell-muted { color: var(--color-text-secondary); }
.cca-table .cca-cell-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-table .cca-cell-empty { color: var(--color-text-disabled); }

.cca-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 -6px;
    padding: 4px 6px;
    border-radius: var(--radius-xs);
    color: inherit;
    text-transform: inherit;
    letter-spacing: inherit;
}
.cca-sort:hover { color: var(--color-text); background: var(--gray-100); }
.cca-sort i { font-size: 12px; opacity: .4; }
th[aria-sort="ascending"] .cca-sort, th[aria-sort="descending"] .cca-sort { color: var(--color-text); }
th[aria-sort="ascending"] .cca-sort i, th[aria-sort="descending"] .cca-sort i { opacity: 1; color: var(--color-primary); }

.cca-cell-with-avatar { display: flex; align-items: center; gap: var(--space-3); min-width: 0; }
.cca-cell-with-avatar-content { min-width: 0; }
.cca-church-thumb {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-surface-muted);
    color: var(--color-primary);
    font-size: var(--text-lg);
}
.cca-church-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cca-row-actions { display: inline-flex; align-items: center; justify-content: flex-end; gap: var(--space-1); }

@media (min-width: 768px) {
    .cca-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .cca-table { display: table; }
    .cca-table thead { display: table-header-group; }
    .cca-table tbody { display: table-row-group; }
    .cca-table tbody tr { display: table-row; padding: 0; border: 0; }
    .cca-table tbody tr:active { background: transparent; }
    .cca-table thead th {
        position: sticky;
        top: 0;
        z-index: 1;
        height: 46px;
        padding: 0 var(--space-4);
        background: var(--color-surface-muted);
        border-bottom: 1px solid var(--color-border);
        color: var(--color-text-tertiary);
        font-size: var(--text-xs);
        font-weight: var(--weight-semibold);
        text-transform: uppercase;
        letter-spacing: .05em;
        text-align: left;
        white-space: nowrap;
        vertical-align: middle;
    }
    .cca-table tbody td {
        display: table-cell;
        height: 66px;
        padding: var(--space-2) var(--space-4);
        border-bottom: 1px solid var(--gray-100);
        vertical-align: middle;
        overflow-wrap: normal;
    }
    .cca-table tbody tr:last-child td { border-bottom: 0; }
    .cca-table td[data-label]::before { content: none; }
    .cca-table td.is-primary a.cca-cell-primary::after { content: none; }
    .cca-table tr:has(> td.is-actions .btn) > td.is-primary { padding-right: var(--space-4); }
    .cca-table td.is-actions { position: static; }
    .cca-table th.is-num, .cca-table td.is-num { text-align: right; }
    .cca-table th.is-actions, .cca-table td.is-actions { text-align: right; width: 1%; white-space: nowrap; }
    .cca-table td.is-hide-sm, .cca-table th.is-hide-sm { display: table-cell; }
    .cca-table .cca-cell-primary { font-size: var(--text-base); }
    .cca-table .cca-cell-truncate { max-width: 280px; }
    .cca-table a.cca-cell-primary:hover { color: var(--color-primary); text-decoration: underline; text-underline-offset: 2px; }
}
@media (min-width: 768px) and (max-width: 1199.98px) {
    .cca-table td.is-hide-md, .cca-table th.is-hide-md { display: none; }
}
@media (hover: hover) and (min-width: 768px) {
    .cca-table tbody tr:hover { background: var(--gray-25); }
}

/* 5.11 List footer + pagination — base: compact pager */
.cca-list-footer {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-top: 1px solid var(--color-border);
    font-size: var(--text-sm);
    color: var(--color-text-secondary);
}
.cca-list-footer-info { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: var(--space-4); text-align: center; }
.cca-list-footer strong { color: var(--color-text); font-weight: var(--weight-semibold); }
.cca-hide-compact { display: none; }
.cca-page-size { display: none; align-items: center; gap: var(--space-2); margin: 0; white-space: nowrap; }
.cca-page-size .form-select { width: auto; min-width: 72px; }

.cca-pager-compact { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.cca-pager-compact-label { font-size: var(--text-base); }
.cca-pager { display: none; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; }
.cca-pager a, .cca-pager span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 var(--space-2);
    border-radius: var(--radius-sm);
    font-size: var(--text-base);
    font-weight: var(--weight-medium);
    color: var(--color-text-secondary);
    font-variant-numeric: tabular-nums;
}
.cca-pager a:hover { background: var(--gray-100); color: var(--color-text); }
.cca-pager [aria-current="page"] { background: var(--color-primary); color: #fff; font-weight: var(--weight-semibold); }
.cca-pager .is-disabled span { color: var(--color-text-disabled); }
.cca-pager i { font-size: 11px; }

@media (min-width: 768px) {
    .cca-list-footer { flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; }
    .cca-list-footer-info { justify-content: flex-start; text-align: left; }
    .cca-hide-compact { display: inline; }
    .cca-page-size { display: inline-flex; }
    .cca-pager-compact { display: none; }
    .cca-pager { display: flex; }
}

/* List loading state (SSR navigation) */
.cca-list { position: relative; }
.cca-list::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    height: 2px;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    background: linear-gradient(90deg, transparent, var(--gold-500), transparent);
    background-size: 50% 100%;
    background-repeat: no-repeat;
    opacity: 0;
    transition: opacity var(--dur) ease;
    pointer-events: none;
}
.cca-list.is-loading::after { opacity: 1; animation: cca-slide 1s linear infinite; }
.cca-list.is-loading .cca-table-wrap, .cca-list.is-loading .cca-empty { opacity: .55; transition: opacity var(--dur) ease; pointer-events: none; }
@keyframes cca-slide { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* 5.12 Empty state */
.cca-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: var(--space-2);
    padding: var(--space-10) var(--space-4);
}
.cca-empty-icon {
    width: 60px;
    height: 60px;
    margin-bottom: var(--space-2);
    border-radius: var(--radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    color: var(--color-text-tertiary);
    font-size: var(--icon-lg);
    box-shadow: inset 0 0 0 1px var(--color-border);
}
.cca-empty-title { font-size: var(--text-md); font-weight: 700; }
.cca-empty-text { margin: 0; max-width: 380px; font-size: var(--text-sm); color: var(--color-text-secondary); }
.cca-empty-actions { display: flex; flex-direction: column; align-self: stretch; gap: var(--space-2); margin-top: var(--space-3); }
.cca-empty--compact { padding: var(--space-8) var(--space-4); }
.cca-empty--compact .cca-empty-icon { width: 48px; height: 48px; font-size: var(--icon-lg); }

@media (min-width: 576px) {
    .cca-empty { padding: var(--space-12) var(--space-6); }
    .cca-empty-actions { flex-direction: row; align-self: center; flex-wrap: wrap; justify-content: center; }
}

.cca-status-page { display: flex; align-items: center; justify-content: center; min-height: calc(100dvh - var(--topbar-h) - var(--bottom-nav-h) - 80px); }
.cca-status-page .cca-card { max-width: 460px; width: 100%; }
.cca-status-page .cca-empty-icon { width: 56px; height: 56px; font-size: 22px; }
.cca-status-page .cca-empty-icon.is-danger { background: var(--color-danger-soft); color: var(--color-danger); box-shadow: none; }
.cca-status-page .cca-empty-icon.is-warning { background: var(--color-warning-soft); color: var(--color-warning); box-shadow: none; }

/* 5.13 Skeleton */
.cca-skeleton {
    display: block;
    height: 12px;
    border-radius: var(--radius-xs);
    background: linear-gradient(90deg, var(--gray-100) 25%, var(--gray-200) 37%, var(--gray-100) 63%);
    background-size: 400% 100%;
    animation: cca-shimmer 1.4s ease infinite;
}
@keyframes cca-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* 5.14 Dropdowns */
.dropdown-menu {
    --bs-dropdown-font-size: var(--text-base);
    --bs-dropdown-border-color: var(--color-border);
    --bs-dropdown-border-radius: var(--radius-lg);
    --bs-dropdown-box-shadow: var(--shadow-lg);
    --bs-dropdown-link-color: var(--color-text);
    --bs-dropdown-link-hover-bg: var(--gray-100);
    --bs-dropdown-link-hover-color: var(--color-text);
    --bs-dropdown-link-active-bg: var(--color-primary-soft);
    --bs-dropdown-link-active-color: var(--color-primary);
    --bs-dropdown-item-padding-x: var(--space-3);
    --bs-dropdown-item-padding-y: var(--space-3);
    --bs-dropdown-padding-y: var(--space-1);
    --bs-dropdown-divider-bg: var(--color-border);
    --bs-dropdown-divider-margin-y: var(--space-1);
    min-width: 220px;
    padding: var(--space-1);
    box-shadow: var(--shadow-lg);
    animation: cca-pop var(--dur-fast) var(--ease);
}
@keyframes cca-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
.dropdown-item { display: flex; align-items: center; gap: var(--space-3); border-radius: var(--radius-sm); font-weight: var(--weight-medium); }
.dropdown-item i { width: 16px; text-align: center; color: var(--color-text-tertiary); font-size: var(--icon-sm); }
.dropdown-item:hover i { color: var(--color-text-secondary); }
.dropdown-item.is-danger { color: var(--color-danger); }
.dropdown-item.is-danger i { color: var(--color-danger); }
.dropdown-item.is-danger:hover { background: var(--color-danger-soft); color: var(--color-danger-hover); }
.dropdown-menu form { margin: 0; }
.dropdown-menu button.dropdown-item { width: 100%; border: 0; background: none; text-align: left; font: inherit; font-weight: var(--weight-medium); }

@media (min-width: 768px) {
    .dropdown-menu { --bs-dropdown-font-size: var(--text-base); --bs-dropdown-item-padding-y: .625rem; min-width: 230px; }
}

/* 5.15 Modal — base: bottom sheet; centered dialog from sm */
.modal-content { border: 0; box-shadow: var(--shadow-lg); border-radius: var(--radius-xl) var(--radius-xl) 0 0; }
.modal-backdrop.show { opacity: .45; }
.modal-dialog { margin: 0; max-width: none !important; }
.modal-dialog-centered { align-items: flex-end; min-height: 100%; }
.modal.fade .modal-dialog { transform: translateY(24px); transition: transform var(--dur) var(--ease); }
.modal.show .modal-dialog { transform: none; }

.cca-dialog { padding: var(--space-5) var(--space-5) calc(var(--space-5) + var(--safe-bottom)); }
.cca-dialog-head { display: flex; gap: var(--space-4); align-items: flex-start; }
.cca-dialog-icon {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-danger-soft);
    color: var(--color-danger);
    font-size: var(--icon-md);
}
.cca-dialog-icon.is-neutral { background: var(--color-primary-soft); color: var(--color-primary); }
.cca-dialog-title { font-size: var(--text-lg); font-weight: 700; margin-top: 2px; }
.cca-dialog-text { margin: var(--space-2) 0 0; color: var(--color-text-secondary); font-size: var(--text-base); }
.cca-dialog-actions { display: flex; flex-direction: column-reverse; gap: var(--space-2); margin-top: var(--space-5); }
.cca-dialog-actions .btn { width: 100%; }

@media (min-width: 576px) {
    .modal-content { border-radius: var(--radius-xl); }
    .modal-dialog { margin: var(--space-6) auto; max-width: 440px !important; }
    .modal-dialog-centered { align-items: center; min-height: calc(100% - var(--space-12)); }
    .modal.fade .modal-dialog { transform: scale(.98); }
    .cca-dialog { padding: var(--space-6); }
    .cca-dialog-actions { flex-direction: row; justify-content: flex-end; margin-top: var(--space-6); }
    .cca-dialog-actions .btn { width: auto; }
}

/* 5.16 Tooltip (pointer devices only: no sticky tooltips after a tap) */
@media (hover: hover) {
    [data-tooltip] { position: relative; }
    [data-tooltip]::after {
        content: attr(data-tooltip);
        position: absolute;
        bottom: calc(100% + 6px);
        left: 50%;
        z-index: 1080;
        padding: 5px 8px;
        border-radius: var(--radius-sm);
        background: var(--gray-900);
        color: #fff;
        font-size: var(--text-xs);
        font-weight: var(--weight-medium);
        line-height: 1.3;
        white-space: nowrap;
        text-transform: none;
        letter-spacing: normal;
        box-shadow: var(--shadow-md);
        opacity: 0;
        transform: translate(-50%, 2px);
        pointer-events: none;
        transition: opacity var(--dur-fast) ease, transform var(--dur-fast) ease;
    }
    [data-tooltip]:hover::after, [data-tooltip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); transition-delay: 250ms; }
}

/* 5.17 Toasts — base: full width above the bottom nav */
.cca-toast-region {
    position: fixed;
    left: var(--space-3);
    right: var(--space-3);
    bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + var(--space-3));
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}
.cca-toast {
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-2) var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    font-size: var(--text-base);
    overflow: hidden;
    animation: cca-toast-in var(--dur) var(--ease);
    transition: opacity var(--dur) ease, transform var(--dur) ease;
}
.cca-toast::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--color-info); }
.cca-toast.is-leaving { opacity: 0; transform: translateY(6px); }
@keyframes cca-toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.cca-toast-icon { font-size: var(--icon-md); margin-top: 2px; color: var(--color-info); }
.cca-toast-message { flex: 1; color: var(--color-text); font-weight: var(--weight-medium); padding-top: 1px; }
.cca-toast-close { flex-shrink: 0; width: 32px; height: 32px; margin: -6px 0; border: 0; border-radius: var(--radius-sm); background: none; color: var(--color-text-tertiary); display: inline-flex; align-items: center; justify-content: center; }
.cca-toast-close:hover { background: var(--gray-100); color: var(--color-text); }
.cca-toast--success::before { background: var(--color-success); }
.cca-toast--success .cca-toast-icon { color: var(--color-success); }
.cca-toast--error::before { background: var(--color-danger); }
.cca-toast--error .cca-toast-icon { color: var(--color-danger); }
.cca-toast--warning::before { background: var(--gold-500); }
.cca-toast--warning .cca-toast-icon { color: var(--color-warning); }
body.is-form-page .cca-toast-region { bottom: calc(var(--bottom-nav-h) + var(--safe-bottom) + 76px); }

@media (min-width: 992px) {
    .cca-toast-region, body.is-form-page .cca-toast-region { left: auto; right: var(--space-5); bottom: var(--space-5); width: 380px; }
    .cca-toast { font-size: var(--text-sm); }
}

/* 5.18 Navigation progress bar */
.cca-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: var(--z-progress);
    height: 2px;
    width: 0;
    background: var(--gold-500);
    box-shadow: 0 0 6px rgba(212, 160, 23, .5);
    opacity: 0;
    transition: width .4s var(--ease), opacity .2s ease .1s;
}

/* 5.19 Stat tiles */
.cca-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-3); }
.cca-stats > :last-child:nth-child(odd) { grid-column: 1 / -1; }
.cca-stats:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-2); }
.cca-stats:has(> :nth-child(3):last-child) > :last-child { grid-column: auto; }
.cca-stats:has(> :nth-child(3):last-child) .cca-stat { padding: var(--space-3); }
.cca-stats:has(> :nth-child(3):last-child) .cca-stat-icon { display: none; }
.cca-stat {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: var(--space-3) var(--space-4);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xs);
    color: var(--color-text);
    min-width: 0;
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur-fast) ease;
}
a.cca-stat:active { background: var(--gray-50); }
.cca-stat-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.cca-stat-label { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-secondary); min-width: 0; }
.cca-stat-icon { width: 40px; height: 40px; flex-shrink: 0; border-radius: var(--radius-md); display: inline-flex; align-items: center; justify-content: center; background: var(--gray-100); color: var(--color-text-secondary); font-size: var(--icon-md); }
.cca-stat-value { font-size: var(--text-2xl); font-weight: 700; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cca-stat-meta { font-size: var(--text-xs); color: var(--color-text-tertiary); }
.cca-whatsapp-link { display: inline-flex; align-items: center; gap: .35rem; margin-top: .35rem; color: #087b48; font-size: var(--text-sm); font-weight: 600; text-decoration: none; }
.cca-whatsapp-link:hover { color: #075f39; text-decoration: underline; }
.cca-reset-password { display: inline-block; padding: .75rem 1rem; border: 1px solid var(--color-border); border-radius: var(--radius-md); font-size: var(--text-lg); user-select: all; overflow-wrap: anywhere; }

@media (min-width: 768px) {
    .cca-stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
    .cca-stats > :last-child:nth-child(odd) { grid-column: auto; }
    .cca-stats:has(> :nth-child(3):last-child) { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: var(--space-4); }
    .cca-stats:has(> :nth-child(3):last-child) .cca-stat { padding: var(--space-4) var(--space-5); }
    .cca-stats:has(> :nth-child(3):last-child) .cca-stat-icon { display: inline-flex; }
    .cca-stat { gap: var(--space-1); padding: var(--space-4) var(--space-5); }
    .cca-stat-label { font-size: var(--text-base); }
    .cca-stat-value { font-size: var(--text-3xl); }
    .cca-stat-meta { font-size: var(--text-sm); }
}
@media (hover: hover) {
    a.cca-stat:hover { border-color: var(--color-border-strong); box-shadow: var(--shadow-sm); color: var(--color-text); }
}

/* 5.20 Section heading */
.cca-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-2); }
.cca-section-title { font-size: var(--text-sm); font-weight: var(--weight-semibold); color: var(--color-text-secondary); text-transform: uppercase; letter-spacing: .06em; }
@media (min-width: 768px) {
    .cca-section-head { margin-bottom: var(--space-3); }
    .cca-section-title { font-size: var(--text-base); }
}

/* 5.20b Bible verse ticker */
.cca-verse {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 48px;
    padding: var(--space-1) var(--space-1) var(--space-1) var(--space-2);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, var(--green-50) 0%, #f7fbf9 60%, var(--gold-50) 100%);
    border: 1px solid var(--green-100);
    box-shadow: var(--shadow-xs);
    overflow: hidden;
}
.cca-verse-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--green-900);
    color: var(--gold-400);
    font-size: var(--icon-sm);
}
.cca-verse-viewport {
    position: relative;
    flex: 1;
    min-width: 0;
    height: 32px;
    overflow: hidden;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
    mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 12px), transparent 100%);
}
.cca-verse-track {
    position: absolute;
    top: 50%;
    left: 0;
    margin: 0;
    display: flex;
    align-items: baseline;
    gap: var(--space-3);
    white-space: nowrap;
    transform: translate3d(0, -50%, 0);
    will-change: transform;
    transition: opacity var(--dur) ease;
}
.cca-verse-text { font-size: var(--text-xs); font-style: italic; color: var(--green-900); }
.cca-verse-ref { font-size: var(--text-2xs); font-weight: var(--weight-semibold); color: var(--gold-700); }
.cca-verse-ref::before { content: '— '; }
.cca-verse-toggle {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--green-700);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: var(--icon-sm);
    transition: background var(--dur-fast) ease;
}
.cca-verse-toggle:hover { background: rgba(11, 61, 46, .08); }

/* No JS / reduced motion: wrap the verse instead of scrolling it */
.cca-verse:not(.is-animated) .cca-verse-viewport { height: auto; -webkit-mask-image: none; mask-image: none; }
.cca-verse:not(.is-animated) .cca-verse-track { position: static; transform: none; white-space: normal; display: block; }
.cca-verse:not(.is-animated) .cca-verse-ref { display: inline-block; margin-left: var(--space-2); }
.cca-verse:not(.is-animated) .cca-verse-toggle { display: none; }
.cca-verse-track.is-fading { opacity: 0; }

@media (min-width: 768px) {
    .cca-verse { min-height: 54px; padding: var(--space-2) var(--space-2) var(--space-2) var(--space-3); gap: var(--space-3); }
    .cca-verse-icon { width: 36px; height: 36px; }
    .cca-verse-viewport { height: 36px; }
    .cca-verse-text { font-size: var(--text-sm); }
    .cca-verse-ref { font-size: var(--text-xs); }
}

/* 5.21 Action tiles (quick actions) */
.cca-actions-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-3); }
.cca-action-tile {
    position: relative;
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 84px;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    box-shadow: var(--shadow-xs);
    color: var(--color-text);
    overflow: hidden;
    transition: border-color var(--dur-fast) ease, box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease), background var(--dur-fast) ease;
}
.cca-action-tile:active { background: var(--gray-50); }
.cca-action-tile-icon {
    width: var(--icon-box-md);
    height: var(--icon-box-md);
    flex-shrink: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary);
    color: var(--gold-400);
    font-size: var(--icon-lg);
}
.cca-action-tile-body { flex: 1; min-width: 0; }
.cca-action-tile-title { display: block; font-weight: 700; font-size: var(--text-lg); }
.cca-action-tile-desc { display: block; font-size: var(--text-sm); color: var(--color-text-secondary); margin-top: 1px; }
.cca-action-tile-arrow {
    width: 34px;
    height: 34px;
    flex-shrink: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--gray-100);
    color: var(--color-text-secondary);
    font-size: var(--icon-sm);
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease, transform var(--dur) var(--ease);
}
@media (min-width: 576px) {
    .cca-actions-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--space-4); }
    .cca-action-tile { gap: var(--space-4); padding: var(--space-4) var(--space-5); }
}
@media (hover: hover) {
    .cca-action-tile:hover { color: var(--color-text); border-color: var(--green-200); box-shadow: var(--shadow-md); transform: translateY(-1px); }
    .cca-action-tile:hover .cca-action-tile-arrow { background: var(--color-primary); color: #fff; transform: translateX(2px); }
}

/* 5.22 Link list */
.cca-link-list { list-style: none; margin: 0; padding: var(--space-1); }
.cca-link-item {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: 62px;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    color: var(--color-text);
    transition: background var(--dur-fast) ease;
}
a.cca-link-item:hover, a.cca-link-item:active { background: var(--gray-50); color: var(--color-text); }
.cca-link-item-icon {
    width: var(--icon-box-sm);
    height: var(--icon-box-sm);
    flex-shrink: 0;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--color-primary-soft);
    color: var(--green-700);
    font-size: var(--icon-md);
}
.cca-link-item-icon.is-neutral { background: var(--gray-100); color: var(--gray-600); }
.cca-link-item-body { flex: 1; min-width: 0; }
.cca-link-item-title { display: block; font-weight: var(--weight-semibold); font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-link-item-desc { display: block; font-size: var(--text-sm); color: var(--color-text-tertiary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cca-link-item > .fa-chevron-right { font-size: 11px; color: var(--color-text-disabled); transition: transform var(--dur-fast) ease, color var(--dur-fast) ease; }
a.cca-link-item:hover > .fa-chevron-right { color: var(--color-text-secondary); transform: translateX(2px); }
@media (min-width: 768px) {
    .cca-link-item { min-height: 0; }
}

/* 5.23 Activity timeline */
.cca-activity { list-style: none; margin: 0; padding: var(--space-2) var(--space-4) var(--space-4); }
.cca-activity-item { position: relative; display: flex; gap: var(--space-3); padding: var(--space-2) 0; }
.cca-activity-item:not(:last-child)::before { content: ''; position: absolute; left: 16px; top: 42px; bottom: -6px; width: 1px; background: var(--color-border); }
.cca-activity-item .cca-avatar { width: 34px; height: 34px; font-size: var(--text-2xs); }
.cca-activity-text { font-size: var(--text-base); color: var(--color-text-secondary); line-height: 1.45; padding-top: 4px; min-width: 0; }
.cca-activity-text strong { color: var(--color-text); font-weight: var(--weight-semibold); }
.cca-activity-time { display: block; font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 1px; }
@media (min-width: 768px) { .cca-activity { padding: var(--space-2) var(--space-5) var(--space-4); } }

/* 5.24 Description list — base: stacked */
.cca-dl { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; }
.cca-dl dt, .cca-dl dd { margin: 0; font-size: var(--text-base); }
.cca-dl dt { padding-top: var(--space-3); font-size: var(--text-xs); color: var(--color-text-secondary); font-weight: var(--weight-medium); }
.cca-dl dd { padding: 2px 0 var(--space-3); border-bottom: 1px solid var(--gray-100); color: var(--color-text); font-weight: var(--weight-medium); min-width: 0; overflow-wrap: anywhere; }
.cca-dl dd:last-of-type { border-bottom: 0; }
.cca-dl.is-inline { grid-template-columns: minmax(0, 1fr) auto; }
.cca-dl.is-inline dt, .cca-dl.is-inline dd { padding: var(--space-3) 0; border-bottom: 1px solid var(--gray-100); font-size: var(--text-base); }
.cca-dl.is-inline dt:last-of-type, .cca-dl.is-inline dd:last-of-type { border-bottom: 0; }
@media (min-width: 576px) {
    .cca-dl { grid-template-columns: minmax(120px, 180px) 1fr; }
    .cca-dl dt, .cca-dl dd { padding: var(--space-3) 0; border-bottom: 1px solid var(--gray-100); }
    .cca-dl dt { font-size: var(--text-base); }
    .cca-dl dt:last-of-type, .cca-dl dd:last-of-type { border-bottom: 0; }
}

/* 6. Pages ================================================================= */

/* 6.1 Home — a focused launchpad for the most frequent tasks */
.cca-home { max-width: calc(1320px + var(--gutter) * 2); }
.cca-home-heading { margin-bottom: var(--space-3); }
.cca-home-heading h2 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.cca-home-heading p { margin: 2px 0 0; color: var(--color-text-secondary); font-size: var(--text-sm); }
.cca-home-modules {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
}
.cca-home-module {
    display: flex;
    flex-direction: column;
    min-width: 0;
    overflow: hidden;
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
}
.cca-home-module-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    padding: var(--space-6) var(--space-5) var(--space-5);
    text-align: center;
}
.cca-home-module-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-3);
    border-radius: var(--radius-md);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: 23px;
}
.cca-home-module h3 { font-size: var(--text-lg); font-weight: var(--weight-bold); }
.cca-home-module p { margin: var(--space-2) 0 var(--space-4); color: var(--color-text-secondary); font-size: var(--text-sm); line-height: 1.45; }
.cca-home-module-label {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 0 var(--space-3);
    border-radius: var(--radius-pill);
    background: var(--color-primary-soft);
    color: var(--color-primary);
    font-size: var(--text-2xs);
    font-weight: var(--weight-bold);
    letter-spacing: .04em;
    text-transform: uppercase;
}
.cca-home-module-actions {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    border-top: 1px solid var(--color-border);
}
.cca-home-module-actions a {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    min-height: 76px;
    padding: var(--space-2);
    color: var(--color-primary);
    font-size: var(--text-sm);
    font-weight: var(--weight-semibold);
    text-align: center;
    transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.cca-home-module-actions a + a { border-left: 1px solid var(--color-border); }
.cca-home-module-actions a i { font-size: var(--icon-lg); }
.cca-home-module-actions a:hover, .cca-home-module-actions a:focus-visible { background: var(--color-primary-soft); color: var(--color-primary-active); }
.cca-home-module-actions a:focus-visible { outline-offset: -3px; }

@media (min-width: 576px) {
    .cca-home-modules { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
    .cca-home { padding-top: var(--space-8); }
    .cca-home-heading { margin-bottom: var(--space-4); }
    .cca-home-heading h2 { font-size: var(--text-xl); }
    .cca-home-modules { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
    .cca-home-module-main { min-height: 218px; padding: var(--space-8) var(--space-6) var(--space-6); }
    .cca-home-module-icon { width: 52px; height: 52px; font-size: 25px; }
    .cca-home-module-actions a { min-height: 84px; }
}

/* 6.1 Dashboard */
.cca-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; }
@media (min-width: 1200px) { .cca-dashboard-grid { grid-template-columns: minmax(0, 1fr) 390px; gap: var(--space-6); } }

.cca-record-type { display: inline-flex; align-items: center; justify-content: center; width: var(--icon-box-sm); height: var(--icon-box-sm); border-radius: var(--radius-md); flex-shrink: 0; font-size: var(--icon-md); }
.cca-record-type.is-hc { background: var(--gold-50); color: var(--gold-700); }
.cca-record-type.is-baptism { background: var(--color-info-soft); color: var(--color-info); }

/* 6.2 Profile */
.cca-profile-head { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3) var(--space-4); padding: var(--space-4); border-bottom: 1px solid var(--color-border); }
.cca-profile-head h2 { font-size: var(--text-lg); font-weight: 700; }
.cca-profile-head p { margin: 2px 0 0; color: var(--color-text-secondary); font-size: var(--text-sm); overflow-wrap: anywhere; }
.cca-security-row { display: flex; flex-direction: column; align-items: stretch; gap: var(--space-3); }
@media (min-width: 576px) {
    .cca-profile-head { padding: var(--space-5); }
    .cca-security-row { flex-direction: row; align-items: center; justify-content: space-between; }
}

/* 6.3 Login — base: single column form */
.cca-login-body { min-height: 100vh; margin: 0; background: var(--color-surface); }
.cca-login-split { display: flex; min-height: 100vh; min-height: 100dvh; }
.cca-login-map-pane { display: none; }
.cca-login-form-pane { flex: 1; position: relative; display: flex; justify-content: center; align-items: flex-start; padding: calc(72px + var(--safe-top)) var(--space-5) calc(var(--space-8) + var(--safe-bottom)); }
.cca-login-lang { position: absolute; top: calc(var(--space-4) + var(--safe-top)); right: var(--space-4); }
.cca-login-card { width: 100%; max-width: 420px; }
.cca-login-brand-mobile { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-8); }
.cca-login-brand-mobile .cca-brand-text strong { color: var(--color-text); }
.cca-login-brand-mobile .cca-brand-text small { color: var(--color-text-tertiary); }
.cca-login-heading { font-size: var(--text-2xl); font-weight: 700; }
.cca-login-tagline { color: var(--color-text-secondary); font-size: var(--text-base); margin: var(--space-1) 0 var(--space-6); }
.cca-login-form { display: flex; flex-direction: column; gap: var(--space-4); }
.cca-login-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--color-text-tertiary); font-size: var(--text-xs); }
.cca-login-divider::before, .cca-login-divider::after { content: ''; flex: 1; height: 1px; background: var(--color-border); }
.cca-login-form .form-control { min-height: var(--control-h-lg); }
.cca-login-form .cca-input-action { height: calc(var(--control-h-lg) - 8px); width: calc(var(--control-h-lg) - 8px); }
.cca-login-verse-mobile { margin: var(--space-8) 0 0; text-align: center; font-style: italic; font-size: var(--text-xs); color: var(--color-text-tertiary); }
.cca-login-footer { position: absolute; right: var(--space-5); bottom: calc(var(--space-4) + var(--safe-bottom)); left: var(--space-5); margin: 0; color: var(--color-text-tertiary); font-size: var(--text-xs); text-align: center; }

@media (min-width: 768px) {
    .cca-login-form-pane { align-items: center; padding: var(--space-10) var(--space-8); }
    .cca-login-footer { right: var(--space-8); bottom: var(--space-5); left: var(--space-8); }
}
@media (min-width: 992px) {
    .cca-login-map-pane {
        flex: 0 0 56%;
        max-width: 56%;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        overflow: hidden;
        padding: var(--space-12) var(--space-8);
        background: radial-gradient(circle at 25% 15%, var(--green-700), var(--green-900) 55%, var(--green-950));
    }
    .cca-login-brand-mobile, .cca-login-verse-mobile { display: none; }
    .cca-login-lang { top: var(--space-5); right: var(--space-5); }
}
.cca-map-glow {
    position: absolute;
    width: 60vw;
    height: 60vw;
    max-width: 720px;
    max-height: 720px;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: radial-gradient(circle, rgba(212, 160, 23, .22) 0%, rgba(212, 160, 23, 0) 70%);
    pointer-events: none;
}
.cca-map-content { position: relative; z-index: 1; width: 100%; max-width: 460px; text-align: center; color: #fff; }
.cca-map-content .cca-brand-mark { width: 56px; height: 56px; border-radius: var(--radius-lg); font-size: 26px; margin: 0 auto; box-shadow: 0 10px 30px rgba(212, 160, 23, .3); }
.cca-map-title { color: #fff; font-size: var(--text-2xl); font-weight: 800; margin: var(--space-4) 0 var(--space-1); }
.cca-map-subtitle { color: rgba(255, 255, 255, .72); font-size: var(--text-base); margin: 0 0 var(--space-6); }
.cca-africa-map { width: 100%; max-width: 320px; height: auto; filter: drop-shadow(0 16px 32px rgba(0, 0, 0, .35)); }
.cca-continent { stroke: rgba(255, 255, 255, .35); stroke-width: 1.5; }
.cca-map-pins circle { fill: #fff; stroke: var(--green-900); stroke-width: 2; animation: cca-pin-pulse 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.cca-map-pins circle:nth-child(2n) { animation-delay: .5s; }
.cca-map-pins circle:nth-child(3n) { animation-delay: 1s; }
@keyframes cca-pin-pulse { 0%, 100% { opacity: .55; transform: scale(1); } 50% { opacity: 1; transform: scale(1.25); } }
.cca-map-verse { margin: var(--space-6) auto 0; max-width: 380px; font-style: italic; font-size: var(--text-sm); color: rgba(255, 255, 255, .66); }

/* 7. Utilities ============================================================= */
.min-w-0 { min-width: 0; }
#content:focus { outline: none; }
.cca-muted { color: var(--color-text-secondary); }
.cca-nowrap { white-space: nowrap; }
.cca-grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-5); align-items: start; }
@media (min-width: 1100px) { .cca-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-6); } }
.cca-card-body.is-tight { padding-top: var(--space-1); padding-bottom: var(--space-1); }

/* Financial setup lists follow the card rhythm without borrowing checkbox UI. */
.cca-financial-lookup-list { border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.cca-financial-lookup-list > div { display: flex; align-items: center; gap: var(--space-2); min-height: 42px; padding: var(--space-2) var(--space-3); font-size: var(--text-sm); }
.cca-financial-lookup-list > div + div { border-top: 1px solid var(--color-border); }
.cca-financial-lookup-list i { color: var(--color-success); font-size: var(--text-xs); }
.cca-note { margin: 0; font-size: var(--text-sm); color: var(--color-text-secondary); }
