/* ═══════════════════════════════════════════════════════════
   CVBC Connect — Application Stylesheet
   Colors: Teal #4BBFBF / Deep Teal #1E7070 / Charcoal #4A4A4A
═══════════════════════════════════════════════════════════ */

:root {
  --teal: #4BBFBF;
  --teal-dark: #1E7070;
  --teal-light: #e0f5f5;
  --charcoal: #4A4A4A;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-600: #4b5563;
  --gray-700: #374151;
  --gray-800: #1f2937;
  --white: #ffffff;
  --danger: #ef4444;
  --danger-light: #fee2e2;
  --warning: #f59e0b;
  --warning-light: #fef3c7;
  --success: #10b981;
  --success-light: #d1fae5;
  --info: #3b82f6;
  --info-light: #dbeafe;
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08), 0 4px 16px rgba(0,0,0,0.06);
  --shadow-md: 0 4px 24px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.14);
  --transition: 0.2s ease;
  --font-body: 'Lato', 'Segoe UI', system-ui, sans-serif;
  --font-heading: 'Playfair Display', Georgia, serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: var(--font-body); background: var(--gray-100); color: var(--charcoal); font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; overflow-x: hidden; }

.app-layout { display: flex; min-height: 100vh; }

.sidebar { width: var(--sidebar-width); background: linear-gradient(175deg, #0d4a4a 0%, #1E7070 40%, #2a9090 100%); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; transition: transform var(--transition); overflow-y: auto; }
.sidebar-header { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,0.1); min-height: 80px; display: flex; align-items: center; }
.sidebar-logo { max-height: 48px; max-width: 200px; object-fit: contain; }
.sidebar-brand { font-family: var(--font-heading); font-size: 1.3rem; color: white; font-weight: 700; }
.sidebar-nav { flex: 1; padding: 16px 12px; display: flex; flex-direction: column; gap: 2px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: var(--radius-sm); color: rgba(255,255,255,0.78); text-decoration: none; font-size: 0.9rem; font-weight: 500; transition: all var(--transition); cursor: pointer; position: relative; }
.nav-item:hover { background: rgba(255,255,255,0.12); color: white; }
.nav-item.active { background: rgba(255,255,255,0.18); color: white; font-weight: 600; }
.nav-item.active::before { content:''; position:absolute; left:0; top:20%; bottom:20%; width:3px; background:var(--teal); border-radius:0 2px 2px 0; }
.nav-item.disabled { opacity: 0.5; cursor: default; pointer-events: none; }
.nav-item i, .nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item span:first-of-type { flex: 1; }
.nav-divider { border-top: 1px solid rgba(255,255,255,0.1); margin: 10px 0; }
.nav-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255,255,255,0.4); padding: 4px 12px 2px; }
.badge-soon { font-size: 0.65rem; background: rgba(255,255,255,0.15); color: rgba(255,255,255,0.6); padding: 2px 6px; border-radius: 20px; font-weight: 600; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.1); }
.user-chip { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,0.2); display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; color: white; flex-shrink: 0; }
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.user-name { font-size: 0.85rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: 0.72rem; color: rgba(255,255,255,0.55); }
.logout-btn { color: rgba(255,255,255,0.5); display: flex; align-items: center; text-decoration: none; transition: color var(--transition); }
.logout-btn:hover { color: white; }
.logout-btn svg { width: 16px; height: 16px; }

