/* ==========================================================================
   Building committee app — shared design system.
   Loaded after Bootstrap (RTL) on every page. Page templates should use these
   tokens and components instead of literal colours or one-off inline styles.
   ========================================================================== */

/* ---------- 1. Tokens ---------- */
:root {
    /* Brand */
    --navy: #1E2D3B;
    --navy-2: #2C4256;          /* hover */
    --navy-3: #15212C;          /* pressed */
    --navy-soft: #E8EDF2;       /* tint for info surfaces */
    --gold: #C5A059;
    --gold-deep: #8F6E2E;       /* gold that is readable on white */
    --gold-soft: #F4ECDA;       /* tint */
    --parchment: #F5F3ED;       /* page background */
    --surface: #FFFFFF;         /* cards, inputs */
    --ink: #23272C;
    --muted: #6B675E;
    --line: #E6E0D2;
    --line-strong: #D6CEBC;

    /* Meaning (money in / money out / donation) */
    --ok: #1E7A4C;
    --ok-soft: #E6F3EC;
    --danger: #B42330;
    --danger-soft: #FBEAEB;
    --donation: var(--gold-deep);
    --donation-soft: var(--gold-soft);

    /* Older names, kept as aliases for any template that still uses them */
    --primary-dark: var(--navy);
    --primary-gold: var(--gold);
    --bg-parchment: var(--parchment);
    --bg-white: var(--surface);

    --font-head: 'Alef', 'David', 'Segoe UI', Arial, sans-serif;
    --font-body: 'Open Sans', 'Segoe UI', Arial, sans-serif;
    --radius: 12px;
    --radius-sm: 10px;
    --shadow-sm: 0 1px 2px rgba(30, 45, 59, .04), 0 4px 14px rgba(30, 45, 59, .05);
    --shadow-md: 0 6px 20px rgba(30, 45, 59, .12);

    /* Bootstrap mapped onto the brand (no stock blue anywhere) */
    --bs-body-font-family: var(--font-body);
    --bs-body-color: var(--ink);
    --bs-body-color-rgb: 35, 39, 44;
    --bs-emphasis-color: var(--ink);
    --bs-secondary-color: var(--muted);
    --bs-border-color: var(--line);
    --bs-border-radius: var(--radius-sm);
    --bs-border-radius-lg: var(--radius);
    --bs-primary: var(--navy);
    --bs-primary-rgb: 30, 45, 59;
    --bs-secondary: var(--muted);
    --bs-secondary-rgb: 107, 103, 94;
    --bs-success: var(--ok);
    --bs-success-rgb: 30, 122, 76;
    --bs-danger: var(--danger);
    --bs-danger-rgb: 180, 35, 48;
    --bs-warning: var(--gold);
    --bs-warning-rgb: 197, 160, 89;
    --bs-info: var(--navy-soft);
    --bs-info-rgb: 232, 237, 242;
    --bs-light-rgb: 250, 248, 243;
    --bs-dark-rgb: 30, 45, 59;
    --bs-link-color: var(--navy);
    --bs-link-color-rgb: 30, 45, 59;
    --bs-link-hover-color: var(--gold-deep);
    --bs-link-hover-color-rgb: 143, 110, 46;
    --bs-focus-ring-color: rgba(197, 160, 89, .35);
    --bs-primary-text-emphasis: var(--navy);
    --bs-primary-bg-subtle: var(--navy-soft);
    --bs-primary-border-subtle: #C9D3DD;
    --bs-success-text-emphasis: #155C39;
    --bs-success-bg-subtle: var(--ok-soft);
    --bs-success-border-subtle: #BFDCCB;
    --bs-danger-text-emphasis: #8A1A24;
    --bs-danger-bg-subtle: var(--danger-soft);
    --bs-danger-border-subtle: #F0C4C8;
    --bs-warning-text-emphasis: #6E531F;
    --bs-warning-bg-subtle: var(--gold-soft);
    --bs-warning-border-subtle: #E6D3A8;
    --bs-info-text-emphasis: var(--navy);
    --bs-info-bg-subtle: var(--navy-soft);
    --bs-info-border-subtle: #C9D3DD;
    --bs-secondary-bg-subtle: #F3F1EB;
    --bs-secondary-border-subtle: var(--line);
    --bs-secondary-text-emphasis: var(--ink);
    --bs-light-bg-subtle: #FAF8F3;
}

/* ---------- 2. Base ---------- */
body {
    font-family: var(--font-body);
    background-color: var(--parchment);
    color: var(--ink);
    padding-bottom: calc(90px + env(safe-area-inset-bottom, 0px));
}
@media (min-width: 769px) { body { padding-bottom: 2.5rem; } }

h1, h2, h3, h4, .h1, .h2, .h3, .h4, .modal-title {
    font-family: var(--font-head);
    font-weight: 700;
    color: var(--navy);
    text-wrap: balance;
}
h5, h6, .h5, .h6 { font-weight: 600; color: var(--navy); }
.text-primary-dark { color: var(--navy) !important; }
.text-gold { color: var(--gold-deep) !important; }
.num, .amount { font-variant-numeric: tabular-nums; }
.min-w-0 { min-width: 0; }
.amount-pos { color: var(--ok) !important; }
.amount-neg { color: var(--danger) !important; }
.amount-donation { color: var(--donation) !important; }
::selection { background: var(--gold-soft); }

