/* =====================================================================
   Jain Digambar Samaj — UI theme
   Minimal, calm, content-first. Built on Bootstrap 5.3.
   ===================================================================== */
:root {
    --brand: #9f1239;
    --brand-rgb: 159, 18, 57;
    --brand-dark: #7f0e2e;
    --accent: #f59e0b;

    --bg: #f6f6f7;
    --surface: #ffffff;
    --surface-2: #fafafa;
    --border: #ebebee;
    --border-strong: #dcdce1;
    --text: #18181b;
    --muted: #71717a;
    --faint: #a1a1aa;

    --radius-sm: 8px;
    --radius: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;
    --shadow-xs: 0 1px 2px rgba(24, 24, 27, .04);
    --shadow: 0 1px 2px rgba(24, 24, 27, .04), 0 2px 8px rgba(24, 24, 27, .04);
    --shadow-lg: 0 12px 40px rgba(24, 24, 27, .12);
    --ring: 0 0 0 4px rgba(var(--brand-rgb), .12);

    --sidebar-w: 256px;
    --sidebar-w-collapsed: 72px;
    --topbar-h: 64px;

    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-primary: var(--brand);
    --bs-primary-rgb: var(--brand-rgb);
    --bs-link-color: var(--brand);
    --bs-link-color-rgb: var(--brand-rgb);
    --bs-link-hover-color: var(--brand-dark);
    --bs-border-color: var(--border);
    --bs-border-radius: var(--radius-sm);
    --bs-font-sans-serif: "Inter", "Noto Sans Devanagari", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
[data-bs-theme="dark"] {
    --bg: #0c0c0e;
    --surface: #151518;
    --surface-2: #1b1b1f;
    --border: #26262b;
    --border-strong: #34343a;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --faint: #71717a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow-lg: 0 16px 50px rgba(0, 0, 0, .5);
    --bs-body-bg: var(--bg);
    --bs-body-color: var(--text);
    --bs-border-color: var(--border);
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body {
    background: var(--bg); color: var(--text); font-size: .9rem; line-height: 1.55;
    -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "cv11", "ss01", "ss03";
}
h1, h2, h3, h4, h5, h6, .h1, .h2, .h3, .h4, .h5, .h6 { letter-spacing: -.02em; color: var(--text); }
a { text-decoration: none; transition: color .15s; }
::selection { background: rgba(var(--brand-rgb), .15); }
.text-muted { color: var(--muted) !important; }
.fw-semibold { font-weight: 600 !important; }
.min-w-0 { min-width: 0; }
.small-caps { font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600; color: var(--faint); }
.text-brand { color: var(--brand) !important; }
hr { border-color: var(--border); opacity: 1; }
:focus-visible { outline: 2px solid rgba(var(--brand-rgb), .5); outline-offset: 2px; }
.bg-body-tertiary { background: var(--surface-2) !important; }

/* ---------- Buttons ---------- */
.btn { font-weight: 500; border-radius: 10px; padding: .5rem .95rem; font-size: .875rem; transition: all .15s ease; }
.btn-sm { border-radius: 8px; padding: .32rem .65rem; font-size: .8rem; }
.btn-lg { border-radius: 12px; padding: .7rem 1.25rem; font-size: .95rem; }
.btn-primary {
    --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand);
    --bs-btn-hover-bg: var(--brand-dark); --bs-btn-hover-border-color: var(--brand-dark);
    --bs-btn-active-bg: var(--brand-dark); --bs-btn-active-border-color: var(--brand-dark);
    --bs-btn-disabled-bg: var(--brand); --bs-btn-disabled-border-color: var(--brand);
    box-shadow: 0 1px 2px rgba(var(--brand-rgb), .25), inset 0 1px 0 rgba(255,255,255,.12);
}
.btn-outline-primary {
    --bs-btn-color: var(--brand); --bs-btn-border-color: rgba(var(--brand-rgb), .35);
    --bs-btn-hover-bg: var(--brand); --bs-btn-hover-border-color: var(--brand);
    --bs-btn-active-bg: var(--brand); --bs-btn-active-border-color: var(--brand);
}
.btn-light {
    --bs-btn-bg: var(--surface); --bs-btn-border-color: var(--border-strong); --bs-btn-color: var(--text);
    --bs-btn-hover-bg: var(--surface-2); --bs-btn-hover-border-color: var(--border-strong); --bs-btn-hover-color: var(--text);
    --bs-btn-active-bg: var(--surface-2); --bs-btn-active-border-color: var(--border-strong);
    box-shadow: var(--shadow-xs);
}
.btn-light.text-danger:hover { background: rgba(220, 38, 38, .06); border-color: rgba(220, 38, 38, .3); }
.btn-success { --bs-btn-bg: #16a34a; --bs-btn-border-color: #16a34a; --bs-btn-hover-bg: #15803d; --bs-btn-hover-border-color: #15803d; }
.btn-warning { --bs-btn-bg: #fef3c7; --bs-btn-border-color: #fde68a; --bs-btn-color: #92400e; --bs-btn-hover-bg: #fde68a; --bs-btn-hover-border-color: #fcd34d; --bs-btn-hover-color: #78350f; }
.btn-dark { --bs-btn-bg: #18181b; --bs-btn-border-color: #18181b; }
.btn-accent { background: var(--accent); color: #1c1100; border: 0; font-weight: 600; }
.btn-accent:hover { background: #d97706; color: #1c1100; }
.btn-icon { width: 36px; height: 36px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.btn-loading { position: relative; color: transparent !important; pointer-events: none; }
.btn-loading > * { visibility: hidden; }
.btn-loading::after {
    content: ""; position: absolute; inset: 0; margin: auto; width: 1rem; height: 1rem;
    border: 2px solid rgba(255,255,255,.9); border-right-color: transparent; border-radius: 50%;
    animation: spin .7s linear infinite;
}
.btn-light.btn-loading::after, .btn-outline-secondary.btn-loading::after, .btn-warning.btn-loading::after { border-color: var(--brand); border-right-color: transparent; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Forms ---------- */
.form-control, .form-select {
    border-radius: 10px; border-color: var(--border-strong); background-color: var(--surface);
    padding: .55rem .8rem; font-size: .875rem; color: var(--text); box-shadow: var(--shadow-xs);
    transition: border-color .15s, box-shadow .15s;
}
.form-control-sm, .form-select-sm { border-radius: 8px; padding: .35rem .6rem; font-size: .8rem; }
.form-control-lg, .form-select-lg { border-radius: 12px; padding: .75rem 1rem; font-size: 1rem; }
.form-control::placeholder { color: var(--faint); }
.form-control:focus, .form-select:focus { border-color: rgba(var(--brand-rgb), .6); box-shadow: var(--ring); }
.form-control:disabled { background: var(--surface-2); }
.form-control.is-invalid, .form-select.is-invalid { box-shadow: 0 0 0 4px rgba(220, 38, 38, .08); }
.form-label { font-weight: 500; font-size: .8rem; margin-bottom: .35rem; color: var(--text); }
.form-label .req { color: #dc2626; }
.form-text { font-size: .75rem; color: var(--faint); }
.form-check-input { border-color: var(--border-strong); }
.form-check-input:checked { background-color: var(--brand); border-color: var(--brand); }
.form-check-input:focus { box-shadow: var(--ring); border-color: rgba(var(--brand-rgb), .6); }
.form-switch .form-check-input { width: 2.3em; height: 1.25em; margin-top: .12em; }
.input-group-text { background: var(--surface-2); border-color: var(--border-strong); border-radius: 10px; font-size: .85rem; color: var(--muted); }
.form-control-color { height: 42px; padding: .3rem; }
.form-section-title {
    display: flex; align-items: center; gap: .6rem; font-size: .7rem; font-weight: 700; text-transform: uppercase;
    letter-spacing: .08em; color: var(--faint); margin: .75rem 0 1rem;
}
.form-section-title::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.invalid-feedback { font-size: .75rem; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-header {
    background: transparent; border-bottom: 1px solid var(--border); padding: 1rem 1.25rem; font-weight: 600;
    display: flex; align-items: center; justify-content: space-between; gap: .5rem; border-radius: var(--radius-lg) var(--radius-lg) 0 0 !important;
}
.card-header .card-title { margin: 0; font-size: .92rem; font-weight: 600; display: flex; align-items: center; }
.card-header .card-title i { width: 30px; height: 30px; border-radius: 8px; display: inline-grid; place-items: center; background: rgba(var(--brand-rgb), .07); font-size: .95rem; }
.card-body { padding: 1.25rem; }
.card-footer { border-top: 1px solid var(--border); padding: .85rem 1.25rem; border-radius: 0 0 var(--radius-lg) var(--radius-lg) !important; }
a.card { transition: border-color .15s, box-shadow .15s, transform .15s; }
a.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); }

.stat-card { display: flex; flex-direction: row; align-items: center; gap: 1rem; padding: 1.15rem 1.25rem; height: 100%; }
.stat-card .stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.25rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.45rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-card .stat-label { color: var(--muted); font-size: .78rem; margin-top: .1rem; }

.bg-soft-primary { background: rgba(var(--brand-rgb), .08) !important; color: var(--brand); }
.bg-soft-success { background: rgba(22, 163, 74, .1) !important; color: #16a34a; }
.bg-soft-warning { background: rgba(245, 158, 11, .12) !important; color: #d97706; }
.bg-soft-info    { background: rgba(14, 165, 233, .1) !important; color: #0284c7; }
.bg-soft-danger  { background: rgba(220, 38, 38, .08) !important; color: #dc2626; }
.bg-soft-purple  { background: rgba(124, 58, 237, .1) !important; color: #7c3aed; }

/* ---------- Badges ---------- */
.badge { font-weight: 600; font-size: .7rem; padding: .35em .65em; border-radius: 999px; letter-spacing: .01em; display: inline-flex; align-items: center; gap: .25em; }
.badge-soft-success   { background: rgba(22,163,74,.1);  color: #15803d; }
.badge-soft-warning   { background: rgba(245,158,11,.14); color: #b45309; }
.badge-soft-danger    { background: rgba(220,38,38,.09);  color: #b91c1c; }
.badge-soft-secondary { background: rgba(113,113,122,.12); color: #52525b; }
.badge-soft-info      { background: rgba(14,165,233,.1); color: #0369a1; }
.badge-soft-primary   { background: rgba(var(--brand-rgb),.08); color: var(--brand); }
[data-bs-theme="dark"] .badge-soft-secondary { color: #d4d4d8; }
[data-bs-theme="dark"] .badge-soft-success { color: #4ade80; }
[data-bs-theme="dark"] .badge-soft-warning { color: #fbbf24; }
[data-bs-theme="dark"] .badge-soft-danger { color: #f87171; }
[data-bs-theme="dark"] .badge-soft-info { color: #38bdf8; }

/* ---------- Avatars ---------- */
.avatar { border-radius: 50%; object-fit: cover; flex-shrink: 0; display: inline-grid; place-items: center; }
.avatar-sm { width: 32px; height: 32px; font-size: .72rem; }
.avatar-md { width: 40px; height: 40px; font-size: .82rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.05rem; }
.avatar-xl { width: 104px; height: 104px; font-size: 1.9rem; border: 4px solid var(--surface); box-shadow: var(--shadow-lg); }
.avatar-initials { background: hsl(var(--h, 340) 45% 94%); color: hsl(var(--h, 340) 45% 36%); font-weight: 600; }
[data-bs-theme="dark"] .avatar-initials { background: hsl(var(--h, 340) 30% 20%); color: hsl(var(--h, 340) 60% 75%); }

/* ---------- Panel layout ---------- */
.app-sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
    z-index: 1040; display: flex; flex-direction: column; transition: width .2s ease, transform .2s ease;
}
.app-sidebar .brand { height: var(--topbar-h); display: flex; align-items: center; gap: .7rem; padding: 0 1.1rem; color: var(--text); flex-shrink: 0; }
.brand-logo {
    width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(145deg, var(--brand), #e11d48 60%, var(--accent));
    display: grid; place-items: center; font-weight: 700; color: #fff; flex-shrink: 0; overflow: hidden; font-size: 1.05rem;
    box-shadow: 0 4px 12px rgba(var(--brand-rgb), .3);
}
.brand-logo img { width: 100%; height: 100%; object-fit: cover; }
.app-sidebar .brand-text { line-height: 1.2; overflow: hidden; white-space: nowrap; }
.app-sidebar .brand-text strong { display: block; font-size: .88rem; font-weight: 700; text-overflow: ellipsis; overflow: hidden; letter-spacing: -.01em; }
.app-sidebar .brand-text small { color: var(--faint); font-size: .72rem; }
.app-sidebar .menu { flex: 1; overflow-y: auto; padding: .5rem .75rem 1.5rem; scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.app-sidebar .menu-label { font-size: .66rem; text-transform: uppercase; letter-spacing: .1em; padding: 1.1rem .7rem .4rem; color: var(--faint); font-weight: 600; white-space: nowrap; }
.app-sidebar .menu a {
    display: flex; align-items: center; gap: .7rem; padding: .5rem .7rem; border-radius: 9px; color: var(--muted);
    font-weight: 500; font-size: .86rem; white-space: nowrap; position: relative; margin-bottom: 1px; transition: background .12s, color .12s;
}
.app-sidebar .menu a i { font-size: 1.05rem; width: 1.2rem; text-align: center; flex-shrink: 0; }
.app-sidebar .menu a:hover { background: var(--surface-2); color: var(--text); }
.app-sidebar .menu a.active { background: rgba(var(--brand-rgb), .07); color: var(--brand); font-weight: 600; }
.app-sidebar .menu a.active::before { content: ""; position: absolute; left: -.75rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--brand); }
.app-sidebar .menu a .menu-badge { margin-left: auto; background: var(--brand); color: #fff; font-size: .66rem; font-weight: 700; font-style: normal; border-radius: 999px; padding: .08rem .45rem; min-width: 20px; text-align: center; }
.app-sidebar .sidebar-footer { padding: .9rem 1rem; border-top: 1px solid var(--border); font-size: .8rem; white-space: nowrap; overflow: hidden; }
.app-sidebar .sidebar-footer a { color: var(--muted); }
.app-sidebar .sidebar-footer a:hover { color: var(--brand); }

.app-main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; transition: margin .2s ease; }
.app-topbar {
    height: var(--topbar-h); background: color-mix(in srgb, var(--surface) 82%, transparent);
    backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px);
    border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 1030;
    display: flex; align-items: center; gap: .75rem; padding: 0 1.5rem;
}
.app-topbar .topbar-btn { width: 38px; height: 38px; border-radius: 10px; display: inline-grid; place-items: center; color: var(--muted); border: 0; background: transparent; position: relative; transition: background .12s, color .12s; }
.app-topbar .topbar-btn:hover { background: var(--surface-2); color: var(--text); }
.app-topbar .topbar-btn .dot { position: absolute; top: 5px; right: 5px; min-width: 16px; height: 16px; border-radius: 8px; background: var(--brand); color: #fff; font-size: .6rem; font-weight: 700; display: grid; place-items: center; padding: 0 4px; border: 2px solid var(--surface); }
.app-topbar .company-chip { color: var(--muted); font-size: .82rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 320px; }
.app-topbar .user-menu { display: flex; align-items: center; gap: .6rem; padding: .3rem .5rem .3rem .3rem; border-radius: 12px; color: inherit; transition: background .12s; }
.app-topbar .user-menu:hover { background: var(--surface-2); }
.app-topbar .user-menu .name { font-weight: 600; font-size: .82rem; line-height: 1.15; }
.app-topbar .user-menu .role { font-size: .7rem; color: var(--faint); }
.app-content { padding: 1.75rem 1.75rem 2.5rem; flex: 1; width: 100%; max-width: 1600px; margin: 0 auto; }
.app-footer { padding: 1rem 1.75rem; color: var(--faint); font-size: .78rem; border-top: 1px solid var(--border); }

.dropdown-menu { border: 1px solid var(--border) !important; border-radius: 12px; padding: .35rem; box-shadow: var(--shadow-lg) !important; font-size: .86rem; background: var(--surface); }
.dropdown-item { border-radius: 8px; padding: .45rem .7rem; color: var(--text); }
.dropdown-item:hover, .dropdown-item:focus { background: var(--surface-2); color: var(--text); }
.dropdown-divider { border-color: var(--border); }

.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.45rem; font-weight: 700; margin: 0; letter-spacing: -.025em; }
.page-header .breadcrumb { margin: .3rem 0 0; font-size: .78rem; --bs-breadcrumb-divider: "/"; --bs-breadcrumb-divider-color: var(--faint); }
.page-header .breadcrumb a { color: var(--muted); }
.page-header .breadcrumb a:hover { color: var(--brand); }
.page-header .breadcrumb-item.active { color: var(--faint); }

.impersonate-bar { background: #18181b; color: #fafafa; font-size: .8rem; padding: .45rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.impersonate-bar .btn { background: #fff; color: #18181b; border: 0; font-size: .75rem; }

@media (min-width: 992px) {
    body.sidebar-collapsed .app-sidebar { width: var(--sidebar-w-collapsed); }
    body.sidebar-collapsed .app-main { margin-left: var(--sidebar-w-collapsed); }
    body.sidebar-collapsed .app-sidebar .brand-text,
    body.sidebar-collapsed .app-sidebar .menu-label,
    body.sidebar-collapsed .app-sidebar .menu a span,
    body.sidebar-collapsed .app-sidebar .menu-badge,
    body.sidebar-collapsed .app-sidebar .sidebar-footer { display: none; }
    body.sidebar-collapsed .app-sidebar .menu a { justify-content: center; }
    body.sidebar-collapsed .app-sidebar .brand { justify-content: center; padding: 0; }
}
@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); box-shadow: none; }
    .app-main { margin-left: 0; }
    body.sidebar-open .app-sidebar { transform: none; box-shadow: var(--shadow-lg); }
    body.sidebar-open .sidebar-backdrop { position: fixed; inset: 0; background: rgba(24,24,27,.35); backdrop-filter: blur(2px); z-index: 1035; }
    .app-content { padding: 1.1rem .9rem 1.75rem; }
    .app-topbar { padding: 0 .75rem; }
    .page-header h1 { font-size: 1.25rem; }
}

/* ---------- Tables ---------- */
.table { --bs-table-bg: transparent; --bs-table-color: var(--text); margin-bottom: 0; font-size: .86rem; }
.table > :not(caption) > * > * { padding: .8rem 1rem; border-color: var(--border); vertical-align: middle; }
.table thead th { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--faint); font-weight: 600; background: transparent; white-space: nowrap; border-bottom-width: 1px; padding-top: .7rem; padding-bottom: .7rem; }
.table tbody tr:last-child > * { border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-bg-state: var(--surface-2); }
.table-bordered > :not(caption) > * > * { border-color: var(--border); }
.person { display: flex; align-items: center; gap: .7rem; min-width: 0; }
.person .person-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person a.person-name:hover { color: var(--brand); }
.person .person-sub { font-size: .75rem; color: var(--faint); }
div.dt-container { font-size: .85rem; }
div.dt-container .dt-search input { border-radius: 10px; min-width: 260px; border-color: var(--border-strong); padding: .45rem .8rem .45rem 2.1rem; margin-left: 0 !important;
    background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%23a1a1aa' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.156a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11'/%3E%3C/svg%3E") no-repeat .75rem center; }
div.dt-container .dt-search label { display: none; }
div.dt-container .dt-length select { border-radius: 8px; padding: .3rem 2rem .3rem .6rem; min-width: 72px; margin-right: .4rem; }
div.dt-container .dt-length label { color: var(--faint); font-size: .8rem; }
div.dt-container .dt-layout-row:first-child, div.dt-container .dt-layout-row:last-child { padding: .9rem 1.1rem; margin: 0 !important; }
div.dt-container .dt-info { color: var(--faint); font-size: .8rem; }
div.dt-container .dt-paging .page-link { border-radius: 8px !important; margin: 0 2px; border: 0; font-size: .8rem; }
div.dt-processing { background: transparent !important; border: 0 !important; box-shadow: none !important; }
div.dt-processing > div:last-child > div { background: var(--brand) !important; }
table.dataTable thead > tr > th.dt-orderable-asc span.dt-column-order, table.dataTable thead > tr > th.dt-orderable-desc span.dt-column-order { opacity: .6; }
.page-link { color: var(--muted); border-color: var(--border); background: var(--surface); }
.page-link:hover { color: var(--brand); background: var(--surface-2); }
.page-item.active .page-link { background: var(--brand); border-color: var(--brand); color: #fff; }
.pagination { gap: 2px; }
.pagination .page-link { border-radius: 8px !important; }
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border); }
.filter-bar .form-select, .filter-bar .form-control { width: auto; min-width: 150px; }

.progress { background: var(--surface-2); border-radius: 999px; }
.progress-bar { border-radius: 999px; }
.progress-bar.bg-primary { background: var(--brand) !important; }

/* ---------- Tabs ---------- */
.nav-tabs-line { border-bottom: 1px solid var(--border); gap: .25rem; padding: 0 1.1rem; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.nav-tabs-line .nav-link { border: 0; border-bottom: 2px solid transparent; color: var(--muted); font-weight: 500; font-size: .85rem; padding: .85rem .6rem; white-space: nowrap; border-radius: 0; }
.nav-tabs-line .nav-link:hover { color: var(--text); }
.nav-tabs-line .nav-link.active { color: var(--text); border-bottom-color: var(--brand); background: transparent; font-weight: 600; }

/* ---------- Profile / family ---------- */
.profile-cover { height: 110px; background: radial-gradient(120% 140% at 0% 0%, rgba(var(--brand-rgb), .9), rgba(var(--brand-rgb), .55) 45%, rgba(245,158,11,.55)); }
.profile-head { margin-top: -52px; text-align: center; padding: 0 1rem 1rem; }
.info-list { list-style: none; padding: 0; margin: 0; }
.info-list li { display: flex; justify-content: space-between; gap: 1rem; padding: .55rem 0; border-bottom: 1px solid var(--border); font-size: .85rem; }
.info-list li:last-child { border-bottom: 0; }
.info-list li > span:first-child { color: var(--muted); flex-shrink: 0; }
.info-list li > span:last-child { font-weight: 500; text-align: right; word-break: break-word; }
.member-card {
    border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.1rem; background: var(--surface); height: 100%;
    display: flex; flex-direction: column; gap: .7rem; transition: border-color .15s, box-shadow .15s, transform .15s; position: relative; box-shadow: var(--shadow);
}
.member-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-lg); transform: translateY(-2px); }
button.member-card { color: var(--muted); }
button.member-card:hover { color: var(--brand); border-color: rgba(var(--brand-rgb), .4); }
.member-card .head-tag { position: absolute; top: .8rem; right: .8rem; }
.empty-state { text-align: center; padding: 3.5rem 1.5rem; color: var(--muted); font-size: .88rem; }
.empty-state i { font-size: 1.6rem; display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto .9rem; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--border); color: var(--faint); }
.empty-state h5 { font-size: 1rem; font-weight: 600; margin-bottom: .35rem; }

/* ---------- Modal ---------- */
.modal-backdrop.show { opacity: 1; background: rgba(24, 24, 27, .4); backdrop-filter: blur(3px); }
.modal-content { border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-lg); background: var(--surface); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--border); padding: 1.1rem 1.4rem; gap: .75rem; }
.modal-title { font-weight: 650; font-size: 1rem; display: flex; align-items: center; gap: .15rem; letter-spacing: -.01em; }
.modal-title > i:first-child { width: 34px; height: 34px; border-radius: 10px; display: inline-grid; place-items: center; background: rgba(var(--brand-rgb), .08); font-size: 1rem; margin-right: .6rem !important; flex-shrink: 0; }
.modal-header .btn-close { width: 32px; height: 32px; padding: 0; border-radius: 8px; background-size: 11px; opacity: .5; margin: 0 0 0 auto; }
.modal-header .btn-close:hover { opacity: 1; background-color: var(--surface-2); }
.modal-body { padding: 1.4rem; }
.modal-footer { border-top: 1px solid var(--border); background: var(--surface-2); padding: .85rem 1.4rem; gap: .5rem; }
.modal-footer > * { margin: 0; }
.modal-loading { min-height: 240px; display: grid; place-items: center; }
/* A <form> wrapping header/body/footer must behave like .modal-content's flex column so the
   body scrolls and the footer (Save button) always stays visible. */
.modal-content > form { display: flex; flex-direction: column; min-height: 0; flex: 1 1 auto; max-height: 100%; }
.modal-dialog-scrollable .modal-content > form { overflow: hidden; }
.modal-dialog-scrollable .modal-content > form > .modal-body { overflow-y: auto; }
.modal-md { --bs-modal-width: 540px; }
@media (max-width: 575.98px) {
    .modal-dialog { margin: 0; max-width: none; min-height: 100%; align-items: flex-end; }
    .modal-dialog-scrollable { height: 100%; }
    .modal-content { border-radius: var(--radius-xl) var(--radius-xl) 0 0; max-height: 94vh; border: 0; }
    .modal.fade .modal-dialog { transform: translateY(40px); }
    .modal.show .modal-dialog { transform: none; }
    .modal-body { padding: 1.1rem; }
    .modal-footer { padding: .75rem 1.1rem calc(.75rem + env(safe-area-inset-bottom)); }
    .modal-footer > .btn { flex: 1; }
}

.img-preview { width: 100%; max-height: 180px; object-fit: cover; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); }
.upload-box {
    border: 1.5px dashed var(--border-strong); border-radius: 14px; padding: 1.1rem; text-align: center; background: var(--surface-2);
    cursor: pointer; color: var(--muted); font-size: .8rem; transition: border-color .15s, background .15s, color .15s;
}
.upload-box:hover { border-color: var(--brand); color: var(--brand); background: rgba(var(--brand-rgb), .03); }

/* ---------- SweetAlert ---------- */
.swal2-popup { border-radius: var(--radius-xl) !important; font-family: var(--bs-font-sans-serif) !important; padding: 1.5rem 1.25rem !important; background: var(--surface) !important; color: var(--text) !important; }
.swal2-title { font-size: 1.15rem !important; font-weight: 650 !important; letter-spacing: -.01em; color: var(--text) !important; }
.swal2-html-container { font-size: .88rem !important; color: var(--muted) !important; }
.swal2-styled { border-radius: 10px !important; font-weight: 500 !important; font-size: .88rem !important; padding: .55rem 1.1rem !important; }
.swal2-styled.swal2-cancel { background: var(--surface) !important; color: var(--text) !important; border: 1px solid var(--border-strong) !important; }
.swal2-textarea { border-radius: 10px !important; border-color: var(--border-strong) !important; font-size: .88rem !important; box-shadow: none !important; }
.swal2-textarea:focus { box-shadow: var(--ring) !important; }
.swal2-icon { transform: scale(.8); margin: .5rem auto 0 !important; }
.swal2-toast { border-radius: 12px !important; box-shadow: var(--shadow-lg) !important; border: 1px solid var(--border) !important; padding: .7rem 1rem !important; }
.swal2-toast .swal2-title { font-size: .85rem !important; font-weight: 500 !important; }
.swal2-container { z-index: 2000 !important; }

/* ---------- Timeline ---------- */
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 1.4rem; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: -4px; width: 1px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--surface); border: 2px solid var(--brand); }

/* ---------- Lists / misc ---------- */
.list-soft { list-style: none; margin: 0; padding: 0; }
.list-soft li { padding: .7rem 0; border-bottom: 1px solid var(--border); display: flex; gap: .7rem; align-items: center; }
.list-soft li:last-child { border-bottom: 0; }
.event-item { display: flex; gap: .9rem; align-items: flex-start; padding: .8rem 0; border-bottom: 1px solid var(--border); }
.event-item:last-child { border-bottom: 0; }
.date-box { width: 52px; flex-shrink: 0; text-align: center; border-radius: 12px; overflow: hidden; border: 1px solid var(--border); background: var(--surface); }
.date-box .m { background: rgba(var(--brand-rgb), .08); color: var(--brand); font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: .2rem 0; }
.date-box .d { font-size: 1.25rem; font-weight: 700; padding: .1rem 0 .2rem; letter-spacing: -.02em; }
.alert { border-radius: var(--radius); font-size: .86rem; border: 1px solid transparent; }
.alert-light { background: var(--surface); border-color: var(--border); color: var(--muted); }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.alert-info { background: #f0f9ff; border-color: #bae6fd; color: #075985; }
.alert-danger { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
[data-bs-theme="dark"] .alert-warning { background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.25); color: #fbbf24; }
[data-bs-theme="dark"] .alert-info { background: rgba(14,165,233,.08); border-color: rgba(14,165,233,.25); color: #7dd3fc; }
[data-bs-theme="dark"] .alert-danger { background: rgba(220,38,38,.08); border-color: rgba(220,38,38,.25); color: #fca5a5; }
code { color: var(--brand); background: rgba(var(--brand-rgb), .06); padding: .1rem .35rem; border-radius: 5px; }

/* ---------- Donations ---------- */
.amount-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.amount-chip {
    border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: .38rem .85rem;
    font-size: .82rem; font-weight: 600; color: var(--text); cursor: pointer; transition: all .12s; font-variant-numeric: tabular-nums;
}
.amount-chip:hover { border-color: var(--brand); color: var(--brand); }
.amount-chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.amount-input { font-size: 1.6rem !important; font-weight: 700; letter-spacing: -.02em; padding-left: 2.4rem !important; font-variant-numeric: tabular-nums; }
.amount-wrap { position: relative; }
.amount-wrap::before { content: "₹"; position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); font-size: 1.4rem; font-weight: 600; color: var(--faint); z-index: 5; }
.qr-panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; text-align: center; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.qr-box { background: #fff; padding: .8rem; border-radius: 14px; border: 1px solid var(--border); display: inline-block; line-height: 0; box-shadow: var(--shadow); }
.qr-box canvas, .qr-box img { width: 180px !important; height: 180px !important; }
.qr-amount { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; margin-top: .75rem; font-variant-numeric: tabular-nums; }
.steps { display: flex; gap: .5rem; counter-reset: step; margin-bottom: 1.25rem; }
.steps span { flex: 1; font-size: .72rem; font-weight: 600; color: var(--faint); display: flex; align-items: center; gap: .4rem; }
.steps span::before { counter-increment: step; content: counter(step); width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-strong); font-size: .7rem; flex-shrink: 0; }
.steps span.on { color: var(--text); }
.steps span.on::before { background: var(--brand); border-color: var(--brand); color: #fff; }
.donate-hero {
    border-radius: var(--radius-xl); padding: 1.75rem; color: #fff; position: relative; overflow: hidden;
    background: radial-gradient(120% 140% at 100% 0%, rgba(245,158,11,.55), transparent 55%), linear-gradient(135deg, var(--brand-dark), var(--brand));
}
.donate-hero::after { content: "🙏"; position: absolute; right: 1.25rem; bottom: -.6rem; font-size: 5.5rem; opacity: .14; }
.donate-hero .big { font-size: 2rem; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.cause-card .cause-meta { display: flex; justify-content: space-between; font-size: .78rem; color: var(--muted); margin: .4rem 0 .35rem; }

/* =====================================================================
   Public website
   ===================================================================== */
.site-topbar { background: #18181b; color: rgba(255,255,255,.7); font-size: .78rem; padding: .45rem 0; }
.site-topbar a { color: rgba(255,255,255,.85); }
.site-topbar a:hover { color: #fff; }
.site-nav { background: color-mix(in srgb, var(--surface) 85%, transparent); backdrop-filter: saturate(180%) blur(12px); -webkit-backdrop-filter: saturate(180%) blur(12px); border-bottom: 1px solid var(--border); }
.site-nav .navbar-brand { display: flex; align-items: center; gap: .65rem; font-weight: 700; color: var(--text); font-size: 1rem; letter-spacing: -.02em; }
.site-nav .navbar-brand .brand-logo { width: 40px; height: 40px; border-radius: 12px; font-size: 1.15rem; }
.site-nav .navbar-brand small { display: block; font-weight: 500; font-size: .7rem; color: var(--faint); letter-spacing: 0; }
.site-nav .nav-link { font-weight: 500; font-size: .88rem; color: var(--muted); padding: 1.35rem .8rem !important; position: relative; }
.site-nav .nav-link.active, .site-nav .nav-link:hover, .site-nav .nav-link.show { color: var(--text); }
.site-nav .nav-link.active::after { content: ""; position: absolute; left: .8rem; right: .8rem; bottom: 0; height: 2px; background: var(--brand); border-radius: 2px 2px 0 0; }
@media (max-width: 991.98px) { .site-nav .nav-link { padding: .6rem 0 !important; } .site-nav .nav-link.active::after { display: none; } }

.hero { position: relative; }
.hero .carousel-item { height: 480px; background: #18181b; }
.hero .carousel-item img { width: 100%; height: 100%; object-fit: cover; opacity: .72; }
.hero .carousel-caption { bottom: 18%; text-align: left; left: 8%; right: 8%; }
.hero .carousel-caption h2 { font-size: clamp(1.6rem, 4vw, 2.8rem); font-weight: 700; letter-spacing: -.03em; text-shadow: 0 2px 20px rgba(0,0,0,.35); }
.hero-default {
    color: #fff; padding: 5.5rem 0 5rem; position: relative; overflow: hidden;
    background: radial-gradient(90% 120% at 100% 0%, rgba(245,158,11,.45), transparent 50%), radial-gradient(70% 90% at 0% 100%, rgba(225,29,72,.5), transparent 60%), linear-gradient(135deg, #4c0519, var(--brand-dark) 45%, var(--brand));
}
.hero-default::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 22px 22px; mask-image: linear-gradient(to bottom, #000, transparent); }
.hero-default > .container { position: relative; }
.hero-default h1 { font-weight: 700; font-size: clamp(2rem, 4.5vw, 3.3rem); letter-spacing: -.035em; line-height: 1.08; color: #fff; }
.hero-default .lead { opacity: .82; font-size: 1.08rem; max-width: 560px; }
.hero-stat { border-radius: 16px; padding: 1.1rem; text-align: center; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); backdrop-filter: blur(6px); }
.hero-stat .n { font-size: 1.7rem; font-weight: 700; letter-spacing: -.03em; }
.hero-stat .l { font-size: .75rem; opacity: .75; }
.hero-badge { display: inline-flex; align-items: center; gap: .4rem; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.2); color: #fff; border-radius: 999px; padding: .35rem .85rem; font-size: .8rem; font-weight: 500; }
@media (max-width: 767.98px) { .hero .carousel-item { height: 280px; } .hero-default { padding: 3.5rem 0; } }

.ticker { background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; overflow: hidden; }
.ticker .ticker-label { background: var(--text); color: var(--surface); font-weight: 600; padding: .65rem 1.1rem; white-space: nowrap; font-size: .78rem; z-index: 1; letter-spacing: .02em; }
.ticker .ticker-track { display: flex; gap: 3rem; white-space: nowrap; padding-left: 2rem; animation: ticker 38s linear infinite; font-size: .86rem; color: var(--muted); }
.ticker:hover .ticker-track { animation-play-state: paused; }
.ticker .ticker-track span::before { content: "●"; color: var(--brand); margin-right: .7rem; font-size: .5rem; vertical-align: middle; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(-100%); } }
@media (prefers-reduced-motion: reduce) { .ticker .ticker-track { animation: none; padding-left: 1rem; } }

.section { padding: 4rem 0; }
.section-title { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.section-title h2 { font-weight: 700; font-size: 1.55rem; margin: 0; letter-spacing: -.03em; }
.section-title p { margin: .3rem 0 0; color: var(--muted); font-size: .9rem; }
.eyebrow { font-size: .72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .1em; color: var(--brand); margin-bottom: .35rem; }
.page-hero { padding: 2.75rem 0 2rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.page-hero h1 { font-weight: 700; font-size: 1.9rem; letter-spacing: -.03em; margin-bottom: .35rem; }

.news-card { height: 100%; overflow: hidden; transition: transform .2s, box-shadow .2s, border-color .2s; }
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); border-color: var(--border-strong); }
.news-card .news-img { aspect-ratio: 16/10; object-fit: cover; width: 100%; background: linear-gradient(135deg, rgba(var(--brand-rgb),.08), rgba(245,158,11,.12)); display: grid; place-items: center; color: rgba(var(--brand-rgb), .5); font-size: 1.8rem; border-bottom: 1px solid var(--border); }
.news-card .card-title a { color: var(--text); }
.news-card .card-title a:hover { color: var(--brand); }
.news-meta { font-size: .75rem; color: var(--faint); display: flex; gap: .9rem; flex-wrap: wrap; }

.cta { background: linear-gradient(135deg, #18181b, #27272a); color: #fff; border-radius: var(--radius-xl); padding: 2.5rem; position: relative; overflow: hidden; }
.cta::before { content: ""; position: absolute; width: 380px; height: 380px; right: -120px; top: -160px; border-radius: 50%; background: radial-gradient(rgba(var(--brand-rgb), .6), transparent 70%); }
.cta > * { position: relative; }
.cta h3 { color: #fff; }

.article-body { font-size: 1.02rem; line-height: 1.85; color: var(--text); }
.article-body p { margin-bottom: 1.15rem; }
.article-cover { width: 100%; max-height: 460px; object-fit: cover; border-radius: var(--radius-lg); border: 1px solid var(--border); }

.site-footer { background: #0c0c0e; color: #a1a1aa; padding: 3.5rem 0 1.25rem; font-size: .86rem; }
.site-footer h6 { color: #fafafa; font-weight: 600; margin-bottom: 1rem; font-size: .85rem; }
.site-footer a { color: #a1a1aa; }
.site-footer a:hover { color: #fff; }
.site-footer .copy { border-top: 1px solid rgba(255,255,255,.08); margin-top: 2.5rem; padding-top: 1.25rem; font-size: .78rem; }

/* ---------- Auth ---------- */
.auth-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--surface); }
.auth-side {
    color: #fff; padding: 3rem; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
    background: radial-gradient(90% 100% at 100% 0%, rgba(245,158,11,.45), transparent 55%), radial-gradient(80% 80% at 0% 100%, rgba(225,29,72,.45), transparent 60%), linear-gradient(135deg, #4c0519, var(--brand));
}
.auth-side::before { content: ""; position: absolute; inset: 0; background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px); background-size: 22px 22px; }
.auth-side > * { position: relative; }
.auth-side h1 { font-weight: 700; font-size: 2.3rem; letter-spacing: -.035em; color: #fff; }
.auth-side .feature { display: flex; gap: .85rem; align-items: flex-start; margin-bottom: 1.1rem; }
.auth-side .feature i { background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.18); border-radius: 12px; width: 40px; height: 40px; display: grid; place-items: center; flex-shrink: 0; }
.auth-form { display: flex; align-items: center; justify-content: center; padding: 2.5rem 1.25rem; }
.auth-form .inner { width: 100%; max-width: 420px; }
.auth-form .inner.wide { max-width: 580px; }
.auth-form h2 { letter-spacing: -.03em; }
@media (max-width: 991.98px) { .auth-wrap { grid-template-columns: 1fr; } .auth-side { display: none; } }

/* ---------- Error page ---------- */
.error-page { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 2rem; }
.error-page .code { font-size: 5.5rem; font-weight: 800; letter-spacing: -.05em; line-height: 1; background: linear-gradient(135deg, var(--brand), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------- Print ---------- */
@media print {
    .app-sidebar, .app-topbar, .app-footer, .no-print, .impersonate-bar { display: none !important; }
    .app-main { margin: 0 !important; }
    .app-content { padding: 0 !important; }
    body { background: #fff !important; }
    .card { box-shadow: none !important; }
}

/* Dark mode: brand-coloured text needs a lighter tint to stay readable on dark surfaces. */
[data-bs-theme="dark"] .app-sidebar .menu a.active,
[data-bs-theme="dark"] .badge-soft-primary,
[data-bs-theme="dark"] .nav-tabs-line .nav-link.active,
[data-bs-theme="dark"] a:not(.btn):not(.dropdown-item):not(.nav-link):not(.card):not(.text-reset):not(.person-name) { color: #fb7185; }
[data-bs-theme="dark"] .app-sidebar .menu a.active { background: rgba(251, 113, 133, .1); }
[data-bs-theme="dark"] .app-sidebar .menu a.active::before { background: #fb7185; }
