* { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --primary: #6b2c91;
  --primary-dark: #4a1f66;
  --primary-light: #f3ebf7;
  --accent: #d4a017;
  --bg: #f7f6f3;
  --surface: #ffffff;
  --text: #2c2c2c;
  --text-muted: #6b6b6b;
  --border: #e5e3df;
  --success: #2e7d32;
  --danger: #c62828;
  --warning: #ef6c00;
  --shadow: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}
.app {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  background: linear-gradient(180deg, var(--primary-dark), var(--primary));
  color: white;
  display: flex;
  flex-direction: column;
  padding: 20px 0;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 16px;
}
.brand-logo {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  background: var(--accent);
  color: var(--primary-dark);
  border-radius: 10px;
  font-size: 22px;
  font-weight: bold;
}
.brand-text h1 { font-size: 16px; font-weight: 600; }
.brand-text p { font-size: 11px; opacity: 0.8; }
.nav { display: flex; flex-direction: column; padding: 0 12px; flex: 1; gap: 2px; }
.nav-item {
  background: transparent;
  color: rgba(255,255,255,0.88);
  border: none;
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  transition: background 0.15s;
}
.nav-item:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-item.active { background: rgba(255,255,255,0.18); color: white; font-weight: 500; }
.sidebar-footer { padding: 16px 20px; font-size: 11px; opacity: 0.6; }

/* Main */
.main { display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 28px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.topbar h2 { font-size: 20px; font-weight: 600; }
.topbar-actions { color: var(--text-muted); font-size: 13px; }
.view-container { padding: 24px 28px; overflow-y: auto; flex: 1; }

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.card-title { font-size: 16px; font-weight: 600; }

/* Dashboard stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--primary);
}
.stat-card.accent::before { background: var(--accent); }
.stat-card.success::before { background: var(--success); }
.stat-card.danger::before { background: var(--danger); }
.stat-card.warning::before { background: var(--warning); }
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 6px; }
.stat-value { font-size: 26px; font-weight: 700; color: var(--text); }
.stat-sub { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #fafaf8; font-weight: 600; color: var(--text-muted); text-transform: uppercase; font-size: 11px; letter-spacing: 0.5px; }
tbody tr:hover { background: #fafafa; }
tbody tr:last-child td { border-bottom: none; }
.empty-row { text-align: center; color: var(--text-muted); padding: 40px 20px !important; font-style: italic; }

/* Buttons */
.btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #ececea; color: var(--text); }
.btn-secondary:hover { background: #dedcd8; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { background: #a01f1f; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-icon { padding: 6px 8px; }

.action-cell { display: flex; gap: 6px; }

/* Forms */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid.single { grid-template-columns: 1fr; }
.form-group { display: flex; flex-direction: column; }
.form-group.full { grid-column: 1 / -1; }
label { font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.3px; }
input, select, textarea {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  font-family: inherit;
  background: white;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
textarea { resize: vertical; min-height: 70px; }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; justify-content: center; align-items: center;
  z-index: 100;
  backdrop-filter: blur(2px);
}
.modal-backdrop.hidden { display: none; }
.modal {
  background: var(--surface);
  border-radius: 12px;
  width: min(600px, 92vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.close-btn {
  background: none; border: none;
  font-size: 18px; cursor: pointer;
  color: var(--text-muted);
  width: 28px; height: 28px; border-radius: 6px;
}
.close-btn:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex; justify-content: flex-end; gap: 8px;
  background: #fafaf8;
}

/* Section header */
.section-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.section-header h3 { font-size: 18px; font-weight: 600; }
.section-desc { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* Toast */
.toast {
  position: fixed; bottom: 24px; right: 24px;
  padding: 12px 20px;
  background: var(--text);
  color: white;
  border-radius: 8px;
  box-shadow: var(--shadow-lg);
  z-index: 200;
  font-size: 13px;
  transition: opacity 0.3s, transform 0.3s;
}
.toast.hidden { opacity: 0; transform: translateY(10px); pointer-events: none; }
.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Utilities */
.hidden { display: none !important; }
.flex { display: flex; }
.gap { gap: 10px; }
.text-muted { color: var(--text-muted); }
.text-right { text-align: right; }
.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: var(--primary-light);
  color: var(--primary-dark);
}
.badge.accent { background: #fdf4d7; color: #8a6a0a; }
.badge.success { background: #e4f3e5; color: #1b5e20; }
.badge.danger { background: #fce4e4; color: #8a1616; }

/* Parish info card */
.parish-hero {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  padding: 24px 28px;
  border-radius: 12px;
  margin-bottom: 20px;
}
.parish-hero h3 { font-size: 22px; margin-bottom: 4px; }
.parish-hero p { opacity: 0.9; font-size: 13px; }

/* Event / timing list cards */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}
.mini-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  transition: transform 0.15s, box-shadow 0.15s;
}
.mini-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mini-card h4 { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.mini-card p { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.mini-card-actions { display: flex; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }

/* Responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .form-grid { grid-template-columns: 1fr; }
}
