/* ──────────────────────────────────────────────────────────────────────────
   Church Manager admin panel.
   One stylesheet, loaded by _Layout. Follows the StaffManagement.Admin shell
   (fixed sidebar + topbar + content) so the two products feel related, with a
   warmer palette: an attendance ERP and a church office are different rooms.
   ────────────────────────────────────────────────────────────────────────── */

:root {
    --sidebar-bg: #141b2d;
    --sidebar-w: 256px;
    --accent: #7c5cff;
    --accent-dark: #5b3fd6;
    --accent-light: #a68cff;
    --gold: #d9a227;
    --topbar-h: 58px;
    --radius: 12px;
    --ink: #1e293b;
    --muted: #64748b;
    --line: #e8edf3;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: 'Inter', 'Segoe UI', sans-serif;
    background: #f4f6fb;
    color: var(--ink);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-dark); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
    position: fixed; inset: 0 auto 0 0; width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex; flex-direction: column; z-index: 1000;
    transition: transform .25s; overflow: hidden;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 11px;
    padding: 18px 18px 15px; border-bottom: 1px solid rgba(255,255,255,.07);
    text-decoration: none; flex-shrink: 0;
}
.sidebar-brand .brand-icon {
    width: 38px; height: 38px; border-radius: 11px; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #b07cff);
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 17px;
    box-shadow: 0 4px 12px rgba(124,92,255,.38);
}
.sidebar-brand .brand-logo {
    width: 38px; height: 38px; border-radius: 10px; object-fit: cover; flex-shrink: 0;
    background: #fff;
}
.sidebar-brand .brand-wrap { min-width: 0; }
.sidebar-brand .brand-text {
    font-weight: 700; font-size: 14px; color: #f1f5f9; letter-spacing: .2px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-brand .brand-sub { font-size: 10.5px; color: #7b89a1; margin-top: 1px; }

.sidebar-nav {
    flex: 1; overflow-y: auto; padding: 8px 0 16px;
    scrollbar-width: thin; scrollbar-color: #28334a transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: #28334a; border-radius: 99px; }

.nav-section-title {
    font-size: 9.5px; font-weight: 700; letter-spacing: 1.4px;
    color: #3c4a63; text-transform: uppercase; padding: 15px 20px 5px;
}
.sidebar-nav a {
    display: flex; align-items: center; gap: 11px; margin: 1px 9px;
    padding: 8px 12px; color: #97a3b8; text-decoration: none;
    font-size: 12.8px; font-weight: 500; border-radius: 8px;
    border-left: 3px solid transparent; transition: all .15s;
}
.sidebar-nav a:hover { color: #e4eaf3; background: rgba(255,255,255,.06); }
.sidebar-nav a.active {
    color: #fff; background: rgba(124,92,255,.2); border-left-color: var(--accent);
}
.sidebar-nav a .nav-icon { width: 17px; text-align: center; font-size: 13px; flex-shrink: 0; }
.badge-pill {
    margin-left: auto; background: #ef4444; color: #fff;
    border-radius: 99px; font-size: 10px; padding: 2px 7px; font-weight: 600;
}

.sidebar-footer { padding: 13px 15px; border-top: 1px solid rgba(255,255,255,.07); flex-shrink: 0; }
.user-info-wrap { display: flex; align-items: center; gap: 10px; }
.user-avatar {
    width: 35px; height: 35px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent), #b07cff);
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 14px;
}
.user-name { color: #e2e8f0; font-size: 12.5px; font-weight: 600; }
.user-role { color: #6f7d94; font-size: 10.5px; margin-top: 1px; }
.icon-btn-dark {
    width: 32px; height: 32px; border-radius: 8px;
    background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1);
    color: #97a3b8; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.icon-btn-dark:hover { background: rgba(239,68,68,.18); color: #fecaca; border-color: rgba(239,68,68,.3); }
.min-w-0 { min-width: 0; }

/* ── Topbar ──────────────────────────────────────────────────────────────── */
#topbar {
    position: fixed; top: 0; left: var(--sidebar-w); right: 0; height: var(--topbar-h);
    background: rgba(255,255,255,.95); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
    display: flex; align-items: center; padding: 0 22px; z-index: 999; gap: 9px;
}
#topbar .page-title { font-size: 15px; font-weight: 600; color: #0f172a; flex: 1; }
.topbar-btn {
    width: 35px; height: 35px; border-radius: 9px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    background: #f8fafc; border: 1px solid var(--line);
    color: var(--muted); cursor: pointer; text-decoration: none;
    transition: all .15s; position: relative;
}
.topbar-btn:hover { background: var(--accent); color: #fff; border-color: var(--accent); }
.topbar-pill {
    display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
    background: linear-gradient(135deg, var(--gold), #b9871c);
    color: #fff; border-radius: 99px; padding: 5px 13px 5px 10px;
    font-size: 11.5px; font-weight: 600; text-decoration: none;
}
.topbar-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #fff; opacity: .7; }
.pending-badge {
    position: absolute; top: 5px; right: 5px; width: 8px; height: 8px;
    background: #ef4444; border-radius: 50%; border: 1.5px solid #fff;
}

/* ── Content ─────────────────────────────────────────────────────────────── */
#main-content {
    margin-left: var(--sidebar-w); margin-top: var(--topbar-h);
    padding: 22px 24px 48px; min-height: calc(100vh - var(--topbar-h));
}
.page-header {
    display: flex; align-items: flex-start; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 12px;
}
.page-header h1 { font-size: 21px; font-weight: 700; color: #0f172a; margin: 0; }
.page-header .sub { font-size: 12.8px; color: var(--muted); margin-top: 3px; }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.stat-card {
    background: #fff; border-radius: var(--radius); padding: 18px;
    box-shadow: 0 1px 3px rgba(15,23,42,.05), 0 0 0 1px rgba(15,23,42,.04);
    transition: box-shadow .2s, transform .2s; height: 100%;
}
.stat-card:hover { box-shadow: 0 4px 16px rgba(15,23,42,.09); transform: translateY(-1px); }
.stat-card .stat-icon {
    width: 42px; height: 42px; border-radius: 11px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 12px;
}
.stat-card .stat-val { font-size: 25px; font-weight: 700; color: #0f172a; letter-spacing: -.5px; line-height: 1.1; }
.stat-card .stat-lbl { font-size: 11.8px; color: #94a3b8; margin-top: 3px; font-weight: 500; }
.stat-card .stat-sub { font-size: 11.8px; color: var(--muted); margin-top: 7px; }

.content-card {
    background: #fff; border-radius: var(--radius); overflow: hidden;
    box-shadow: 0 1px 3px rgba(15,23,42,.05), 0 0 0 1px rgba(15,23,42,.04);
}
.card-header-custom {
    padding: 15px 19px; border-bottom: 1px solid #f1f5f9;
    display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.card-header-custom h5 { margin: 0; font-size: 13.5px; font-weight: 600; color: #0f172a; }
.card-body-custom { padding: 19px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
.table-custom { width: 100%; border-collapse: collapse; }
.table-custom th {
    font-size: 10.5px; font-weight: 700; letter-spacing: .7px; text-transform: uppercase;
    color: #94a3b8; padding: 10px 15px; background: #f8fafc;
    border-bottom: 1px solid #f1f5f9; white-space: nowrap; text-align: left;
}
.table-custom td {
    padding: 12px 15px; font-size: 13px; color: #334155;
    border-bottom: 1px solid #f8fafc; vertical-align: middle;
}
.table-custom tr:last-child td { border-bottom: none; }
.table-custom tbody tr:hover td { background: #fafbff; }
.table-custom .num { text-align: right; font-variant-numeric: tabular-nums; }

.empty-state { padding: 46px 20px; text-align: center; color: #94a3b8; }
.empty-state i { font-size: 30px; opacity: .45; display: block; margin-bottom: 12px; }
.empty-state p { font-size: 13px; margin: 0; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge-status {
    display: inline-flex; align-items: center; gap: 5px;
    padding: 3px 9px; border-radius: 99px; font-size: 10.8px; font-weight: 600; white-space: nowrap;
}
.badge-present  { background: #dcfce7; color: #16a34a; }
.badge-absent   { background: #fee2e2; color: #dc2626; }
.badge-late     { background: #fef9c3; color: #ca8a04; }
.badge-pending  { background: #fff7ed; color: #d97706; }
.badge-approved { background: #dcfce7; color: #16a34a; }
.badge-declined { background: #fee2e2; color: #dc2626; }
.badge-soft     { background: #eef2ff; color: #4338ca; }
.badge-muted    { background: #f1f5f9; color: #64748b; }

/* ── Avatars ─────────────────────────────────────────────────────────────── */
.avatar {
    width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
    background: #eef2ff; flex-shrink: 0;
}
.avatar-initial {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
    background: linear-gradient(135deg, var(--accent-light), var(--accent));
    color: #fff; display: flex; align-items: center; justify-content: center;
    font-weight: 600; font-size: 13.5px;
}
.avatar-lg { width: 76px; height: 76px; font-size: 27px; }
.person-cell { display: flex; align-items: center; gap: 10px; }
.person-cell .name { font-weight: 600; font-size: 13px; color: #1e293b; }
.person-cell .meta { font-size: 11.5px; color: #94a3b8; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-label-sm {
    font-size: 10.8px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase;
    color: #475569; display: block; margin-bottom: 5px;
}
.form-control, .form-select {
    border-radius: 9px; border: 1.5px solid var(--line);
    font-size: 13.2px; padding: 9px 12px; font-family: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.form-control:focus, .form-select:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(124,92,255,.15); outline: none;
}
.form-control-sm, .form-select-sm { font-size: 12.8px; padding: 7px 10px; }
.form-text { font-size: 11.5px; color: #94a3b8; }

.btn-accent {
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    color: #fff; border: none; border-radius: 9px; padding: 9px 18px;
    font-size: 13.2px; font-weight: 600; cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    text-decoration: none; transition: all .15s; box-shadow: 0 2px 8px rgba(124,92,255,.3);
}
.btn-accent:hover { background: linear-gradient(135deg, var(--accent-dark), #4527b8); color: #fff; transform: translateY(-1px); }
.btn-accent:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.btn-outline-soft {
    background: #f8fafc; color: var(--muted); border: 1.5px solid var(--line);
    border-radius: 9px; padding: 8px 16px; font-size: 12.8px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
    font-family: inherit; font-weight: 500; transition: all .15s;
}
.btn-outline-soft:hover { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }
.btn-danger-soft {
    background: #fff1f2; color: #be123c; border: 1.5px solid #fecdd3;
    border-radius: 9px; padding: 8px 16px; font-size: 12.8px; cursor: pointer;
    display: inline-flex; align-items: center; gap: 6px; text-decoration: none;
    font-family: inherit; font-weight: 500;
}
.btn-danger-soft:hover { background: #ffe4e6; color: #9f1239; }
.btn-icon {
    width: 32px; height: 32px; padding: 0; border-radius: 8px;
    display: inline-flex; align-items: center; justify-content: center;
    background: #f8fafc; border: 1.5px solid var(--line); color: var(--muted);
    cursor: pointer; text-decoration: none;
}
.btn-icon:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert-soft-success, .alert-soft-danger, .alert-soft-warning, .alert-soft-info {
    border-radius: 10px; padding: 12px 15px; font-size: 13.2px;
    display: flex; align-items: flex-start; gap: 9px;
}
.alert-soft-success { background: #f0fdf4; border: 1px solid #bbf7d0; color: #15803d; }
.alert-soft-danger  { background: #fff1f2; border: 1px solid #fecdd3; color: #be123c; }
.alert-soft-warning { background: #fffbeb; border: 1px solid #fde68a; color: #92400e; }
.alert-soft-info    { background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; }

/* ── Misc ────────────────────────────────────────────────────────────────── */
.progress-bar-custom { height: 6px; border-radius: 99px; background: #e8edf3; overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 99px; transition: width .5s ease; }

.chip {
    display: inline-flex; align-items: center; gap: 5px;
    background: #f1f5f9; color: #475569; border-radius: 99px;
    padding: 3px 10px; font-size: 11.5px; font-weight: 500;
}
.code-pill {
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    background: #0f172a; color: #a7f3d0; border-radius: 7px;
    padding: 4px 10px; font-size: 14px; letter-spacing: 2px; font-weight: 600;
    display: inline-block;
}

/* Bar chart drawn from divs: no chart library, no CDN, no JS. */
.bar-chart { display: flex; align-items: flex-end; gap: 7px; height: 150px; padding-top: 10px; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 5px; }
.bar-chart .bar {
    width: 100%; max-width: 42px; border-radius: 6px 6px 0 0;
    background: linear-gradient(180deg, var(--accent-light), var(--accent));
    min-height: 2px; position: relative;
}
.bar-chart .bar.alt { background: linear-gradient(180deg, #5eead4, #0d9488); }
.bar-chart .bar-lbl { font-size: 10px; color: #94a3b8; white-space: nowrap; }
.bar-chart .bar-val { font-size: 10.5px; font-weight: 600; color: #475569; }

.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--line); }
.timeline-item { position: relative; padding-bottom: 17px; }
.timeline-item::before {
    content: ''; position: absolute; left: -23px; top: 4px;
    width: 10px; height: 10px; border-radius: 50%;
    background: #fff; border: 2.5px solid var(--accent);
}
.timeline-item .t-title { font-size: 13px; font-weight: 600; color: #1e293b; }
.timeline-item .t-meta { font-size: 11.5px; color: #94a3b8; margin-top: 2px; }

.modal-content { border: none; border-radius: 14px; }
.modal-header { border-bottom: 1px solid #f1f5f9; padding: 16px 19px; }
.modal-title { font-size: 15px; font-weight: 650; }
.modal-body { padding: 19px; }
.modal-footer { border-top: 1px solid #f1f5f9; padding: 13px 19px; }

.card { border: none; border-radius: var(--radius); box-shadow: 0 1px 3px rgba(15,23,42,.05), 0 0 0 1px rgba(15,23,42,.04); }
.btn { border-radius: 9px; font-weight: 600; font-size: 13.2px; }
.nav-tabs { border-bottom: 1px solid var(--line); gap: 4px; }
.nav-tabs .nav-link { border: none; color: var(--muted); font-size: 13px; font-weight: 500; border-radius: 8px 8px 0 0; }
.nav-tabs .nav-link.active { color: var(--accent-dark); background: #f5f3ff; border-bottom: 2px solid var(--accent); }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-wrap {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, #2a1f52 0%, #141b2d 55%, #0d1220 100%);
}
.auth-card {
    width: 100%; max-width: 420px; background: #fff; border-radius: 18px;
    padding: 32px 30px; box-shadow: 0 24px 60px rgba(5,10,25,.45);
}
.auth-card.wide { max-width: 720px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .mark {
    width: 44px; height: 44px; border-radius: 13px;
    background: linear-gradient(135deg, var(--accent), #b07cff);
    display: flex; align-items: center; justify-content: center; color: #fff; font-size: 20px;
}
.auth-brand h1 { font-size: 19px; font-weight: 700; margin: 0; }
.auth-brand p { font-size: 12.3px; color: var(--muted); margin: 2px 0 0; }

@media (max-width: 768px) {
    #sidebar { transform: translateX(-100%); }
    #sidebar.open { transform: translateX(0); }
    #topbar { left: 0; padding: 0 14px; }
    #main-content { margin-left: 0; padding: 15px; }
}

@media print {
    #sidebar, #topbar, .page-header .btn-accent, .no-print { display: none !important; }
    #main-content { margin: 0; padding: 0; }
    body { background: #fff; }
    .content-card { box-shadow: none; border: 1px solid #ddd; }
}