.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; }
.topbar { height: var(--topbar-height); background: white; border-bottom: 1px solid var(--gray-200); display: flex; align-items: center; gap: 16px; padding: 0 24px; position: sticky; top: 0; z-index: 100; box-shadow: 0 1px 3px rgba(0,0,0,0.05); }
.sidebar-toggle { background: none; border: none; cursor: pointer; color: var(--gray-500); display: none; padding: 6px; border-radius: 6px; transition: background var(--transition); }
.sidebar-toggle:hover { background: var(--gray-100); }
.sidebar-toggle svg { width: 20px; height: 20px; }
.topbar-title { font-family: var(--font-heading); font-size: 1.2rem; font-weight: 600; color: var(--charcoal); flex: 1; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar-btn { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 8px; color: var(--gray-500); text-decoration: none; transition: all var(--transition); }
.topbar-btn:hover { background: var(--gray-100); color: var(--teal-dark); }
.topbar-btn svg { width: 18px; height: 18px; }
.page-content { padding: 28px; flex: 1; }

.card { background: white; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.card-header { padding: 20px 24px; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-title { font-family: var(--font-heading); font-size: 1.05rem; font-weight: 600; color: var(--charcoal); }
.card-body { padding: 24px; }

.btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 20px; border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.875rem; font-weight: 600; cursor: pointer; border: none; text-decoration: none; transition: all var(--transition); white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: linear-gradient(135deg, var(--teal-dark), var(--teal)); color: white; box-shadow: 0 2px 8px rgba(30,112,112,0.3); }
.btn-primary:hover { opacity: 0.92; box-shadow: 0 4px 12px rgba(30,112,112,0.4); transform: translateY(-1px); }
.btn-secondary { background: var(--gray-100); color: var(--gray-700); border: 1px solid var(--gray-200); }
.btn-secondary:hover { background: var(--gray-200); }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { opacity: 0.9; }
.btn-outline { background: transparent; color: var(--teal-dark); border: 1.5px solid var(--teal); }
.btn-outline:hover { background: var(--teal-light); }
.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 1rem; }
.btn-icon { padding: 8px; }

.form-group { margin-bottom: 20px; }
.form-label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--gray-700); margin-bottom: 6px; }
.form-label.required::after { content: ' *'; color: var(--danger); }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); font-family: var(--font-body); font-size: 0.9rem; color: var(--charcoal); background: white; transition: border-color var(--transition), box-shadow var(--transition); outline: none; }
.form-control:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(75,191,191,0.15); }
.form-control::placeholder { color: var(--gray-400); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: 0.78rem; color: var(--gray-400); margin-top: 4px; }
.form-row { display: grid; gap: 16px; }
.form-row.cols-2 { grid-template-columns: 1fr 1fr; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

.table-wrapper { overflow-x: auto; }
table.data-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.data-table th { background: var(--gray-50); color: var(--gray-600); font-weight: 700; font-size: 0.75rem; letter-spacing: 0.05em; text-transform: uppercase; padding: 12px 16px; text-align: left; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--charcoal); vertical-align: middle; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.03em; }
.badge-success { background: var(--success-light); color: #065f46; }
.badge-danger { background: var(--danger-light); color: #991b1b; }
.badge-warning { background: var(--warning-light); color: #92400e; }
.badge-info { background: var(--info-light); color: #1e40af; }
.badge-default { background: var(--gray-100); color: var(--gray-600); }
.badge-teal { background: var(--teal-light); color: var(--teal-dark); }

.alert { padding: 14px 18px; border-radius: var(--radius-sm); margin-bottom: 20px; font-size: 0.9rem; display: flex; align-items: flex-start; gap: 10px; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.alert-danger { background: var(--danger-light); color: #991b1b; border-left: 4px solid var(--danger); }
.alert-warning { background: var(--warning-light); color: #92400e; border-left: 4px solid var(--warning); }
.alert-info { background: var(--info-light); color: #1e40af; border-left: 4px solid var(--info); }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; margin-top: 8px; }
.module-tile { background: white; border-radius: var(--radius-lg); padding: 28px 24px; box-shadow: var(--shadow); text-decoration: none; color: var(--charcoal); transition: all 0.25s ease; display: flex; flex-direction: column; gap: 14px; border: 1.5px solid transparent; position: relative; overflow: hidden; }
.module-tile::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--teal-dark), var(--teal)); opacity: 0; transition: opacity var(--transition); }
.module-tile:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--teal-light); }
.module-tile:hover::before { opacity: 1; }
.module-tile.coming-soon { opacity: 0.65; cursor: default; }
.module-tile.coming-soon:hover { transform: none; box-shadow: var(--shadow); border-color: transparent; }
.module-tile.coming-soon::before { display: none; }
.tile-icon { width: 52px; height: 52px; border-radius: 14px; background: var(--teal-light); display: flex; align-items: center; justify-content: center; }
.tile-icon svg { width: 26px; height: 26px; color: var(--teal-dark); }
.tile-name { font-family: var(--font-heading); font-size: 1.05rem; font-weight: 600; color: var(--charcoal); }
.tile-desc { font-size: 0.8rem; color: var(--gray-400); line-height: 1.4; }
.tile-soon-badge { position: absolute; top: 16px; right: 16px; background: var(--gray-200); color: var(--gray-500); font-size: 0.65rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: 0.05em; }

.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 20px; margin-bottom: 28px; }

.todo-list { display: flex; flex-direction: column; gap: 10px; }
.todo-item { display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: var(--gray-50); border-radius: var(--radius-sm); border-left: 3px solid var(--teal); transition: background var(--transition); }
.todo-item:hover { background: var(--teal-light); }
.todo-icon { color: var(--teal-dark); flex-shrink: 0; }
.todo-icon svg { width: 18px; height: 18px; }
.todo-text { flex: 1; font-size: 0.875rem; }
.todo-text strong { display: block; color: var(--charcoal); }
.todo-text span { color: var(--gray-500); font-size: 0.8rem; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header-left h1 { font-family: var(--font-heading); font-size: 1.6rem; font-weight: 700; color: var(--charcoal); line-height: 1.2; }
.page-header-left p { color: var(--gray-500); font-size: 0.9rem; margin-top: 4px; }
.page-header-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; visibility: hidden; transition: all var(--transition); }
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal { background: white; border-radius: var(--radius-lg); width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); transform: scale(0.96) translateY(8px); transition: transform var(--transition); max-height: 90vh; overflow-y: auto; }
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header { padding: 24px 24px 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-title { font-family: var(--font-heading); font-size: 1.15rem; font-weight: 700; color: var(--charcoal); }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); padding: 4px; border-radius: 4px; transition: color var(--transition); }
.modal-close:hover { color: var(--charcoal); }
.modal-close svg { width: 20px; height: 20px; }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 24px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--gray-100); }

