/* ?????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????
   CHURCH GUESTASSIST ??? PRO FIT & FREEZE (r410)
   ????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????? */

:root {
  --sb-width: 250px;
  --topbar-h: 64px;
  --bg-deep: #020617;
  --bg-surf: #0f172a;
  --bg-surf-2: #1e293b;
  --violet: #7c3aed;
  --violet-light: #a78bfa;
  --gold: #f59e0b;
  --rose: #ef4444;
  --tx-bright: #f8fafc;
  --tx-main: #cbd5e1;
  --tx-muted: #64748b;
  --bdr: rgba(255, 255, 255, 0.08);
  --sh-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.3), 0 10px 10px -5px rgba(0, 0, 0, 0.2);
}

/* Base Layout Lock */
html, body {
  margin: 0; padding: 0;
  height: 100%;
  background: var(--bg-deep);
  color: var(--tx-main);
  font-family: 'DM Sans', sans-serif;
  overflow: hidden; /* We scroll the main container */
}

.app-shell {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* Sidebar: Fixed left */
.sidebar {
  width: var(--sb-width);
  height: 100vh;
  background: var(--bg-surf);
  border-right: 1px solid var(--bdr);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
}

/* Main Content Wrapper */
.main-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
  position: relative;
  background: var(--bg-deep);
}

/* Topbar: Fixed at the top of main-wrap */
.topbar {
  height: var(--topbar-h);
  background: rgba(15, 23, 42, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--bdr);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  flex-shrink: 0;
  z-index: 900;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25);
}

/* Page: The actual scrolling content */
.page {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
  scrollbar-width: thin;
  scrollbar-color: var(--violet) transparent;
}

.page::-webkit-scrollbar { width: 6px; }
.page::-webkit-scrollbar-thumb { background: var(--violet); border-radius: 10px; }

/* Desktop Tweaks */
@media (min-width: 901px) {
  .sidebar { transform: none !important; }
}

/* Mobile Responsiveness */
@media (max-width: 900px) {
  .sidebar {
    position: fixed;
    left: 0;
    transform: translateX(-100%);
    width: 280px;
    box-shadow: 10px 0 50px rgba(0,0,0,0.7);
  }
  .sidebar.open { transform: translateX(0); }
  
  .sb-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
    z-index: 950;
    display: none;
    opacity: 0;
    transition: opacity 0.3s ease;
  }
  .sb-overlay.open { display: block; opacity: 1; }
  
  .page { padding: 20px; }
}

/* Component Refresh: Cards */
.card {
  background: var(--bg-surf);
  border: 1px solid var(--bdr);
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  transition: transform 0.2s ease, border-color 0.2s ease;
  overflow: hidden;
}
.card:hover { border-color: rgba(124, 58, 237, 0.3); }

.card-hdr {
  padding: 18px 24px;
  border-bottom: 1px solid var(--bdr);
  background: rgba(255,255,255,0.02);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.card-hdr h3 { margin: 0; font-size: 1rem; color: var(--tx-bright); }

.card-body { padding: 24px; }

/* Stats Refinement */
.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}
.stat-card {
  background: linear-gradient(135deg, var(--bg-surf), #1e293b);
  border: 1px solid var(--bdr);
  border-radius: 16px;
  padding: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.stat-ico {
  width: 54px; height: 54px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.stat-ico.v { background: rgba(124, 58, 237, 0.15); color: var(--violet-light); }
.stat-ico.t { background: rgba(20, 184, 166, 0.15); color: #2dd4bf; }
.stat-ico.g { background: rgba(245, 158, 11, 0.15); color: #fbbf24; }
.stat-val { font-size: 2rem; font-weight: 800; color: #fff; line-height: 1; }
.stat-lbl { font-size: 0.85rem; color: var(--tx-muted); margin-top: 4px; }

/* Button Premium Feel */
.btn {
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  border: none;
  font-size: 0.9rem;
}
.btn-primary { background: var(--violet); color: white; }
.btn-primary:hover { background: #6d28d9; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4); }

.btn-gold { background: var(--gold); color: #1e1b4b; }
.btn-gold:hover { background: #d97706; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4); }

.btn-ghost { background: transparent; border: 1px solid var(--bdr); color: var(--tx-main); }
.btn-ghost:hover { background: var(--bdr); border-color: var(--tx-muted); }

/* Forms Fit */
.fc {
  width: 100%;
  background: #0f172a;
  border: 1px solid var(--bdr);
  border-radius: 10px;
  padding: 12px 16px;
  color: white;
  outline: none;
  transition: border-color 0.2s;
}
.fc:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.1); }

/* Navigation Tighten */
.sb-item a {
  padding: 12px 16px;
  margin: 4px 12px;
  border-radius: 10px;
  color: var(--tx-muted);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: all 0.2s;
}
.sb-item a:hover { color: white; background: rgba(255,255,255,0.05); }
.sb-item.active a { background: var(--violet); color: white; box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3); }

/* Table Fit */
.tbl-wrap table { width: 100%; border-collapse: collapse; }
.tbl-wrap th { text-align: left; padding: 12px 16px; font-size: 0.75rem; text-transform: uppercase; color: var(--tx-muted); background: rgba(255,255,255,0.02); }
.tbl-wrap td { padding: 16px; border-bottom: 1px solid var(--bdr); font-size: 0.9rem; }
.tbl-wrap tr:last-child td { border-bottom: none; }


/* ── Mobile: hide COMMITTEE badge + role badge ────────── */
@media (max-width: 768px) {
  .b-tag { display: none !important; }
  .tb-role-badge { display: none !important; }
  .badge-committee { display: none !important; }
  .hide-mob { display: none !important; }
}

/* ── Desktop Full-Width Fix ─────────────────────────────── */
/* Applied: chapel-layout-fix */
.page          { max-width: 100% !important; }
.main-wrap     { max-width: 100% !important; }
.add-layout    { max-width: 100% !important; width: 100% !important; }
.form-card,
.contact-card  { max-width: 100% !important; width: 100% !important; }
