/* ==========================================================================
   Together — app styles
   Loaded after Bootstrap 5.3 on every page (see asset_url() in app/Common.php).

   1. Brand colors (change the colors here)
   2. Bootstrap overrides (buttons, links, success, focus)
   3. App layout: sidebar, top bar, tab bar, cards, lists, tables  (body.app-page)
   4. Login & password pages                                       (body.auth-page)
   5. Public pages: Gifts, QR sign-up, event RSVP                  (body.public-page)
   6. Page-specific styles
   ========================================================================== */


/* 1. Brand colors ---------------------------------------------------------- */
/* To change the app's color, edit these lines; everything below reads from them.
   The *-rgb values are the same colors as "r,g,b" (Bootstrap needs that form). */

:root {
    --brand-900: #0c2230;   /* darkest: sidebar, headers, login tint, phone status bar */
    --brand-800: #17405a;   /* sidebar hover / active */
    --brand-700: #0f2c3e;   /* button hover */
    --brand-600: #14384e;   /* main color: buttons, links, "In" / "Going" */
    --brand-600-rgb: 20,56,78;
    --brand-900-rgb: 12,34,48;
    --brand-text: #0f2c3e;  /* dark text on light brand backgrounds (alerts, badges) */
    --brand-focus: #6f9ab3; /* focused form field border */
    --brand-300: #9cc7df;   /* text on dark backgrounds (active menu item) */
    --brand-200: #bcd4e2;   /* light borders */
    --brand-100: #e4eef4;   /* light highlight (checked-in rows, selected options) */
    --brand-bg:  #f2f5f7;   /* page background */

    --clr-bg: var(--brand-bg); --clr-sidebar: var(--brand-900); --clr-sidebar-active: var(--brand-800);
    --clr-primary: var(--brand-600); --clr-primary-soft: rgba(var(--brand-600-rgb),.1);
    --clr-accent: #f59e0b; --clr-card: #fff; --clr-text: #1e293b; --clr-ink: #1e293b;
    --clr-muted: #64748b; --sidebar-w: 260px; --radius: .75rem;
    --tabbar-h: 60px;
    --safe-top: env(safe-area-inset-top, 0px); --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px); --safe-right: env(safe-area-inset-right, 0px);
}


/* 2. Bootstrap overrides: brand color instead of Bootstrap's blue/green ---- */

:root {
    --bs-primary: var(--brand-600); --bs-primary-rgb: var(--brand-600-rgb);
    --bs-link-color: var(--brand-600); --bs-link-color-rgb: var(--brand-600-rgb);
    --bs-link-hover-color: var(--brand-700);
    --bs-primary-bg-subtle: var(--brand-100); --bs-primary-border-subtle: var(--brand-200); --bs-primary-text-emphasis: var(--brand-text);
    --bs-focus-ring-color: rgba(var(--brand-600-rgb),.25);
    /* "Success" (In, Check-in, Going, saved messages) uses the brand color too */
    --bs-success: var(--brand-600); --bs-success-rgb: var(--brand-600-rgb);
    --bs-success-bg-subtle: var(--brand-100); --bs-success-border-subtle: var(--brand-200); --bs-success-text-emphasis: var(--brand-text);
}
.btn-primary, .btn-success {
    --bs-btn-bg: var(--brand-600); --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-700); --bs-btn-hover-border-color: var(--brand-700);
    --bs-btn-active-bg: var(--brand-900); --bs-btn-active-border-color: var(--brand-900);
    --bs-btn-disabled-bg: var(--brand-600); --bs-btn-disabled-border-color: var(--brand-600);
    --bs-btn-focus-shadow-rgb: var(--brand-600-rgb);
}
.btn-outline-primary, .btn-outline-success {
    --bs-btn-color: var(--brand-600); --bs-btn-border-color: var(--brand-600);
    --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600);
    --bs-btn-active-bg: var(--brand-700); --bs-btn-active-border-color: var(--brand-700);
    --bs-btn-disabled-color: var(--brand-600); --bs-btn-disabled-border-color: var(--brand-600);
    --bs-btn-focus-shadow-rgb: var(--brand-600-rgb);
}
.alert-success { --bs-alert-color: var(--brand-text); --bs-alert-bg: var(--brand-100); --bs-alert-border-color: var(--brand-200); --bs-alert-link-color: var(--brand-text); }
.form-control:focus, .form-select:focus, .form-check-input:focus { border-color: var(--brand-focus); box-shadow: 0 0 0 .2rem rgba(var(--brand-600-rgb),.18); }
.form-check-input:checked { background-color: var(--brand-600); border-color: var(--brand-600); }
.dropdown-item:active, .list-group-item.active, .nav-pills .nav-link.active { background-color: var(--brand-600); border-color: var(--brand-600); }
.progress-bar { background-color: var(--brand-600); }