.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--gray-200); margin-bottom: 24px; overflow-x: auto; }
.tab-btn { padding: 10px 20px; background: none; border: none; cursor: pointer; font-family: var(--font-body); font-size: 0.875rem; font-weight: 600; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all var(--transition); white-space: nowrap; }
.tab-btn:hover { color: var(--teal-dark); }
.tab-btn.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

.search-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-input-wrap { position: relative; flex: 1; min-width: 200px; }
.search-input-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--gray-400); width: 16px; height: 16px; pointer-events: none; }
.search-input-wrap .form-control { padding-left: 38px; }

.permission-module { margin-bottom: 24px; border: 1px solid var(--gray-200); border-radius: var(--radius); overflow: hidden; }
.permission-module-header { background: var(--gray-50); padding: 14px 18px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--gray-200); }
.permission-module-name { font-weight: 700; color: var(--charcoal); font-size: 0.9rem; }
.permission-rows { padding: 4px 0; }
.permission-row { display: flex; align-items: center; padding: 10px 18px; gap: 12px; border-bottom: 1px solid var(--gray-50); transition: background var(--transition); }
.permission-row:last-child { border-bottom: none; }
.permission-row:hover { background: var(--gray-50); }
.permission-row label { display: flex; align-items: center; gap: 10px; cursor: pointer; flex: 1; }
.permission-desc { font-size: 0.78rem; color: var(--gray-400); }

.toggle { position: relative; width: 42px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-300); border-radius: 24px; cursor: pointer; transition: background var(--transition); }
.toggle-slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: transform var(--transition); box-shadow: 0 1px 3px rgba(0,0,0,0.2); }
.toggle input:checked + .toggle-slider { background: var(--teal); }
.toggle input:checked + .toggle-slider::before { transform: translateX(18px); }

input[type="checkbox"].check { width: 17px; height: 17px; accent-color: var(--teal); cursor: pointer; }