/* ---------- 3. Icons ---------- */
.icon {
    width: 1.15em; height: 1.15em; flex: none;
    vertical-align: -0.2em;
    fill: none; stroke: currentColor; stroke-width: 1.75;
    stroke-linecap: round; stroke-linejoin: round;
}
.icon-lg { width: 1.6em; height: 1.6em; }
.icon-xl { width: 2.2em; height: 2.2em; stroke-width: 1.5; }
/* Round tinted holder for a feature icon (empty states, success screens, activity rows). */
.icon-badge {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 2.5rem; height: 2.5rem; border-radius: 50%;
    background: var(--gold-soft); color: var(--gold-deep); font-size: 1.1rem;
}
.icon-badge.lg { width: 4rem; height: 4rem; font-size: 1.7rem; }
.icon-badge.ok { background: var(--ok-soft); color: var(--ok); }
.icon-badge.danger { background: var(--danger-soft); color: var(--danger); }
.icon-badge.navy { background: var(--navy-soft); color: var(--navy); }

/* ---------- 4. Controls ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 48px; border-radius: var(--radius-sm); font-size: 16px; font-weight: 500;
}
.btn-sm { min-height: 36px; border-radius: 8px; font-size: .875rem; gap: .3rem; }
.btn-lg { min-height: 54px; font-size: 1.1rem; }
.btn-link { min-height: 0; }
.btn-primary, .btn-dark {
    --bs-btn-color: #fff; --bs-btn-bg: var(--navy); --bs-btn-border-color: var(--navy);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--navy-2); --bs-btn-hover-border-color: var(--navy-2);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--navy-3); --bs-btn-active-border-color: var(--navy-3);
    --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--navy); --bs-btn-disabled-border-color: var(--navy);
    --bs-btn-focus-shadow-rgb: 197, 160, 89;
}
.btn-outline-primary {
    --bs-btn-color: var(--navy); --bs-btn-border-color: var(--navy);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--navy-3); --bs-btn-active-border-color: var(--navy-3);
    --bs-btn-disabled-color: var(--navy); --bs-btn-disabled-border-color: var(--navy);
    --bs-btn-focus-shadow-rgb: 197, 160, 89;
}
/* Gold = "special" actions (send a message, pay hall rental). Navy text keeps it readable. */
.btn-warning, .btn-gold {
    --bs-btn-color: var(--navy); --bs-btn-bg: var(--gold); --bs-btn-border-color: var(--gold);
    --bs-btn-hover-color: var(--navy); --bs-btn-hover-bg: #B8914A; --bs-btn-hover-border-color: #B8914A;
    --bs-btn-active-color: var(--navy); --bs-btn-active-bg: #A9833F; --bs-btn-active-border-color: #A9833F;
    --bs-btn-disabled-color: var(--navy); --bs-btn-disabled-bg: var(--gold); --bs-btn-disabled-border-color: var(--gold);
    --bs-btn-focus-shadow-rgb: 197, 160, 89;
}
.btn-success {
    --bs-btn-bg: var(--ok); --bs-btn-border-color: var(--ok);
    --bs-btn-hover-bg: #186640; --bs-btn-hover-border-color: #186640;
    --bs-btn-active-bg: #135434; --bs-btn-active-border-color: #135434;
    --bs-btn-disabled-bg: var(--ok); --bs-btn-disabled-border-color: var(--ok);
}
.btn-danger {
    --bs-btn-bg: var(--danger); --bs-btn-border-color: var(--danger);
    --bs-btn-hover-bg: #981D28; --bs-btn-hover-border-color: #981D28;
    --bs-btn-active-bg: #7F1821; --bs-btn-active-border-color: #7F1821;
    --bs-btn-disabled-bg: var(--danger); --bs-btn-disabled-border-color: var(--danger);
}
.btn-outline-danger {
    --bs-btn-color: var(--danger); --bs-btn-border-color: #E3B3B8;
    --bs-btn-hover-bg: var(--danger); --bs-btn-hover-border-color: var(--danger);
    --bs-btn-active-bg: #981D28; --bs-btn-active-border-color: #981D28;
}
/* Neutral ("cancel", "close", secondary choices) */
.btn-secondary, .btn-outline-secondary, .btn-light {
    --bs-btn-color: var(--ink); --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-color: var(--navy); --bs-btn-hover-bg: #FAF8F3; --bs-btn-hover-border-color: var(--gold);
    --bs-btn-active-color: var(--navy); --bs-btn-active-bg: var(--gold-soft); --bs-btn-active-border-color: var(--gold);
    --bs-btn-disabled-color: var(--muted); --bs-btn-disabled-bg: #F3F1EB; --bs-btn-disabled-border-color: var(--line);
    --bs-btn-focus-shadow-rgb: 197, 160, 89;
}
.btn-outline-dark {
    --bs-btn-color: var(--navy); --bs-btn-border-color: var(--navy);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy);
    --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--navy-3); --bs-btn-active-border-color: var(--navy-3);
}
/* Big stacked choice buttons (invoice picker: camera / file / signature) */
.picker-choice { flex-direction: column; gap: .3rem; min-height: 68px; line-height: 1.2; font-size: .95rem; padding-inline: .25rem; }
.btn-info {
    --bs-btn-color: var(--navy); --bs-btn-bg: var(--navy-soft); --bs-btn-border-color: var(--navy-soft);
    --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--navy); --bs-btn-hover-border-color: var(--navy);
}