/* 3. App layout (body.app-page) ------------------------------------------- */

* { font-family: 'DM Sans', sans-serif; }
html { -webkit-text-size-adjust: 100%; }

/* Scroll bars everywhere (page, lists, tables, popups): thin, rounded, faintly brand-tinted.
   The sidebar has its own light version below.
   Chrome/Edge/Safari use the ::-webkit-scrollbar rules (exact width); Firefox can only do "thin". */
@supports not selector(::-webkit-scrollbar) {
    * { scrollbar-width: thin; scrollbar-color: rgba(var(--brand-600-rgb),.15) transparent; }
    *:hover { scrollbar-color: rgba(var(--brand-600-rgb),.3) transparent; }
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(var(--brand-600-rgb),.15); border-radius: 8px;
    border: 1.5px solid transparent; background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: rgba(var(--brand-600-rgb),.3); }
::-webkit-scrollbar-corner { background: transparent; }
body.app-page { background: var(--clr-bg); color: var(--clr-text); min-height: 100vh; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }

/* Sidebar (desktop) / slide-in menu (phones) */
.sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
    background: var(--clr-sidebar); display: flex; flex-direction: column;
    z-index: 1045; transition: transform .25s ease;
    padding-top: var(--safe-top); padding-bottom: var(--safe-bottom); padding-left: var(--safe-left);
}
.sidebar-brand { padding: 1.5rem 1.25rem; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-brand img { height: 30px; width: auto; display: block; }
.sidebar-nav { flex: 1; padding: 1rem .75rem; overflow-y: auto; -webkit-overflow-scrolling: touch; }
/* Thin, rounded scrollbar that blends into the dark sidebar; brightens on hover */
@supports not selector(::-webkit-scrollbar) {
    .sidebar-nav { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.18) transparent; }
    .sidebar-nav:hover { scrollbar-color: rgba(255,255,255,.3) transparent; }
}
.sidebar-nav::-webkit-scrollbar { width: 8px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15); border-radius: 8px;
    border: 1.5px solid transparent; background-clip: padding-box;
}
.sidebar-nav::-webkit-scrollbar-thumb:hover { background-color: rgba(255,255,255,.3); }
.sidebar-nav .nav-label {
    font-size: .65rem; text-transform: uppercase; letter-spacing: .08em;
    color: rgba(255,255,255,.35); padding: .75rem .75rem .35rem; font-weight: 600;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: .625rem; min-height: 44px;
    padding: .6rem .75rem; color: rgba(255,255,255,.65); border-radius: .5rem;
    text-decoration: none; font-size: .9rem; font-weight: 500; transition: .15s; margin-bottom: 2px;
}
.sidebar-nav a:hover, .sidebar-nav a.active { background: var(--clr-sidebar-active); color: #fff; }
.sidebar-nav a.active { color: var(--brand-300); }
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.06); }
.sidebar-footer .user-info { display: flex; align-items: center; gap: .625rem; color: #fff; font-size: .875rem; }
.sidebar-footer .avatar {
    width: 36px; height: 36px; border-radius: 50%; background: var(--clr-primary);
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: .8rem; color: #fff; flex-shrink: 0;
}
.backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.45); z-index: 1040; }
.backdrop.show { display: block; }