.login-page { min-height: 100vh; display: flex; align-items: stretch; }
.login-left { flex: 1; background: linear-gradient(160deg, #0d4a4a 0%, #1E7070 50%, #4BBFBF 100%); display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 60px; position: relative; overflow: hidden; }
.login-bg { position: absolute; inset: 0; background-size: cover; background-position: center; opacity: 0.15; }
.login-left-content { position: relative; z-index: 1; text-align: center; }
.login-logo { max-width: 220px; max-height: 100px; object-fit: contain; margin-bottom: 28px; }
.login-welcome-title { font-family: var(--font-heading); font-size: 2.2rem; color: white; font-weight: 700; line-height: 1.2; margin-bottom: 12px; }
.login-welcome-text { color: rgba(255,255,255,0.75); font-size: 1.05rem; line-height: 1.6; }
.login-right { width: 480px; background: white; display: flex; align-items: center; justify-content: center; padding: 60px 50px; }
.login-form-wrap { width: 100%; max-width: 360px; }
.login-form-title { font-family: var(--font-heading); font-size: 1.5rem; font-weight: 700; color: var(--charcoal); margin-bottom: 6px; }
.login-form-subtitle { color: var(--gray-500); font-size: 0.9rem; margin-bottom: 32px; }
.login-divider { text-align: center; margin: 24px 0; position: relative; }
.login-divider::before { content: ''; position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid var(--gray-200); }
.login-divider span { background: white; padding: 0 12px; color: var(--gray-400); font-size: 0.8rem; position: relative; }
.btn-google { width: 100%; display: flex; align-items: center; justify-content: center; gap: 10px; padding: 11px 20px; background: white; border: 1.5px solid var(--gray-200); border-radius: var(--radius-sm); cursor: pointer; font-family: var(--font-body); font-size: 0.9rem; font-weight: 600; color: var(--gray-700); text-decoration: none; transition: all var(--transition); }
.btn-google:hover { background: var(--gray-50); border-color: var(--gray-300); }

.admin-layout { display: flex; gap: 0; min-height: calc(100vh - var(--topbar-height)); }
.admin-sidebar { width: 220px; background: var(--gray-50); border-right: 1px solid var(--gray-200); padding: 20px 12px; flex-shrink: 0; }
.admin-nav-item { display: flex; align-items: center; gap: 9px; padding: 9px 12px; border-radius: var(--radius-sm); color: var(--gray-600); text-decoration: none; font-size: 0.875rem; font-weight: 500; transition: all var(--transition); }
.admin-nav-item:hover { background: var(--gray-200); color: var(--charcoal); }
.admin-nav-item.active { background: var(--teal-light); color: var(--teal-dark); font-weight: 600; }
.admin-nav-item svg { width: 16px; height: 16px; }
.admin-nav-label { font-size: 0.68rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gray-400); padding: 12px 12px 4px; }
.admin-content { flex: 1; padding: 28px; overflow: auto; }

.public-header { background: linear-gradient(135deg, #0d4a4a, #1E7070); padding: 20px 40px; display: flex; align-items: center; justify-content: space-between; }
.public-logo { max-height: 56px; object-fit: contain; }
.public-site-name { font-family: var(--font-heading); font-size: 1.4rem; color: white; font-weight: 700; }

.section-heading { font-family: var(--font-heading); font-size: 1.1rem; font-weight: 700; color: var(--charcoal); margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--teal-light); }

.spinner { width: 20px; height: 20px; border: 2px solid rgba(255,255,255,0.3); border-top-color: white; border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

.pagination { display: flex; gap: 4px; align-items: center; justify-content: center; padding: 20px 0 4px; }
.page-link { padding: 6px 12px; border-radius: 6px; font-size: 0.85rem; color: var(--gray-600); text-decoration: none; border: 1px solid var(--gray-200); transition: all var(--transition); }
.page-link:hover { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal); }
.page-link.active { background: var(--teal-dark); color: white; border-color: var(--teal-dark); }
.page-link.disabled { opacity: 0.4; pointer-events: none; }

.text-muted { color: var(--gray-400); }
.text-sm { font-size: 0.8rem; }
.text-center { text-align: center; }
.mt-1 { margin-top: 8px; } .mt-2 { margin-top: 16px; } .mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; } .mb-2 { margin-bottom: 16px; } .mb-3 { margin-bottom: 24px; }
.flex { display: flex; } .flex-center { display: flex; align-items: center; justify-content: center; }
.gap-1 { gap: 8px; } .gap-2 { gap: 16px; } .w-full { width: 100%; } .hidden { display: none !important; }
.divider { border: none; border-top: 1px solid var(--gray-200); margin: 24px 0; }
.gradient-text { background: linear-gradient(135deg, var(--teal-dark), var(--teal)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }

@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .sidebar-toggle { display: flex; }
  .login-left { display: none; }
  .login-right { width: 100%; padding: 40px 28px; }
  .form-row.cols-2, .form-row.cols-3 { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .page-content { padding: 16px; }
  .module-grid { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; }
}

/* ─── LAYOUT.PHP SPECIFIC CLASSES ─────────────────────────── */
.app-wrapper { display: block; width: 100%; min-height: 100vh; }

.sidebar { width: 260px; background: linear-gradient(175deg, #0d4a4a 0%, #1E7070 45%, #2a9090 100%); display: flex; flex-direction: column; position: fixed; top: 0; left: 0; bottom: 0; z-index: 200; overflow-y: auto; transition: transform .2s ease; }
.sidebar-brand { padding: 24px 20px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand-text { font-family: 'Playfair Display',serif; font-size: 1.3rem; color: white; font-weight: 700; line-height: 1.2; }
.brand-sub { font-size: .72rem; color: rgba(255,255,255,.5); margin-top: 3px; }
.sidebar-logo-img { max-height: 48px; max-width: 180px; width: auto; object-fit: contain; display: block; }
.nav-section-label { font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: rgba(255,255,255,.35); padding: 14px 16px 4px; }
.nav-icon { width: 18px; height: 18px; flex-shrink: 0; }
.nav-badge { font-size: .6rem; background: rgba(255,255,255,.15); color: rgba(255,255,255,.6); padding: 2px 6px; border-radius: 20px; font-weight: 700; margin-left: auto; }
.sidebar-footer { padding: 16px 12px; border-top: 1px solid rgba(255,255,255,.1); margin-top: auto; }
.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 4px 4px; }
.sidebar-user img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 2px solid rgba(255,255,255,.2); }
.user-info { flex: 1; min-width: 0; }
.user-name { font-size: .85rem; font-weight: 600; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .72rem; color: rgba(255,255,255,.5); }

.app-header { position: sticky; top: 0; z-index: 100; background: white; border-bottom: 1px solid var(--gray-200); height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 28px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.header-title { font-family: 'Playfair Display',serif; font-size: 1.15rem; font-weight: 600; color: var(--charcoal); }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-btn { background: none; border: none; cursor: pointer; padding: 8px; border-radius: 6px; color: var(--gray-500); transition: background .15s; }
.header-btn:hover { background: var(--gray-100); }

.app-main { margin-left: 260px; min-height: 100vh; padding: 32px 40px; background: var(--gray-100); box-sizing: border-box; }

/* Page header used in module pages */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-header h1 { font-family: 'Playfair Display',serif; font-size: 1.7rem; font-weight: 700; color: var(--charcoal); margin-bottom: 4px; }
.page-header p { color: var(--gray-500); font-size: .88rem; }

/* Section title */
.section-title { font-family: 'Playfair Display',serif; font-size: 1.1rem; font-weight: 700; color: var(--charcoal); margin: 24px 0 16px; padding-bottom: 8px; border-bottom: 2px solid var(--teal-light); }

/* Module grid / cards (used in dashboard) */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px,1fr)); gap: 18px; }
.module-card { background: white; border-radius: 14px; padding: 24px; box-shadow: var(--shadow); text-decoration: none; color: var(--charcoal); display: block; border: 1.5px solid transparent; transition: all .22s ease; position: relative; overflow: hidden; }
.module-card::before { content:''; position:absolute; top:0;left:0;right:0;height:3px; background:linear-gradient(90deg,var(--teal-dark),var(--teal)); opacity:0; transition:opacity .2s; }
.module-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); border-color: var(--teal-light); }
.module-card:hover::before { opacity:1; }
.module-card.coming-soon { opacity: .6; cursor: default; pointer-events: none; }
.module-card.coming-soon::before { display: none; }
.module-card-icon { font-size: 2rem; margin-bottom: 12px; display: block; }
.module-card-title { font-family: 'Playfair Display',serif; font-size: 1.05rem; font-weight: 700; color: var(--charcoal); margin-bottom: 6px; }
.module-card-desc { font-size: .78rem; color: var(--gray-400); line-height: 1.4; }
.coming-soon-badge { position: absolute; top: 14px; right: 14px; background: var(--gray-200); color: var(--gray-500); font-size: .6rem; font-weight: 700; padding: 3px 8px; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }

/* Stat card (dashboard) — icon stacked above value/label, with text allowed
   to wrap onto a second line rather than overflowing the card edge. */
.stat-card { background: white; border-radius: 12px; padding: 18px 18px; box-shadow: var(--shadow); min-width: 0; overflow: hidden; }
.stat-icon { font-size: 1.6rem; margin-bottom: 8px; display: block; line-height: 1; }
.stat-value { font-family: 'Playfair Display',serif; font-size: 1.8rem; font-weight: 700; color: var(--charcoal); line-height: 1.1; word-break: break-word; }
.stat-label { font-size: .76rem; color: var(--gray-400); margin-top: 4px; line-height: 1.35; white-space: normal; overflow-wrap: break-word; }

/* Flash messages */
.flash { padding: 13px 18px; border-radius: 9px; margin-bottom: 18px; font-size: .9rem; display: flex; align-items: flex-start; gap: 10px; }
.flash-icon { font-weight: 700; flex-shrink: 0; }
.flash-success { background: var(--success-light); color: #065f46; border-left: 4px solid var(--success); }
.flash-error { background: var(--danger-light); color: #991b1b; border-left: 4px solid var(--danger); }
.flash-warning { background: var(--warning-light); color: #92400e; border-left: 4px solid var(--warning); }
.flash-info { background: var(--info-light); color: #1e40af; border-left: 4px solid var(--info); }

/* Tabs (layout.php version using tab-btn + tab-content) */
.tabs-container { }
.tabs { display: flex; border-bottom: 2px solid var(--gray-200); gap: 0; overflow-x: auto; margin-bottom: 0; }
.tab-btn { padding: 11px 22px; background: none; border: none; cursor: pointer; font-family: var(--font-body); font-size: .875rem; font-weight: 600; color: var(--gray-500); border-bottom: 2px solid transparent; margin-bottom: -2px; transition: all .2s; white-space: nowrap; }
.tab-btn:hover { color: var(--teal-dark); }
.tab-btn.active { color: var(--teal-dark); border-bottom-color: var(--teal); }
.tab-content { display: none; padding-top: 24px; }
.tab-content.active { display: block; }

/* Toggle switch (users admin) */
.toggle-switch { position: relative; display: inline-block; width: 42px; height: 24px; flex-shrink: 0; min-width: 42px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: var(--gray-300); border-radius: 24px; cursor: pointer; transition: background .2s; }
.toggle-slider::before { content:''; position:absolute; width:18px;height:18px;left:3px;bottom:3px;background:white;border-radius:50%;transition:transform .2s;box-shadow:0 1px 3px rgba(0,0,0,.2); }
.toggle-switch input:checked + .toggle-slider { background: var(--teal); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(18px); }

/* Table (unstyled table tag in layout pages) */
table { width: 100%; border-collapse: collapse; font-size: .875rem; }
table th { background: var(--gray-50); color: var(--gray-600); font-weight: 700; font-size: .74rem; letter-spacing: .05em; text-transform: uppercase; padding: 11px 16px; text-align: left; border-bottom: 2px solid var(--gray-200); white-space: nowrap; }
table td { padding: 12px 16px; border-bottom: 1px solid var(--gray-100); color: var(--charcoal); vertical-align: middle; }
table tbody tr:last-child td { border-bottom: none; }
table tbody tr:hover { background: var(--gray-50); }

/* Badge extras */
.badge-gray { background: var(--gray-100); color: var(--gray-600); }

/* Form row without cols */
.form-row { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; }

/* Required asterisk */
.required { color: var(--danger); }

/* Pagination (layout.php uses page-btn) */
.pagination { display: flex; gap: 4px; justify-content: center; padding: 16px 0; flex-wrap: wrap; }
.page-btn { padding: 6px 13px; border-radius: 7px; font-size: .85rem; color: var(--gray-600); text-decoration: none; border: 1px solid var(--gray-200); transition: all .15s; }
.page-btn:hover { background: var(--teal-light); color: var(--teal-dark); border-color: var(--teal); }
.page-btn.active { background: var(--teal-dark); color: white; border-color: var(--teal-dark); }

/* Modal overlay (layout.php version uses openModal() JS) */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 20px; opacity: 0; visibility: hidden; transition: all .2s; }
.modal-overlay.open { opacity: 1; visibility: visible; }
.modal { background: white; border-radius: 16px; width: 100%; max-width: 520px; box-shadow: var(--shadow-lg); transform: scale(.96) translateY(8px); transition: transform .2s; max-height: 90vh; overflow-y: auto; }
.modal-overlay.open .modal { transform: scale(1) translateY(0); }
.modal-header { padding: 24px 24px 0; display: flex; align-items: center; justify-content: space-between; }
.modal-title { font-family: 'Playfair Display',serif; font-size: 1.1rem; font-weight: 700; color: var(--charcoal); }
.modal-close { background: none; border: none; cursor: pointer; font-size: 1.4rem; color: var(--gray-400); line-height: 1; padding: 0 4px; }
.modal-close:hover { color: var(--charcoal); }
.modal-body { padding: 20px 24px; }
.modal-footer { padding: 16px 24px 24px; display: flex; gap: 10px; justify-content: flex-end; border-top: 1px solid var(--gray-100); }

/* btn-ghost */
.btn-ghost { background: none; border: 1px solid var(--gray-200); color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); }

/* Responsive for layout.php structure */
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  main.app-main { margin-left: 0; width: 100%; }
  #hamburger { display: flex !important; }
  .form-row { grid-template-columns: 1fr; }
  /* These were crowding out the page title on narrow screens. Sign out
     is still reachable via the hamburger -> sidebar drawer, which has
     its own Sign Out link at the bottom. */
  .header-search-desktop,
  .header-signout-desktop {
    display: none !important;
  }
}

/* ─── LOGO SAFETY CONSTRAINTS (CSS fallback even if resize fails) ── */
.sidebar img, .sidebar-brand img { max-height: 48px !important; max-width: 180px !important; width: auto !important; object-fit: contain !important; display: block; }
.login-logo { max-height: 80px !important; max-width: 280px !important; width: auto !important; object-fit: contain !important; display: block; margin: 0 auto 24px; }

/* ─── CONTENT LAYOUT IMPROVEMENTS ──────────────────────────────── */

/* Inner content wrapper - caps width and centers on very wide screens */
.content-wrap {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* Cards: forms inside cards need breathing room */
.card form { padding: 24px; }
.card form .form-row:last-of-type { margin-bottom: 0; }

/* Card body and form consistent inner padding */
.card-body { padding: 28px; }
.card-header { padding: 20px 28px; }

/* Flash messages inside cards need padding */
.card .flash { margin: 0 24px 0; }
.card > .flash { margin: 16px 24px 0; }

/* Form groups get bottom margin */
.form-group { margin-bottom: 22px; }
.form-group:last-child { margin-bottom: 0; }

/* Save button row at bottom of card forms */
.card form > div:last-child,
.card form > .form-actions {
  display: flex;
  justify-content: flex-end;
  padding-top: 8px;
  border-top: 1px solid var(--gray-100);
  margin-top: 8px;
}

/* Page header breathing room */
.page-header {
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--gray-200);
}

/* Tab content padding */
.tab-content { padding-top: 28px; }
.tabs-container .tabs { background: white; border-radius: var(--radius) var(--radius) 0 0; padding: 0 4px; box-shadow: var(--shadow); margin-bottom: 0; }
.tabs-container { background: transparent; }

/* Responsive padding adjustments */
@media (max-width: 1200px) {
  .app-main { padding: 28px 32px; }
}
@media (max-width: 900px) {
  .app-main { margin-left: 0; width: 100%; padding: 20px 16px; }
}
@media (max-width: 600px) {
  .app-main { padding: 16px 12px; }
  .card form { padding: 16px; }
  .card-header, .card-body { padding: 16px; }
}

/* ─── COMPACT FILTER GRID (People page advanced filters) ────────── */
.people-filter-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px 10px;
}
.people-filter-grid .form-group {
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.people-filter-grid .form-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--gray-500);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.people-filter-grid .form-control {
  padding: 5px 8px;
  font-size: 0.78rem;
  height: 30px;
}
.people-filter-grid select.form-control {
  text-overflow: ellipsis;
}
/* Fields that pair naturally (min/max, city/state/zip) share one grid cell
   as a tight side-by-side pair, instead of each eating a full column. */