.form-control, .form-select {
    min-height: 48px; border-radius: var(--radius-sm); font-size: 16px;
    border-color: var(--line-strong); background-color: var(--surface);
}
.form-control-sm, .form-select-sm { min-height: 38px; font-size: 16px; border-radius: 8px; }
textarea.form-control { min-height: 0; }
.form-control:focus, .form-select:focus {
    border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(197, 160, 89, .25);
}
.form-check-input:checked { background-color: var(--navy); border-color: var(--navy); }
.form-check-input:focus { border-color: var(--gold); box-shadow: 0 0 0 .2rem rgba(197, 160, 89, .25); }
.form-label, label.fw-bold { color: var(--navy); }
.input-group-text { background: #FAF8F3; border-color: var(--line-strong); }
a { text-underline-offset: .2em; }
:focus-visible { outline-color: var(--gold); }

/* ---------- 5. Surfaces ---------- */
.card {
    border: 1px solid var(--line); border-radius: var(--radius);
    background-color: var(--surface); box-shadow: var(--shadow-sm); margin-bottom: 1rem;
}
.card-header { background: #FAF8F3; border-bottom-color: var(--line); }
.card-header.brand { background: var(--navy); color: #fff; }
.card-header.brand h5, .card-header.brand .h5 { color: var(--gold); margin: 0; }
.list-group { --bs-list-group-border-color: var(--line); --bs-list-group-active-bg: var(--navy); --bs-list-group-active-border-color: var(--navy); }
.list-group-item-action:hover { background-color: #FAF8F3; }
.bg-soft { background: #FAF8F3 !important; }
.panel-soft { background: #FAF8F3; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: .75rem; }

.alert { border-radius: var(--radius-sm); }
.alert-flash { display: flex; align-items: flex-start; gap: .6rem; box-shadow: var(--shadow-sm); }
.alert-flash > .icon { font-size: 1.15rem; margin-top: .1em; }
.alert-flash .flash-text { flex: 1; min-width: 0; }

.badge { font-weight: 600; }
.badge.bg-light { color: var(--ink) !important; }

.pagination {
    --bs-pagination-color: var(--navy); --bs-pagination-hover-color: var(--navy);
    --bs-pagination-hover-bg: var(--gold-soft); --bs-pagination-hover-border-color: var(--line);
    --bs-pagination-focus-color: var(--navy); --bs-pagination-focus-bg: var(--gold-soft);
    --bs-pagination-focus-box-shadow: 0 0 0 .2rem rgba(197, 160, 89, .3);
    --bs-pagination-active-bg: var(--navy); --bs-pagination-active-border-color: var(--navy);
    --bs-pagination-border-color: var(--line); --bs-pagination-border-radius: 8px;
}
.dropdown-menu { --bs-dropdown-link-active-bg: var(--navy); border-color: var(--line); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); }
.nav-pills { --bs-nav-pills-link-active-bg: var(--navy); }
.table { --bs-table-border-color: var(--line); }
.table > thead th { color: var(--muted); font-weight: 600; font-size: .85rem; background: #FAF8F3; }
.table .total-row > td { --bs-table-bg: var(--navy); --bs-table-color: #fff; background: var(--navy); color: #fff; }

/* Modals: one header style everywhere. Intent is carried by the confirm button / title icon, not a coloured bar. */
.modal-content { border: 0; border-radius: 14px; box-shadow: 0 18px 50px rgba(21, 33, 44, .25); }
.modal-header {
    background: var(--surface); color: var(--navy);
    border-bottom: 1px solid var(--line); position: relative;
    border-top-left-radius: 14px; border-top-right-radius: 14px;
}
.modal-header::after {
    content: ""; position: absolute; bottom: -1px; inset-inline-start: 1rem;
    width: 48px; height: 2px; background: var(--gold);
}
.modal-header .btn-close { margin: 0; margin-inline-start: auto; }
.modal-title { display: flex; align-items: center; gap: .5rem; font-size: 1.25rem; }
.modal-title .icon { color: var(--gold-deep); }
.modal-title.is-danger .icon { color: var(--danger); }
.modal-footer { border-top-color: var(--line); }

/* ---------- 6. Page structure ---------- */
.page-header {
    display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between;
    gap: .5rem 1rem; margin-bottom: 1.25rem; padding-bottom: .75rem;
    border-bottom: 1px solid var(--line); position: relative;
}
.page-header::after {
    content: ""; position: absolute; bottom: -1px; inset-inline-start: 0;
    width: 56px; height: 2px; background: var(--gold);
}
.page-title {
    margin: 0; font-size: clamp(1.5rem, 1.25rem + 1vw, 1.95rem);
    display: flex; align-items: center; gap: .5rem;
}
.page-title > .icon { color: var(--gold-deep); }
.page-subtitle { color: var(--muted); font-size: .92rem; margin-top: .2rem; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.section-title {
    font-family: var(--font-head); font-weight: 700; color: var(--navy);
    font-size: 1.3rem; margin: 0 0 .75rem; display: flex; align-items: center; gap: .5rem;
}
.section-title > .icon { color: var(--gold-deep); }

/* Synagogue name with the ornament under it: the one "holy" mark, used on home and public pages. */
.crest { text-align: center; margin: .25rem 0 1.25rem; }
.crest-name {
    font-family: var(--font-head); font-weight: 700; color: var(--navy);
    font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.2rem); line-height: 1.2; margin: 0;
}
.crest-sub { color: var(--muted); font-size: .85rem; letter-spacing: .04em; }
.ornament {
    display: flex; align-items: center; gap: .6rem; color: var(--gold);
    width: min(220px, 70%); margin: .45rem auto .3rem;
}
.ornament::before, .ornament::after { content: ""; flex: 1; height: 1px; }
.ornament::before { background: linear-gradient(to left, var(--gold), transparent); }
.ornament::after { background: linear-gradient(to right, var(--gold), transparent); }
.ornament .icon { width: 15px; height: 15px; stroke-width: 1.6; }

/* Narrow centred card for login / signup / public pages. */
.auth-wrap { max-width: 460px; margin: 1.5rem auto 0; }

/* ---------- 7. Components ---------- */
/* Summary tiles (dashboard) */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; }
.stat-card {
    display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    box-shadow: var(--shadow-sm); color: inherit; text-decoration: none;
    transition: transform .15s, box-shadow .15s, border-color .15s;
}
a.stat-card:hover, a.stat-card:focus-visible { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--gold); color: inherit; }
.stat-title { display: flex; align-items: center; gap: .4rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
.stat-title > .icon { color: var(--gold-deep); font-size: 1.05rem; }
.stat-card.is-alert .stat-title::after {
    content: ""; width: 8px; height: 8px; border-radius: 50%;
    background: var(--danger); margin-inline-start: auto;
}
.stat-value { font-size: 1.6rem; font-weight: 700; color: var(--navy); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: .82rem; color: var(--muted); }
.stat-sub .warn { color: var(--danger); font-weight: 600; }
.stat-cta { margin-top: auto; padding-top: .4rem; font-size: .85rem; font-weight: 600; color: var(--navy); display: inline-flex; align-items: center; gap: .25rem; }
.stat-row { display: flex; justify-content: space-between; font-weight: 600; text-decoration: none; font-variant-numeric: tabular-nums; }
@media (max-width: 575.98px) {
    /* Two tiles per row on phones so the summary fits in about one screen. */
    .stat-grid { grid-template-columns: 1fr 1fr; grid-auto-flow: dense; gap: .65rem; }
    .stat-card { padding: .8rem .85rem; }
    .stat-card.wide { grid-column: 1 / -1; }
    .stat-value { font-size: 1.3rem; }
    .stat-title { font-size: .78rem; align-items: flex-start; }
    .stat-sub, .stat-cta { font-size: .75rem; }
}

/* Pills that say what kind of transaction something is */
.chip {
    display: inline-flex; align-items: center; gap: .3rem;
    font-size: .75rem; font-weight: 600; line-height: 1.6;
    border-radius: 999px; padding: 0 .6rem;
    background: #F1EEE6; color: var(--ink); white-space: nowrap;
}
.chip .icon { width: 1em; height: 1em; }
.chip-credit { background: var(--ok-soft); color: var(--ok); }
.chip-debt { background: var(--danger-soft); color: var(--danger); }
.chip-donation { background: var(--donation-soft); color: var(--donation); }
.chip-info { background: var(--navy-soft); color: var(--navy); }
.chip-dark { background: var(--navy); color: #fff; }
.chip-muted { background: #F1EEE6; color: var(--muted); }
button.chip, .chip[role="button"] { border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; }

/* Transaction history rows (staff person page + congregant area) */
.txn-list { display: flex; flex-direction: column; gap: .6rem; }
.txn-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: .85rem 1rem; box-shadow: var(--shadow-sm); }
.txn-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.txn-main { flex: 1; min-width: 0; }
.txn-desc { font-weight: 600; overflow-wrap: anywhere; }
.txn-chips { display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .3rem; }
.txn-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .6rem; font-size: .8rem; color: var(--muted); margin-top: .3rem; }
.txn-meta > span { display: inline-flex; align-items: center; gap: .25rem; }
.txn-amount { font-weight: 700; font-size: 1.1rem; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: end; flex-shrink: 0; }
.txn-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }

/* ---------- Person page (person_detail.html) ---------- */
/* Header: name, balance status, quick actions, folding details */
.person-hero { display: flex; flex-direction: column; gap: .9rem; padding: 1rem; }
.person-hero .back-link { display: inline-flex; align-items: center; gap: .1rem; font-size: .8rem; color: var(--muted); text-decoration: none; margin-bottom: .2rem; }
.person-hero .back-link:hover { color: var(--gold-deep); }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; gap: .75rem; }
.hero-name { font-size: 1.65rem; line-height: 1.15; margin: 0; }
.hero-sub { color: var(--muted); font-size: .88rem; margin-top: .25rem; }
.status-pill { flex-shrink: 0; text-align: center; border-radius: var(--radius-sm); padding: .45rem .8rem; min-width: 104px; border: 1px solid transparent; }
.status-pill .s-label { display: block; font-size: .72rem; font-weight: 600; }
.status-pill .s-amt { display: block; font-size: 1.35rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.status-pill.is-debt { background: var(--danger-soft); color: var(--danger); border-color: #F0C9CC; }
.status-pill.is-credit { background: var(--ok-soft); color: var(--ok); border-color: #BFDCCB; }
.status-pill.is-zero { background: #F1EEE6; color: var(--muted); }
.hero-actions { display: flex; gap: .5rem; }
.icon-btn {
    flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
    min-height: 42px; padding: 0 .65rem; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--navy); font-weight: 500; font-size: .88rem; text-decoration: none; white-space: nowrap;
}
.icon-btn:hover { border-color: var(--gold); background: var(--gold-soft); color: var(--navy); }
.icon-btn .icon { color: var(--gold-deep); }
.icon-btn:disabled { opacity: .55; cursor: not-allowed; background: var(--surface); border-color: var(--line); }
.hero-details summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: .4rem; font-size: .85rem; font-weight: 500; color: var(--muted); padding-top: .75rem; border-top: 1px solid var(--line); }
.hero-details summary::-webkit-details-marker { display: none; }
.hero-details summary .chev { margin-inline-start: auto; transform: rotate(-90deg); transition: transform .2s; }
.hero-details[open] summary .chev { transform: rotate(90deg); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: .65rem 1rem; margin: .75rem 0 0; }
.facts > div { min-width: 0; }
.facts dt { font-size: .72rem; font-weight: 400; color: var(--muted); display: flex; align-items: center; gap: .25rem; }
.facts dt .icon { color: var(--gold-deep); width: 1em; height: 1em; }
.facts dd { margin: .1rem 0 0; font-weight: 500; overflow-wrap: anywhere; }
.facts dd.is-empty { color: var(--muted); font-weight: 400; }
@media (min-width: 769px) {
    .person-hero { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "top actions" "details details"; align-items: center; padding: 1.25rem 1.5rem; gap: 1rem 1.5rem; }
    .hero-top { grid-area: top; justify-content: flex-start; align-items: center; gap: 1.25rem; }
    .hero-name { font-size: 2rem; }
    .hero-actions { grid-area: actions; }
    .icon-btn { flex: 0 0 auto; padding: 0 1rem; }
    .hero-details { grid-area: details; }
    .hero-details summary { display: none; }
    .facts { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin: 0; padding-top: 1rem; border-top: 1px solid var(--line); }
}

/* Slim bar for something waiting on the Gabay (unpaid hall booking) */
.notice-bar { display: flex; align-items: center; gap: .65rem; padding: .65rem .8rem; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid #E5D3AC; color: #5E4A1F; font-size: .9rem; line-height: 1.4; }
.notice-bar > .icon { color: var(--gold-deep); width: 1.4em; height: 1.4em; }
.notice-bar b { color: var(--navy); }
.notice-bar .btn { margin-inline-start: auto; flex-shrink: 0; }

/* New-transaction form. data-type on the form drives colours and which sections show. */
.txn-form { --c: var(--ok); --c-soft: var(--ok-soft); border-top: 4px solid var(--c); padding: 1rem; display: flex; flex-direction: column; gap: 1.1rem; transition: border-color .2s; }
.txn-form[data-type="debt"] { --c: var(--danger); --c-soft: var(--danger-soft); }
.txn-form[data-type="special_donation"] { --c: var(--donation); --c-soft: var(--donation-soft); }
.txn-form[data-type="debt"] .receipt-only { display: none !important; }
.txn-form .form-head { display: flex; justify-content: space-between; align-items: baseline; }
.txn-form .form-head h2 { font-size: 1.25rem; margin: 0; }
.txn-form .form-head .date { font-size: .8rem; color: var(--muted); }
.seg { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; }
.seg legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.seg-tile {
    --t: var(--ok); --t-soft: var(--ok-soft);
    position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: .2rem;
    padding: .75rem .35rem .65rem; border: 1.5px solid var(--line-strong); border-radius: var(--radius-sm);
    background: var(--surface); cursor: pointer; margin: 0; transition: background .15s, border-color .15s;
}
.seg-tile.t-debt { --t: var(--danger); --t-soft: var(--danger-soft); }
.seg-tile.t-special_donation { --t: var(--donation); --t-soft: var(--donation-soft); }
.seg-tile input { position: absolute; opacity: 0; pointer-events: none; }
.seg-ico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--t-soft); color: var(--t); }
.seg-title { font-weight: 700; font-size: .95rem; color: var(--ink); }
.seg-hint { font-size: .7rem; color: var(--muted); line-height: 1.3; }
.seg-tile:has(input:checked) { border-color: var(--t); box-shadow: inset 0 0 0 1px var(--t); background: var(--t-soft); }
.seg-tile:has(input:checked) .seg-ico { background: var(--t); color: #fff; }
.seg-tile:has(input:checked) .seg-title { color: var(--t); }
.seg-tile:has(input:focus-visible) { outline: 3px solid rgba(197, 160, 89, .6); outline-offset: 2px; }
.form-field { display: flex; flex-direction: column; gap: .5rem; }
.flabel { font-size: .8rem; font-weight: 600; color: var(--muted); margin: 0; }
.amount-field { position: relative; }
.amount-field .form-control { height: 64px; font-size: 2rem; font-weight: 700; text-align: center; padding: 0 3rem; font-variant-numeric: tabular-nums; }
.amount-field .cur { position: absolute; inset-inline-start: 1.1rem; top: 50%; transform: translateY(-50%); font-size: 1.4rem; color: var(--muted); font-weight: 500; pointer-events: none; }
.form-hint { font-size: .85rem; color: var(--muted); line-height: 1.45; }
.form-hint b { color: var(--ink); }
.link-btn { border: 0; background: none; padding: 0; color: var(--navy); font-weight: 600; text-decoration: underline; text-decoration-color: var(--gold); text-underline-offset: 3px; font-size: inherit; }
.link-btn:hover { color: var(--gold-deep); }
.split-note { display: flex; gap: .6rem; padding: .65rem .75rem; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid #E5D3AC; font-size: .87rem; line-height: 1.5; }
.split-note > .icon { color: var(--gold-deep); margin-top: .15rem; }
.split-note > div { flex: 1; min-width: 0; }
.txn-form:not([data-type="credit"]) .credit-only { display: none !important; }
.hall-for { padding: .65rem .75rem; border-radius: var(--radius-sm); background: var(--gold-soft); border: 1px solid #E5D3AC; transition: box-shadow .2s, border-color .2s; }
.hall-for .flabel { display: flex; align-items: center; gap: .35rem; color: var(--navy); font-size: .88rem; }
.hall-for .flabel .icon { color: var(--gold-deep); }
.hall-for.is-asking { border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(197, 160, 89, .45); }
.split-editor { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; margin-top: .5rem; }
.mini-field { display: flex; flex-direction: column; gap: .2rem; font-size: .75rem; color: var(--muted); margin: 0; }
.mini-field .form-control { min-height: 42px; text-align: center; font-weight: 600; }
.mini-field .out { min-height: 42px; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 8px; font-weight: 700; font-size: 1.05rem; color: var(--ok); font-variant-numeric: tabular-nums; }
.chip-row { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip-radio {
    position: relative; display: inline-flex; align-items: center; gap: .4rem; min-height: 40px; padding: 0 .9rem; margin: 0;
    border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); color: var(--ink);
    font-weight: 500; font-size: .9rem; cursor: pointer;
}
.chip-radio input { position: absolute; opacity: 0; pointer-events: none; }
.chip-radio .icon { color: var(--gold-deep); }
.chip-radio:hover { border-color: var(--gold); }
.chip-radio:has(input:checked), .chip-radio[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.chip-radio:has(input:checked) .icon, .chip-radio[aria-pressed="true"] .icon { color: var(--gold); }
.chip-radio:has(input:focus-visible) { outline: 3px solid rgba(197, 160, 89, .6); outline-offset: 2px; }
.chip-row.presets .chip-radio { min-height: 36px; padding: 0 .75rem; font-size: .85rem; }
.sub-panel { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; padding: .75rem; border-radius: var(--radius-sm); background: #FAF8F3; border: 1px solid var(--line); }
.sub-panel .full { grid-column: 1 / -1; }
.sub-panel .mini-field .form-control { font-weight: 500; }
.parasha-row { display: flex; align-items: center; gap: .5rem; }
.parasha-row > .icon { color: var(--gold-deep); }
.parasha-row .form-select { flex: 1; min-width: 0; }
.round-btn { width: 40px; height: 40px; flex-shrink: 0; display: grid; place-items: center; border: 1px solid var(--line-strong); border-radius: 50%; background: var(--surface); color: var(--muted); }
.round-btn:hover { border-color: var(--gold); color: var(--navy); }
.desc-preview { font-size: .82rem; color: var(--muted); padding: .5rem .65rem; border-radius: 8px; background: #FAF8F3; border: 1px dashed var(--line-strong); overflow-wrap: anywhere; }
.desc-preview b { color: var(--navy); font-weight: 600; }
.switch-row { display: flex; align-items: center; gap: .65rem; padding: .6rem .75rem; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; margin: 0; }
.switch-row > .icon { color: var(--gold-deep); }
.switch-row .sw-text { flex: 1; min-width: 0; font-weight: 500; font-size: .92rem; }
.switch-row .sw-text small { display: block; font-weight: 400; color: var(--muted); font-size: .75rem; }
.switch-row input { appearance: none; width: 42px; height: 24px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; flex-shrink: 0; margin: 0; transition: background .2s; }
.switch-row input::after { content: ""; position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: right .2s; }
.switch-row input:checked { background: var(--ok); }
.switch-row input:checked::after { right: 21px; }
.switch-row input:focus-visible { outline: 3px solid rgba(197, 160, 89, .6); outline-offset: 2px; }
.switch-row.is-off { opacity: .6; cursor: not-allowed; }
.switch-row.is-off input { cursor: not-allowed; }
.report-block { display: flex; flex-direction: column; gap: .25rem; }
.report-block[hidden] { display: none; }
.report-row { display: flex; align-items: center; gap: .5rem; }
.report-row .form-select { flex: 1; min-width: 0; }
.report-feedback { font-size: .8rem; line-height: 1.4; display: flex; gap: .3rem; align-items: flex-start; }
.report-feedback:empty { display: none; }
.report-feedback.is-ok { color: var(--ok); }
.report-feedback.is-warn { color: var(--gold-deep); }
.report-feedback.is-muted { color: var(--muted); }
.txn-submit { width: 100%; min-height: 56px; background: var(--c); border-color: var(--c); color: #fff; font-weight: 700; font-size: 1.05rem; }
.txn-submit:hover, .txn-submit:focus-visible, .txn-submit:active { background: var(--c) !important; border-color: var(--c) !important; color: #fff !important; filter: brightness(1.08); }
.txn-submit[aria-busy="true"] { filter: saturate(.6); cursor: progress; pointer-events: none; }

/* History: filter tabs + compact ledger rows */
.filter-tabs { display: flex; gap: .25rem; overflow-x: auto; border-bottom: 1px solid var(--line-strong); scrollbar-width: none; margin-bottom: .75rem; }
.filter-tabs a { padding: .5rem .65rem .55rem; font-weight: 500; font-size: .9rem; color: var(--muted); text-decoration: none; white-space: nowrap; border-bottom: 2.5px solid transparent; margin-bottom: -1px; display: inline-flex; gap: .4rem; align-items: center; }
.filter-tabs a:hover { color: var(--navy); }
.filter-tabs .cnt { font-size: .72rem; background: #EFEBE2; color: var(--muted); border-radius: 999px; padding: 0 .45rem; font-variant-numeric: tabular-nums; }
.filter-tabs a[aria-current="page"] { color: var(--navy); border-bottom-color: var(--gold); font-weight: 600; }
.filter-tabs a[aria-current="page"] .cnt { background: var(--gold-soft); color: var(--gold-deep); }
.ledger { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.ledger-row { display: grid; grid-template-columns: auto 1fr auto; gap: .65rem; padding: .75rem .9rem; align-items: start; }
.ledger-row + .ledger-row { border-top: 1px solid var(--line); }
.ledger-badge { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: #F1EEE6; color: var(--muted); }
.k-debt .ledger-badge { background: var(--danger-soft); color: var(--danger); }
.k-credit .ledger-badge { background: var(--ok-soft); color: var(--ok); }
.k-special_donation .ledger-badge { background: var(--donation-soft); color: var(--donation); }
.ledger-main { min-width: 0; }
.ledger-desc { font-weight: 600; overflow-wrap: anywhere; line-height: 1.35; }
.ledger-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .25rem .5rem; margin-top: .25rem; font-size: .78rem; color: var(--muted); }
.ledger-meta > span { display: inline-flex; align-items: center; gap: .2rem; }
.ledger-meta .icon { width: 1em; height: 1em; }
.ledger-side { display: flex; flex-direction: column; align-items: flex-end; gap: .35rem; }
.ledger-amount { font-weight: 700; font-size: 1.05rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ledger-actions { display: flex; gap: .25rem; }
.icon-only { width: 36px; height: 36px; min-height: 36px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--navy); }
.icon-only:hover, .icon-only[aria-expanded="true"] { border-color: var(--gold); background: var(--gold-soft); color: var(--navy); }
.ledger .dropdown-item { display: flex; align-items: center; gap: .5rem; padding: .5rem .75rem; }
.ledger .dropdown-item .icon { color: var(--gold-deep); }
.ledger .dropdown-item.text-danger .icon { color: var(--danger); }
.ledger-empty { padding: 2rem 1rem; text-align: center; color: var(--muted); }
@media (min-width: 992px) {
    .ledger-row { grid-template-columns: auto 1fr auto auto; align-items: center; padding: .75rem 1.1rem; }
    .ledger-side { display: contents; }
    .ledger-amount { min-width: 90px; text-align: left; }
}

.panel-ok { background: var(--ok-soft); border: 1px solid #BFDCCB; border-radius: var(--radius-sm); padding: .75rem; }

/* Balance pill (lists, person header) */
.balance {
    display: inline-flex; align-items: center; gap: .25rem; border-radius: 999px;
    padding: .3rem .8rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.balance.neg { background: var(--danger-soft); color: var(--danger); }
.balance.pos { background: var(--ok-soft); color: var(--ok); }
.balance-label { font-size: .7rem; color: var(--muted); text-align: center; margin-top: 3px; }

/* Empty states */
.empty-state {
    text-align: center; padding: 2.5rem 1rem; color: var(--muted);
    background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius);
}
.empty-state .icon-badge { margin-bottom: .75rem; }
.empty-state p { margin: 0; }

/* Prayer times */
.times-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: .5rem; }
.time-tile { background: var(--gold-soft); border-radius: var(--radius-sm); padding: .5rem .25rem; text-align: center; }
.time-name { display: block; font-size: .75rem; color: var(--muted); }
.time-value { display: block; font-size: 1.15rem; font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }

/* Detail rows (label + value with an icon) */
.info-list { display: flex; flex-direction: column; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.info-list li { display: flex; align-items: center; gap: .55rem; font-size: .92rem; min-width: 0; }
.info-list li > .icon { color: var(--gold-deep); }
.info-list .info-label { color: var(--muted); }
.info-list .info-value { overflow-wrap: anywhere; }

/* Message / announcement card */
.notice-card { display: flex; align-items: flex-start; gap: .85rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow-sm); }
.notice-card .notice-body { white-space: pre-wrap; line-height: 1.65; min-width: 0; flex: 1; }

/* ---------- 8. Navigation ---------- */
.navbar { background-color: var(--navy) !important; border-bottom: 3px solid var(--gold); }
.navbar-brand {
    color: var(--gold) !important; font-family: var(--font-head); font-weight: 700; font-size: 1.35rem;
    display: inline-flex; align-items: center; gap: .45rem;
}
.navbar .nav-link { color: rgba(255, 255, 255, .78) !important; position: relative; }
.navbar .nav-link:hover, .navbar .nav-link:focus-visible { color: var(--gold) !important; }
.navbar .nav-link.active { color: #fff !important; }
.navbar .nav-link.active::after {
    content: ""; position: absolute; inset-inline: .5rem; bottom: -2px; height: 2px; background: var(--gold); border-radius: 2px;
}
.navbar .nav-greeting { color: var(--gold) !important; }
@media (max-width: 768px) { .navbar { display: none !important; } }

/* Mobile bottom bar */
.bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 1050;
    background-color: var(--navy); border-top: 3px solid var(--gold);
    height: calc(66px + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px);
    display: flex; justify-content: space-around; align-items: stretch;
}
.nav-item-mobile {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: rgba(255, 255, 255, .72); text-decoration: none; background: none; border: 0; padding: 0; font: inherit;
}
.nav-item-mobile .icon { width: 1.4rem; height: 1.4rem; }
.nav-item-mobile span { font-size: .7rem; font-weight: 600; }
.nav-item-mobile.active { color: var(--gold); }
.nav-item-mobile:focus-visible { outline: 2px solid var(--gold); outline-offset: -4px; }
@media (min-width: 769px) { .bottom-nav { display: none; } }

/* The "עוד" sheet sits above the fixed bottom bar (z-index 1050). */
.more-menu { z-index: 1060; height: auto !important; max-height: 75vh; border-radius: 16px 16px 0 0; padding-bottom: env(safe-area-inset-bottom); }
.more-menu .offcanvas-title { font-family: var(--font-head); color: var(--navy); }
.more-menu .list-group-item { padding: .9rem 1rem; font-size: 1.05rem; display: flex; align-items: center; gap: .75rem; }
.more-menu .list-group-item > .icon { color: var(--gold-deep); }
.more-menu .list-group-item.active > .icon { color: var(--gold); }
.more-menu .list-group-item.text-danger > .icon { color: var(--danger); }
.offcanvas-backdrop { z-index: 1055; }

/* Mobile quick-action tiles */
.action-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.action-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
    text-align: center; padding: 1.25rem 1rem; min-height: 100px;
    background-color: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
    text-decoration: none; color: var(--navy); box-shadow: var(--shadow-sm); transition: transform .15s, box-shadow .15s, border-color .15s;
}
.action-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--gold); color: var(--navy); }
.action-card .icon { width: 2.1rem; height: 2.1rem; stroke-width: 1.5; color: var(--gold-deep); }
.action-label { font-weight: 600; font-size: 1rem; }
.action-card.primary { background-color: var(--navy); border-color: var(--navy); color: var(--gold); }
.action-card.primary .icon { color: var(--gold); }
.action-card.primary:hover { border-color: var(--gold); color: var(--gold); }

@media (prefers-reduced-motion: reduce) {
    .stat-card, .action-card { transition: none; }
    a.stat-card:hover, .action-card:hover { transform: none; }
}

/* ==========================================================================
   Building app additions
   ========================================================================== */
.k-neutral .ledger-badge { background: var(--navy-soft); color: var(--navy); }
.apt-occupants { font-size: .85rem; color: var(--muted); overflow-wrap: anywhere; }
.balance.zero { background: #F1EEE6; color: var(--muted); }
.toolbar { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: 1rem; }
.toolbar .form-control, .toolbar .form-select { width: auto; flex: 1 1 160px; }
.radio-tiles > div { display: flex; flex-wrap: wrap; gap: .5rem; }
.radio-tiles > div > div { margin: 0; }
.radio-tiles input { position: absolute; opacity: 0; pointer-events: none; }
.radio-tiles label {
    position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 .9rem; margin: 0;
    border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); cursor: pointer; font-weight: 500;
}
.radio-tiles label:has(input:checked) { background: var(--navy); border-color: var(--navy); color: #fff; }
.radio-tiles label:has(input:focus-visible) { outline: 3px solid rgba(197, 160, 89, .6); outline-offset: 2px; }
.progress { height: .6rem; background: #EFEBE2; }
.progress-bar { background: var(--navy); }
.progress-bar.over { background: var(--danger); }
.table-money td, .table-money th { white-space: nowrap; }
.table-money .num { text-align: left; font-variant-numeric: tabular-nums; }
.occupant-card { display: flex; align-items: flex-start; gap: .75rem; padding: .75rem 0; }
.occupant-card + .occupant-card { border-top: 1px solid var(--line); }
.occupant-card .who { flex: 1; min-width: 0; }
.occupant-actions { display: flex; flex-wrap: wrap; gap: .35rem; }
.portal-card { display: flex; flex-direction: column; gap: .75rem; }
.portal-card .big-balance { font-size: 2.1rem; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
@media print {
    .navbar, .bottom-nav, .no-print, .alert-flash { display: none !important; }
    body { background: #fff; padding: 0; }
    .card { box-shadow: none; }
}

[hidden] { display: none !important; }