/* Main area */
.main-wrapper { margin-left: var(--sidebar-w); min-height: 100vh; }
.top-bar {
    position: sticky; top: 0; z-index: 1030;
    background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid #e2e8f0;
    padding: .875rem 2rem; display: flex; align-items: center; gap: .5rem; min-height: 56px;
}
.top-bar h1 { font-size: 1.15rem; font-weight: 700; margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.top-bar .icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; font-size: 1.35rem; color: var(--clr-text); flex-shrink: 0; }
.top-bar .icon-btn:active { background: #eef2f7; }
.page-content { padding: 1.75rem 2rem; }

.card { border: none; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.04), 0 1px 2px rgba(0,0,0,.06); }
.card-header { background: transparent; border-bottom: 1px solid #f1f5f9; font-weight: 600; padding: 1rem 1.25rem; }
.card-hover { transition: box-shadow .15s, transform .15s; }
.card-hover:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); transform: translateY(-2px); }
.stat-card { background: var(--clr-card); border-radius: var(--radius); padding: 1.5rem; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.stat-card .stat-icon { width: 48px; height: 48px; border-radius: .625rem; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { font-size: .8rem; color: var(--clr-muted); font-weight: 500; }
.table th { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--clr-muted); font-weight: 600; border-bottom-width: 1px; }
.table td { vertical-align: middle; font-size: .875rem; }
.btn-call { background: var(--brand-600); color: #fff; border: 0; padding: .35rem .65rem; border-radius: .375rem; font-size: .8rem; font-weight: 600; }
.btn-call:hover, .btn-call:active { background: var(--brand-700); color: #fff; }
.btn-sms { background: var(--clr-primary); color: #fff; border: 0; padding: .35rem .65rem; border-radius: .375rem; font-size: .8rem; font-weight: 600; }
.btn-sms:hover, .btn-sms:active { background: var(--brand-700); color: #fff; }
.role-badge { font-size: .7rem; font-weight: 600; padding: .25rem .6rem; border-radius: 999px; }
.breadcrumb { background: none; padding: 0; margin-bottom: .25rem; font-size: .8rem; }
.breadcrumb-item a { color: var(--clr-primary); text-decoration: none; }

/* Lists used by the phone layouts of pages (e.g. a group's people) */
.m-list { list-style: none; margin: 0; padding: 0; }
.m-item { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; min-height: 60px; }
.m-item:last-child { border-bottom: 0; }
.m-item .m-main { flex: 1; min-width: 0; }
.m-item .m-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; color: var(--clr-text); text-decoration: none; }
.m-item .m-sub { font-size: .8rem; color: var(--clr-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-avatar { width: 40px; height: 40px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: .8rem; font-weight: 700; flex-shrink: 0; }
.m-round { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; }

/* Bottom tab bar (phones) */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030;
    display: flex; background: rgba(255,255,255,.96); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-top: 1px solid #e2e8f0; padding-bottom: var(--safe-bottom); padding-left: var(--safe-left); padding-right: var(--safe-right);
}
.tabbar a, .tabbar button {
    flex: 1; height: var(--tabbar-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--clr-muted); text-decoration: none; font-size: .68rem; font-weight: 600; border: 0; background: none;
}
.tabbar i { font-size: 1.3rem; line-height: 1; }
.tabbar .active { color: var(--clr-primary); }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); width: min(var(--sidebar-w), 85vw); }
    .sidebar.show { transform: translateX(0); box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .main-wrapper { margin-left: 0; padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom)); }
    .top-bar { padding: calc(.5rem + var(--safe-top)) calc(.75rem + var(--safe-right)) .5rem calc(.75rem + var(--safe-left)); }
    .top-bar h1 { font-size: 1.05rem; }
    .page-content { padding: 1rem calc(.75rem + var(--safe-right)) 1.5rem calc(.75rem + var(--safe-left)); }
    .breadcrumb { display: none; }
    /* Bigger touch targets and no zoom-on-focus in iOS (inputs under 16px zoom the page) */
    .app-page .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: .25rem; }
    .app-page .btn-sm { min-height: 38px; }
    .app-page .form-control, .app-page .form-select, .app-page .input-group-text { font-size: 16px; min-height: 44px; }
    .app-page .form-control-sm, .app-page .form-select-sm { font-size: 16px; min-height: 40px; }
    .card { border-radius: .9rem; }
    .stat-card { padding: 1rem; }
    .stat-card .stat-icon { width: 40px; height: 40px; font-size: 1.1rem; }
    .stat-card .stat-value { font-size: 1.35rem; }
    .modal-dialog { margin: .5rem; }
    .modal-dialog.modal-dialog-centered { min-height: calc(100% - 1rem); }
    .alert { border-radius: .75rem; }
    .dropdown-item { padding-top: .65rem; padding-bottom: .65rem; }
}
@media (min-width: 992px) { .tabbar { display: none; } }

