:root {
    --de-primary: #6d28d9;
    --de-primary-dark: #5b21b6;
    --de-primary-soft: #f3efff;
    --de-sidebar: #1e1b2e;
    --de-sidebar-hover: #2b2740;
    --de-sidebar-text: #b8b4cc;
    --de-bg: #f5f6fa;
    --de-border: #e8e8ef;
    --de-text: #1f2130;
    --de-muted: #6b7086;
    --sidebar-w: 256px;
    --bs-primary: #6d28d9;
    --bs-primary-rgb: 109, 40, 217;
    --bs-link-color: #6d28d9;
    --bs-link-hover-color: #5b21b6;
    --bs-link-color-rgb: 109, 40, 217;
}

body { font-family: 'Inter', system-ui, sans-serif; background: var(--de-bg); color: var(--de-text); font-size: .9rem; }
a { text-decoration: none; }
.btn-primary { --bs-btn-bg: var(--de-primary); --bs-btn-border-color: var(--de-primary); --bs-btn-hover-bg: var(--de-primary-dark); --bs-btn-hover-border-color: var(--de-primary-dark); --bs-btn-active-bg: var(--de-primary-dark); --bs-btn-disabled-bg: var(--de-primary); --bs-btn-disabled-border-color: var(--de-primary); }
.btn-outline-primary { --bs-btn-color: var(--de-primary); --bs-btn-border-color: var(--de-primary); --bs-btn-hover-bg: var(--de-primary); --bs-btn-hover-border-color: var(--de-primary); --bs-btn-active-bg: var(--de-primary); }
.text-primary { color: var(--de-primary) !important; }
.bg-primary { background-color: var(--de-primary) !important; }
.bg-primary-soft { background: var(--de-primary-soft) !important; }
.form-control:focus, .form-select:focus { border-color: #a78bfa; box-shadow: 0 0 0 .2rem rgba(109, 40, 217, .15); }
.form-check-input:checked { background-color: var(--de-primary); border-color: var(--de-primary); }
.form-label { font-weight: 500; font-size: .82rem; color: #3f4254; margin-bottom: .3rem; }
.form-label.required::after { content: ' *'; color: #dc3545; }
.page-link { color: var(--de-primary); }
.active > .page-link { background: var(--de-primary); border-color: var(--de-primary); }
.nav-tabs .nav-link { color: var(--de-muted); font-weight: 500; border: 0; border-bottom: 2px solid transparent; }
.nav-tabs .nav-link.active { color: var(--de-primary); border-bottom-color: var(--de-primary); background: transparent; }
.nav-tabs { border-bottom: 1px solid var(--de-border); }

/* ── Shell ─────────────────────────────── */
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w); background: var(--de-sidebar); z-index: 1040; display: flex; flex-direction: column; transition: transform .25s; }
.sidebar-brand { height: 64px; display: flex; align-items: center; padding: 0 1.5rem; color: #fff; font-weight: 700; font-size: 1.25rem; letter-spacing: -.01em; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar-nav { overflow-y: auto; flex: 1; padding: .75rem .75rem 1.5rem; scrollbar-width: thin; scrollbar-color: #3a3550 transparent; }
.sidebar-nav .nav-section { font-size: .68rem; text-transform: uppercase; letter-spacing: .08em; color: #6f6a88; padding: 1rem .75rem .4rem; font-weight: 600; }
.sidebar-nav .nav-link { color: var(--de-sidebar-text); display: flex; align-items: center; gap: .7rem; padding: .55rem .75rem; border-radius: 8px; font-weight: 500; margin-bottom: 2px; }
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 1.2rem; text-align: center; }
.sidebar-nav .nav-link:hover { background: var(--de-sidebar-hover); color: #fff; }
.sidebar-nav .nav-link.active { background: var(--de-primary); color: #fff; }
.sidebar-nav .nav-link .badge { margin-left: auto; }
.main { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--de-border); display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem; position: sticky; top: 0; z-index: 1030; }
.topbar .icon-btn { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--de-muted); position: relative; border: 0; background: transparent; }
.topbar .icon-btn:hover { background: var(--de-bg); color: var(--de-text); }
.topbar .dot { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; border-radius: 8px; background: #ef4444; color: #fff; font-size: .62rem; display: grid; place-items: center; padding: 0 3px; }
.content { padding: 1.5rem; flex: 1; }
.avatar { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.avatar-sm { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }
.avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; }
.sidebar-backdrop { display: none; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    body.sidebar-open .sidebar { transform: none; }
    body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 1035; }
    .main { margin-left: 0; }
    .content { padding: 1rem; }
}

/* ── Components ─────────────────────────────── */
.page-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .75rem; margin-bottom: 1.25rem; }
.page-header h1 { font-size: 1.35rem; font-weight: 700; margin: 0; }
.page-header .breadcrumb { font-size: .78rem; margin: .15rem 0 0; }
.card { border: 1px solid var(--de-border); border-radius: 12px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.card-header { background: #fff; border-bottom: 1px solid var(--de-border); padding: .85rem 1.1rem; font-weight: 600; border-radius: 12px 12px 0 0 !important; display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card-body { padding: 1.1rem; }
.stat-card { padding: 1.1rem; display: flex; gap: .9rem; align-items: center; height: 100%; }
.stat-card .stat-icon { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 1.3rem; flex-shrink: 0; }
.stat-card .stat-value { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.stat-card .stat-label { color: var(--de-muted); font-size: .78rem; font-weight: 500; }
.soft-primary { background: #f3efff; color: #6d28d9; }
.soft-success { background: #e8f8ef; color: #16a34a; }
.soft-warning { background: #fff6e5; color: #d97706; }
.soft-danger { background: #fdecec; color: #dc2626; }
.soft-info { background: #e8f4fd; color: #0284c7; }
.soft-secondary { background: #f1f2f6; color: #4b5563; }
.soft-pink { background: #fdeef6; color: #db2777; }
.table { --bs-table-hover-bg: #faf9ff; margin-bottom: 0; }
.table > :not(caption) > * > * { padding: .7rem .9rem; vertical-align: middle; }
.table thead th { background: #fafafc; color: var(--de-muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; border-bottom-width: 1px; white-space: nowrap; }
.badge { font-weight: 600; padding: .38em .65em; border-radius: 6px; }
.filter-bar { background: #fff; border: 1px solid var(--de-border); border-radius: 12px; padding: .85rem; margin-bottom: 1rem; }
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--de-muted); }
.empty-state i { font-size: 2.5rem; opacity: .4; display: block; margin-bottom: .5rem; }
.detail-list dt { color: var(--de-muted); font-weight: 500; font-size: .78rem; }
.detail-list dd { margin-bottom: .8rem; font-weight: 500; }
.timeline { list-style: none; padding: 0; margin: 0; position: relative; }
.timeline li { position: relative; padding: 0 0 1rem 1.5rem; }
.timeline li::before { content: ''; position: absolute; left: 5px; top: 6px; bottom: -6px; width: 2px; background: var(--de-border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ''; position: absolute; left: 0; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--de-primary); }
.progress { height: 6px; border-radius: 3px; }
.progress-bar { background: var(--de-primary); }
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-hero { background: linear-gradient(135deg, #1e1b2e 0%, #4c1d95 60%, #be185d 130%); color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 4rem; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
@media (max-width: 767.98px) { .login-page { grid-template-columns: 1fr; } .login-hero { display: none; } }
.att-grid td, .att-grid th { padding: .35rem !important; text-align: center; font-size: .75rem; }
.att-grid .att-P { background: #e8f8ef; color: #16a34a; font-weight: 600; }
.att-grid .att-H { background: #fff6e5; color: #d97706; font-weight: 600; }
.att-grid .att-A { background: #fdecec; color: #dc2626; font-weight: 600; }
.att-grid .att-L { background: #e8f4fd; color: #0284c7; font-weight: 600; }
.att-grid .att-S { background: #f5f5f7; color: #aaa; }
.notif-item.unread { background: #faf8ff; }

/* ── Validation & confirm popup ─────────────── */
.invalid-feedback[data-validation-message] { font-size: .78rem; margin-top: .3rem; }
.ts-wrapper.is-invalid { border-color: var(--bs-form-invalid-border-color) !important; }
.ts-wrapper.focus { border-color: #a78bfa; box-shadow: 0 0 0 .2rem rgba(109, 40, 217, .15); }
.input-group .form-control.is-invalid { z-index: 3; }
.confirm-modal { border: 0; border-radius: 16px; }
.confirm-icon { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; margin: 0 auto 1rem; }

/* ── Pagination ─────────────── */
.app-pagination { display: flex; align-items: center; flex-wrap: wrap; gap: .75rem 1.25rem; margin-top: 1rem; }
.app-pagination-info { font-size: .82rem; color: var(--de-muted); margin-right: auto; }
.app-pagination-size { display: flex; align-items: center; gap: .4rem; }
.app-pagination-size .form-select { width: auto; min-width: 72px; }
.app-pagination .pagination { flex-wrap: wrap; gap: 4px; }
.app-pagination .page-link { min-width: 34px; height: 34px; display: grid; place-items: center; padding: 0 .6rem; border-radius: 8px !important; border-color: var(--de-border); color: var(--de-text); font-weight: 500; }
.app-pagination .page-link:hover { background: var(--de-primary-soft); color: var(--de-primary); }
.app-pagination .page-link svg { width: 1em; height: 1em; } /* safety net if a vendor view with SVG ever slips in */
.app-pagination .active > .page-link { background: var(--de-primary); border-color: var(--de-primary); color: #fff; }
.app-pagination .disabled > .page-link { background: transparent; color: #c2c5d1; }
@media (max-width: 575.98px) { .app-pagination-info { width: 100%; margin-right: 0; } }

/* ── Location picker ─────────────── */
.location-picker { position: relative; border: 1px solid var(--de-border); border-radius: 12px; overflow: hidden; }
.location-picker-map { height: 340px; z-index: 0; }
.location-picker-search { position: absolute; top: 10px; left: 54px; right: 10px; max-width: 420px; z-index: 500; }
.location-picker-search .list-group { max-height: 240px; overflow-y: auto; }
.event-map { height: 220px; border-radius: 10px; border: 1px solid var(--de-border); z-index: 0; }
@media (max-width: 575.98px) { .location-picker-map { height: 280px; } }

.one-time { color: var(--de-muted); font-size: .75rem; }

/* ── Staff portal ─────────────── */
.checkin-card { background: linear-gradient(135deg, #4c1d95, #6d28d9); color: #fff; border: 0; }