.people-filter-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.people-filter-pair .form-group {
  min-width: 0;
}
@media (max-width: 1100px) {
  .people-filter-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 700px) {
  .people-filter-grid { grid-template-columns: 1fr 1fr; }
}

/* ─── RESPONSIVE MULTI-COLUMN CARD LAYOUT ─────────────────────────
   Reusable pattern for "main content + sidebar" pages (Care,
   Volunteers, Media, Signage, etc.). These were all previously built
   with an inline style="display:grid;grid-template-columns:1fr 380px"
   which cannot be overridden by a media query (inline styles beat
   external stylesheet rules regardless of viewport) — that's why none
   of them collapsed on mobile. Fix: use these classes instead of that
   inline style, and columns will properly stack full-width below
   900px.

   Usage:
     <div class="responsive-2col">                       (defaults to a 380px sidebar)
     <div class="responsive-2col" style="--r2c-sidebar:340px;">   (custom sidebar width)
     <div class="responsive-3col">                       (three even-ish columns, e.g. list/editor/preview)

   Mobile stacking order defaults to source order. If a page needs a
   different order on mobile than its desktop left-to-right position
   implies, add .r2c-order-1 / -2 / -3 / -4 to direct children — those
   only take effect inside the mobile media query, so desktop layout
   is unaffected. */