/* Tables become stacked cards on phones (labels added by the layout script; opt out with .no-stack) */
@media (max-width: 767.98px) {
    .table-stack thead { display: none; }
    .table-stack, .table-stack tbody, .table-stack tr, .table-stack td { display: block; width: 100%; }
    .table-stack tr { padding: .75rem 1rem; border-bottom: 1px solid #f1f5f9; }
    .table-stack tr:last-child { border-bottom: 0; }
    .table-stack td { border: 0 !important; padding: .2rem 0 !important; display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: right !important; min-height: 28px; }
    .table-stack td::before { content: attr(data-label); color: var(--clr-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; text-align: left; flex-shrink: 0; }
    .table-stack td:first-child { display: block; text-align: left !important; font-size: 1rem; padding-bottom: .4rem !important; }
    .table-stack td:first-child::before, .table-stack td.no-label::before, .table-stack td[data-label=""]::before { content: none; }
    .table-stack td.no-label, .table-stack td[data-label=""] { justify-content: flex-end; }
    .table-stack td[colspan] { display: block; text-align: center !important; }
}

@media print {
    .sidebar, .top-bar, .tabbar, .backdrop { display: none !important; }
    .main-wrapper { margin: 0; padding: 0; }
}


/* 4. Login & password pages (body.auth-page) ------------------------------- */

/* Mountain photo with a brand-color tint so the white card stands out.
   Phones held upright get a portrait crop centred on the peak; the dark brand color shows while it loads. */
body.auth-page {
    min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center;
    background-color: var(--brand-900);
    background-image:
        linear-gradient(180deg, rgba(var(--brand-900-rgb),.30) 0%, rgba(var(--brand-900-rgb),.55) 55%, rgba(var(--brand-900-rgb),.80) 100%),
        url('../images/login-bg-1920.jpg');
    background-size: cover; background-position: 65% center; background-repeat: no-repeat;
    padding: calc(1rem + env(safe-area-inset-top)) 1rem calc(1rem + env(safe-area-inset-bottom));
}
@media (orientation: portrait) and (max-width: 900px) {
    body.auth-page {
        background-image:
            linear-gradient(180deg, rgba(var(--brand-900-rgb),.30) 0%, rgba(var(--brand-900-rgb),.55) 55%, rgba(var(--brand-900-rgb),.80) 100%),
            url('../images/login-bg-portrait.jpg');
        background-position: center;
    }
}
.auth-page .form-control { font-size: 16px; min-height: 44px; }
.auth-card { background: #fff; border-radius: 1rem; padding: 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 25px 50px rgba(0,0,0,.25); }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: .6rem; font-size: 1.4rem; font-weight: 700; margin-bottom: 1.75rem; color: var(--brand-900); letter-spacing: -.01em; }
.auth-brand img { width: 64px; height: 64px; border-radius: 16px; }
.auth-page .btn-primary { padding: .625rem; font-weight: 600; }
.auth-card a { color: var(--brand-600); }
@media (max-width: 420px) { .auth-card { padding: 1.75rem 1.25rem; } }


/* 5. Public pages: Gifts, QR sign-up, event RSVP (body.public-page) -------- */

body.public-page { background: var(--clr-bg); color: var(--clr-ink); min-height: 100vh; }
.public-header { background: var(--brand-900); color: #fff; padding: calc(1rem + env(safe-area-inset-top)) 0 1rem; margin-bottom: 2rem; }
.public-header .brand img { height: 30px; width: auto; display: block; }
.public-page .form-control, .public-page .form-select { font-size: 16px; min-height: 44px; }
.public-card { background: #fff; border-radius: 1rem; padding: 2rem; box-shadow: 0 10px 30px rgba(15,23,42,.08); }
.public-page .btn-primary { font-weight: 600; }
.public-page a { color: var(--clr-primary); }
@media (max-width: 576px) { .public-card { padding: 1.25rem; border-radius: .75rem; } }
@media print {
    .public-header, .no-print { display: none !important; }
    body.public-page { background: #fff; }
    .public-card { box-shadow: none; padding: 0; }
}


/* 6. Page-specific styles -------------------------------------------------- */

/* Group attendance (attendance/index.php) */
.att-bar { position: sticky; top: calc(56px + var(--safe-top)); z-index: 1020; }
@media (min-width: 992px) { .att-bar { top: 62px; } }
.att-row { transition: background-color .15s; }
.att-row[data-state="in"]  { background: var(--brand-100); }
.att-row[data-state="out"] { background: #fffbeb; }
.att-toggle { display: inline-flex; border-radius: .6rem; overflow: hidden; border: 1px solid #e2e8f0; flex-shrink: 0; }
.att-toggle button { border: 0; background: #fff; min-width: 58px; height: 44px; font-weight: 600; font-size: .85rem; color: var(--clr-muted); display: inline-flex; align-items: center; justify-content: center; gap: .25rem; }
.att-toggle button + button { border-left: 1px solid #e2e8f0; }
.att-row[data-state="in"]  .att-toggle [data-action="in"]  { background: var(--brand-600); color: #fff; }
.att-row[data-state="out"] .att-toggle [data-action="add"] { background: #f59e0b; color: #fff; }
.att-row.saving { opacity: .6; }
@media (max-width: 380px) { .att-toggle button { min-width: 50px; } .att-toggle .lbl { display: none; } }

/* Events list (events/index.php) */
.date-badge { width: 52px; flex-shrink: 0; text-align: center; border-radius: .6rem; background: var(--clr-primary-soft); color: var(--clr-primary); padding: .35rem 0; line-height: 1.1; }
.date-badge .mon { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.date-badge .day { font-size: 1.35rem; font-weight: 700; }
.past .date-badge { background: #eef2f7; color: var(--clr-muted); }

/* Event page RSVP counts (events/view.php) */
.rsvp-chip { border: 1px solid #e2e8f0; background: #fff; border-radius: .75rem; padding: .5rem .25rem; text-align: center; min-width: 0; }
.rsvp-chip .n { font-size: 1.25rem; font-weight: 700; line-height: 1.1; }
.rsvp-chip .l { font-size: .72rem; color: var(--clr-muted); font-weight: 600; }
.rsvp-chip.active { border-color: var(--clr-primary); background: var(--clr-primary-soft); }

/* Event check-in (events/checkin.php) */
.ci-bar { position: sticky; top: calc(56px + var(--safe-top)); z-index: 1020; }
@media (min-width: 992px) { .ci-bar { top: 62px; } }
.ci-row[data-checked="1"] { background: var(--brand-100); }
.ci-btn { min-width: 108px; height: 44px; font-weight: 600; }
.ci-row[data-checked="1"] .ci-btn { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.ci-row.saving { opacity: .6; }

/* Public event RSVP choices (events/public.php) */
.choice input { display: none; }
.choice label { display: flex; align-items: center; justify-content: center; gap: .35rem; border: 2px solid #e2e8f0; border-radius: .75rem; padding: .7rem .25rem; font-weight: 600; cursor: pointer; text-align: center; min-height: 52px; }
.choice input:checked + label { border-color: var(--clr-primary); background: var(--brand-100); color: var(--clr-primary); }

/* Spiritual Gifts assessment (gifts/assessment.php) */
.option { display: block; width: 100%; text-align: left; border: 2px solid #e2e8f0; background: #fff; border-radius: .75rem; padding: .9rem 1.1rem; margin-bottom: .6rem; font-weight: 500; transition: border-color .15s, background .15s; }
.option:hover { border-color: var(--brand-200); }
.option.selected { border-color: var(--clr-primary); background: var(--brand-100); }
.option .key { display: inline-block; width: 1.6rem; color: var(--clr-muted); font-size: .85rem; }
.question-text { font-size: 1.25rem; font-weight: 600; line-height: 1.45; min-height: 3.6rem; }
.public-page .progress { height: .5rem; }
#save-status { min-height: 1.25rem; }

/* Spiritual Gifts results (gifts/results.php) */
.gift { border: 1px solid #e2e8f0; border-radius: .75rem; margin-bottom: .5rem; background: #fff; }
.gift summary { display: flex; align-items: center; gap: .75rem; padding: .75rem 1rem; cursor: pointer; list-style: none; }
.gift summary::-webkit-details-marker { display: none; }
.gift-title { flex: 1; font-weight: 600; }
.gift-bar { width: 30%; height: .5rem; background: #eef2f7; border-radius: 999px; overflow: hidden; }
.gift-bar span { display: block; height: 100%; background: var(--clr-primary); }
.gift.low .gift-bar span { background: #94a3b8; }
.gift-points { width: 4rem; text-align: right; font-size: .85rem; color: var(--clr-muted); }
.gift-meaning { padding: 0 1rem 1rem; color: #334155; }
@media print { .gift { break-inside: avoid; } .gift-meaning { display: none; } }

/* Message group (groups/view.php) */
.msg-tabs .nav-link { font-weight: 600; font-size: .85rem; padding: .5rem .25rem; color: var(--clr-muted); }
.msg-tabs .nav-link i { display: block; font-size: 1.1rem; margin-bottom: .1rem; }
@media (min-width: 576px) { .msg-tabs .nav-link i { display: inline; margin: 0 .25rem 0 0; } }
.msg-tabs .nav-link.active { color: #fff; }
.msg-recipients { max-height: 320px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.msg-recipient { display: flex; align-items: center; gap: .6rem; padding: .6rem .85rem; border-bottom: 1px solid #f1f5f9; min-height: 48px; cursor: pointer; margin: 0; }
.msg-recipient:last-child { border-bottom: 0; }
.msg-recipient .form-check-input { width: 1.2rem; height: 1.2rem; flex-shrink: 0; }
@media (max-width: 575.98px) { .msg-recipients { max-height: none; } }

/* Ministry logos (ministries pages, dashboard) */
.ministry-logo { width: 40px; height: 40px; border-radius: .6rem; background: var(--brand-100); color: var(--brand-600); display: inline-flex; align-items: center; justify-content: center; font-size: 1.1rem; flex-shrink: 0; overflow: hidden; vertical-align: middle; }
.ministry-logo img { width: 100%; height: 100%; object-fit: contain; background: #fff; }
.ministry-logo-lg { width: 72px; height: 72px; border-radius: 1rem; font-size: 1.9rem; border: 1px solid #e2e8f0; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { display: flex; gap: .6rem; align-items: flex-start; padding: .3rem 0; }
.contact-list i { color: var(--clr-muted); width: 1.1rem; flex-shrink: 0; margin-top: .1rem; }
.contact-list a { text-decoration: none; word-break: break-word; }

/* Prayer requests (prayer_requests/index.php) */
.prayer-item .m-main { white-space: normal; }
.prayer-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--clr-text); }

/* Group roster, printable / Save as PDF (groups/roster.php) */
body.roster-page { margin: 0; background: #e9edf1; color: #111827; }
.roster-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: .75rem; padding: calc(.6rem + env(safe-area-inset-top)) 1rem .6rem; background: var(--brand-900); color: #fff; }
.roster-hint { flex: 1; font-size: .8rem; color: var(--brand-300); }
.roster-btn { display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: 0 1rem; border: 0; border-radius: .5rem; background: #fff; color: var(--brand-900); font-weight: 600; font-size: .9rem; text-decoration: none; cursor: pointer; white-space: nowrap; }
.roster-btn-light { background: transparent; color: #fff; padding: 0 .5rem; }
@media (max-width: 600px) { .roster-hint { display: none; } .roster-toolbar { justify-content: space-between; } }
.roster-sheet { max-width: 1050px; margin: 1.25rem auto; background: #fff; padding: 2rem 2.25rem; box-shadow: 0 2px 12px rgba(0,0,0,.08); border-radius: .5rem; }
.roster-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.roster-logo { width: 64px; height: 64px; object-fit: contain; }
.roster-ministry { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: #64748b; font-weight: 600; }
.roster-head h1 { font-size: 1.5rem; font-weight: 700; margin: .1rem 0 .2rem; color: var(--brand-900); }
.roster-meta { display: flex; flex-wrap: wrap; gap: .25rem 1rem; font-size: .8rem; color: #475569; }
.roster-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.roster-table { width: 100%; border-collapse: collapse; font-size: 11px; }
.roster-table th { text-align: left; font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: #475569; border-bottom: 2px solid var(--brand-900); padding: 6px 6px; vertical-align: bottom; }
.roster-table td { border-bottom: 1px solid #d1d5db; padding: 7px 6px; vertical-align: middle; height: 22px; }
.roster-table tbody tr:nth-child(even) td { background: #f6f8fa; }
.roster-table .num { width: 24px; color: #94a3b8; text-align: right; }
.roster-table .name { font-weight: 600; white-space: nowrap; }
.roster-table .nowrap { white-space: nowrap; }
.roster-table .email { word-break: break-all; color: #334155; }
.roster-table .center { text-align: center; }
.roster-table th.check { text-align: center; width: 46px; line-height: 1.2; }
.roster-table td.check { width: 46px; border-left: 1px solid #d1d5db; }
.roster-table td.check:last-child { border-right: 1px solid #d1d5db; }
.roster-empty { color: #64748b; }
@page { size: letter; margin: 12mm 10mm; }
@media print {
    body.roster-page { background: #fff; }
    .no-print { display: none !important; }
    .roster-sheet { max-width: none; margin: 0; padding: 0; box-shadow: none; border-radius: 0; }
    .roster-scroll { overflow: visible; }
    .roster-table thead { display: table-header-group; }   /* column titles repeat on every page */
    .roster-table tr { break-inside: avoid; }
    .roster-table tbody tr:nth-child(even) td { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* Inactive people (groups/view.php): greyed out, kept at the bottom, can be hidden */
.is-inactive .m-avatar, .is-inactive td:first-child .m-avatar { filter: grayscale(1); opacity: .6; }
.is-inactive .m-title, .is-inactive .m-sub, tr.is-inactive td { color: #94a3b8 !important; }
.is-inactive .m-title a, tr.is-inactive td a { color: #94a3b8; }
.is-inactive .btn-call, .is-inactive .btn-sms { opacity: .45; }
.hide-inactive .is-inactive { display: none !important; }

/* Event pictures (events/*.php) */
.event-image-pick { border: 1px dashed #cbd5e1; border-radius: .75rem; background: #f8fafc; min-height: 120px; display: flex; align-items: center; justify-content: center; overflow: hidden; color: var(--clr-muted); font-size: .9rem; }
.event-image-pick img { width: 100%; max-height: 260px; object-fit: contain; display: block; background: #fff; }
.event-banner { display: block; width: 100%; max-height: 320px; object-fit: cover; }
.event-thumb { width: 52px; height: 52px; object-fit: cover; border-radius: .6rem; flex-shrink: 0; }
.public-hero { display: block; width: calc(100% + 4rem); max-height: 360px; object-fit: cover; margin: -2rem -2rem 1.5rem; border-radius: 1rem 1rem 0 0; }
@media (max-width: 576px) { .public-hero { width: calc(100% + 2.5rem); margin: -1.25rem -1.25rem 1.25rem; border-radius: .75rem .75rem 0 0; } }