.responsive-2col {
  display: grid;
  grid-template-columns: 1fr var(--r2c-sidebar, 380px);
  gap: 20px;
  align-items: start;
}
.responsive-3col {
  display: grid;
  grid-template-columns: var(--r2c-col1, 220px) 1fr 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 900px) {
  .responsive-2col,
  .responsive-3col {
    display: flex;
    flex-direction: column;
  }
  .responsive-2col > *,
  .responsive-3col > * {
    width: 100%;
    max-width: 100%;
  }
  .r2c-order-1 { order: 1; }
  .r2c-order-2 { order: 2; }
  .r2c-order-3 { order: 3; }
  .r2c-order-4 { order: 4; }
}

/* Care profile page: Care Information is placed FIRST in the HTML
   source (so mobile stacking needs zero extra work — it's already at
   the top, and grid-column/row are meaningless once .responsive-2col
   switches to flex below 900px anyway). At desktop width, it's moved
   into the visual right-hand grid column instead. Both rules below use
   the exact same selector specificity (.responsive-2col > .care-
   sidebar-right) so the media query match is the only thing deciding
   which one applies — no specificity ambiguity between them. */
.responsive-2col > .care-sidebar-right {
  grid-column: 1;
  grid-row: 1;
}
.responsive-2col > .care-sidebar-right ~ * {
  grid-column: 1;
}
@media (min-width: 901px) {
  .responsive-2col > .care-sidebar-right {
    grid-column: 2;
    grid-row: 1;
  }
  .responsive-2col > .care-sidebar-right ~ * {
    grid-column: 1;
    grid-row: 1;
  }
}
