/* =============================================
   FAMILY PORTAL - Main Stylesheet
   Corporate · Professional · Mobile-First
   ============================================= */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=DM+Serif+Display&display=swap');

:root {
  --primary: #1B4FD8;
  --primary-dark: #1340B0;
  --primary-light: #EBF0FF;
  --accent: #F59E0B;
  --accent-light: #FEF3C7;
  --success: #10B981;
  --danger: #EF4444;
  --warning: #F59E0B;
  --text: #0F172A;
  --text-muted: #64748B;
  --text-light: #94A3B8;
  --border: #E2E8F0;
  --bg: #F8FAFC;
  --white: #FFFFFF;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 20px;
  --transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── SCROLLBAR ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 99px; }

/* ── LAYOUT ── */
.app-wrapper { display: flex; min-height: 100vh; }

/* ── SIDEBAR ── */
.sidebar {
  width: 260px; min-height: 100vh; background: var(--primary);
  display: flex; flex-direction: column;
  position: fixed; left: 0; top: 0; z-index: 100;
  transition: var(--transition);
}
.sidebar.collapsed { width: 70px; }

.sidebar-logo {
  padding: 24px 20px; display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
.sidebar-logo .logo-icon {
  width: 40px; height: 40px; background: rgba(255,255,255,0.2);
  border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.sidebar-logo .logo-text { color: white; font-weight: 800; font-size: 1.1rem; white-space: nowrap; }
.sidebar-logo .logo-sub { color: rgba(255,255,255,0.6); font-size: 0.7rem; }

.sidebar-nav { flex: 1; padding: 16px 12px; overflow-y: auto; }

.nav-section-title {
  color: rgba(255,255,255,0.4); font-size: 0.65rem; font-weight: 700;
  letter-spacing: 1.5px; text-transform: uppercase;
  padding: 8px 8px 4px; margin-top: 12px;
}
.sidebar.collapsed .nav-section-title { display: none; }

.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px;
  border-radius: var(--radius-sm); cursor: pointer; color: rgba(255,255,255,0.75);
  transition: var(--transition); text-decoration: none; margin-bottom: 2px;
  font-size: 0.9rem; font-weight: 500; white-space: nowrap; overflow: hidden;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,0.15); color: white;
}
.nav-item.active { background: rgba(255,255,255,0.2); }
.nav-item .nav-icon { font-size: 1.1rem; flex-shrink: 0; width: 22px; text-align: center; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--accent); color: #000;
  font-size: 0.65rem; font-weight: 700; padding: 2px 7px;
  border-radius: 99px; min-width: 20px; text-align: center;
}
.sidebar.collapsed .nav-item span:not(.nav-icon):not(.nav-badge) { display: none; }
.sidebar.collapsed .nav-badge { display: none; }

.sidebar-footer {
  padding: 16px 12px; border-top: 1px solid rgba(255,255,255,0.1);
}
.user-card-sidebar {
  display: flex; align-items: center; gap: 10px; padding: 10px 8px;
  border-radius: var(--radius-sm); cursor: pointer;
  transition: var(--transition); overflow: hidden;
}
.user-card-sidebar:hover { background: rgba(255,255,255,0.1); }
.user-card-sidebar .avatar {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: rgba(255,255,255,0.2); display: flex; align-items: center;
  justify-content: center; color: white; font-weight: 700; font-size: 0.9rem;
  flex-shrink: 0; overflow: hidden;
}
.user-card-sidebar .avatar img { width: 100%; height: 100%; object-fit: cover; }
.user-card-sidebar .user-info { flex: 1; overflow: hidden; }
.user-card-sidebar .user-name { color: white; font-size: 0.85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-card-sidebar .user-mobile { color: rgba(255,255,255,0.5); font-size: 0.72rem; }
.sidebar.collapsed .user-info { display: none; }

/* ── MAIN CONTENT ── */
.main-content {
  flex: 1; margin-left: 260px; min-height: 100vh;
  display: flex; flex-direction: column; transition: var(--transition);
}
.main-content.expanded { margin-left: 70px; }

/* ── TOPBAR ── */
.topbar {
  background: var(--white); border-bottom: 1px solid var(--border);
  padding: 0 24px; height: 64px;
  display: flex; align-items: center; justify-content: space-between;
  position: sticky; top: 0; z-index: 90;
  box-shadow: var(--shadow-sm);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.toggle-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.1rem; color: var(--text-muted); transition: var(--transition);
}
.toggle-btn:hover { background: var(--bg); }
.page-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
.page-subtitle { font-size: 0.78rem; color: var(--text-muted); }

.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-btn {
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1rem; color: var(--text-muted); transition: var(--transition);
  position: relative;
}
.topbar-btn:hover { background: var(--bg); color: var(--primary); }

/* ── PAGE CONTENT ── */
.page-content { flex: 1; padding: 24px; }

/* ── CARDS ── */
.card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow); }
.card-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--text); }
.card-subtitle { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }
.card-body { padding: 24px; }

/* ── STAT CARDS ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px 24px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-sm); transition: var(--transition);
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.stat-icon {
  width: 52px; height: 52px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; flex-shrink: 0;
}
.stat-icon.blue { background: var(--primary-light); }
.stat-icon.amber { background: var(--accent-light); }
.stat-icon.green { background: #D1FAE5; }
.stat-icon.purple { background: #EDE9FE; }
.stat-value { font-size: 1.8rem; font-weight: 800; color: var(--text); line-height: 1; }
.stat-label { font-size: 0.78rem; color: var(--text-muted); margin-top: 4px; }

/* ── FORMS ── */
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.form-full { grid-column: 1 / -1; }

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-label {
  font-size: 0.82rem; font-weight: 600; color: var(--text);
  display: flex; align-items: center; gap: 4px;
}
.form-label .required { color: var(--danger); }
.form-control {
  width: 100%; padding: 10px 14px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.9rem; color: var(--text);
  background: var(--white); transition: var(--transition);
  font-family: inherit; outline: none;
}
.form-control:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,79,216,0.12); }
.form-control.error { border-color: var(--danger); }
.form-control::placeholder { color: var(--text-light); }
select.form-control { cursor: pointer; }
textarea.form-control { resize: vertical; min-height: 80px; }
.form-hint { font-size: 0.74rem; color: var(--text-muted); }
.form-error { font-size: 0.74rem; color: var(--danger); display: none; }
.form-error.show { display: block; }

/* ── PHOTO UPLOAD ── */
.photo-upload-wrap {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer;
  transition: var(--transition); background: var(--bg); position: relative;
}
.photo-upload-wrap:hover { border-color: var(--primary); background: var(--primary-light); }
.photo-upload-wrap.has-photo { border-style: solid; border-color: var(--primary); }
.photo-preview {
  width: 90px; height: 90px; border-radius: 50%; object-fit: cover;
  border: 3px solid var(--primary); margin: 0 auto 10px; display: block;
}
.photo-placeholder { color: var(--text-muted); }
.photo-placeholder .icon { font-size: 2rem; display: block; margin-bottom: 8px; }
.photo-placeholder p { font-size: 0.82rem; }
.photo-placeholder small { color: var(--text-light); font-size: 0.72rem; }
.photo-upload-wrap input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.camera-btn {
  background: var(--primary); color: white; border: none; padding: 7px 16px;
  border-radius: 99px; font-size: 0.8rem; font-weight: 600; cursor: pointer;
  margin-top: 8px; display: inline-flex; align-items: center; gap: 6px;
  transition: var(--transition);
}
.camera-btn:hover { background: var(--primary-dark); }

/* ── BUTTONS ── */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 20px; border-radius: var(--radius-sm);
  font-size: 0.88rem; font-weight: 600; border: none; cursor: pointer;
  transition: var(--transition); text-decoration: none; white-space: nowrap;
  font-family: inherit;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(27,79,216,0.3); }
.btn-secondary { background: var(--bg); color: var(--text); border: 1.5px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-success { background: var(--success); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 0.95rem; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.btn-outline { background: transparent; color: var(--primary); border: 1.5px solid var(--primary); }
.btn-outline:hover { background: var(--primary); color: white; }

/* ── STEPS ── */
.steps-container { margin-bottom: 32px; }
.steps { display: flex; align-items: center; justify-content: center; gap: 0; }
.step-item { display: flex; flex-direction: column; align-items: center; flex: 1; position: relative; }
.step-item:not(:last-child)::after {
  content: ''; position: absolute; top: 18px; left: calc(50% + 18px);
  width: calc(100% - 36px); height: 2px; background: var(--border);
  z-index: 0; transition: var(--transition);
}
.step-item.completed:not(:last-child)::after { background: var(--primary); }
.step-circle {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--border);
  background: var(--white); display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 700; color: var(--text-muted);
  position: relative; z-index: 1; transition: var(--transition);
}
.step-item.active .step-circle { border-color: var(--primary); background: var(--primary); color: white; box-shadow: 0 0 0 4px var(--primary-light); }
.step-item.completed .step-circle { border-color: var(--primary); background: var(--primary); color: white; }
.step-item.completed .step-circle::after { content: '✓'; }
.step-label { font-size: 0.72rem; font-weight: 600; color: var(--text-muted); margin-top: 8px; text-align: center; }
.step-item.active .step-label, .step-item.completed .step-label { color: var(--primary); }

/* ── TABLES ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
thead th {
  background: var(--bg); padding: 12px 16px; text-align: left;
  font-size: 0.75rem; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.5px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
tbody td {
  padding: 14px 16px; border-bottom: 1px solid var(--border);
  font-size: 0.88rem; color: var(--text); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--bg); }
.avatar-cell { display: flex; align-items: center; gap: 10px; }
.avatar-sm {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  background: var(--primary-light); display: flex; align-items: center;
  justify-content: center; color: var(--primary); font-weight: 700; font-size: 0.82rem;
  flex-shrink: 0; overflow: hidden;
}
.avatar-sm img { width: 100%; height: 100%; object-fit: cover; }

/* ── BADGES ── */
.badge {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: 99px; font-size: 0.72rem; font-weight: 600;
}
.badge-blue { background: var(--primary-light); color: var(--primary); }
.badge-green { background: #D1FAE5; color: #065F46; }
.badge-amber { background: var(--accent-light); color: #92400E; }
.badge-red { background: #FEE2E2; color: #991B1B; }

/* ── MODAL ── */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; padding: 16px; opacity: 0; pointer-events: none;
  transition: var(--transition); backdrop-filter: blur(4px);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--white); border-radius: var(--radius-lg);
  width: 100%; max-width: 640px; max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow-lg); transform: translateY(20px);
  transition: var(--transition);
}
.modal-overlay.active .modal { transform: translateY(0); }
.modal-header {
  padding: 24px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; background: white; z-index: 1;
}
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  width: 32px; height: 32px; border-radius: var(--radius-sm); border: none;
  background: var(--bg); cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 1rem; transition: var(--transition);
}
.modal-close:hover { background: var(--border); }
.modal-body { padding: 24px; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 12px; justify-content: flex-end;
}

/* ── MEMBER CARDS ── */
.members-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.member-card {
  background: var(--white); border-radius: var(--radius);
  border: 1px solid var(--border); padding: 20px;
  transition: var(--transition); cursor: pointer;
}
.member-card:hover { border-color: var(--primary); box-shadow: var(--shadow); transform: translateY(-2px); }
.member-card-avatar {
  width: 64px; height: 64px; border-radius: 50%; object-fit: cover;
  background: var(--primary-light); display: flex; align-items: center;
  justify-content: center; color: var(--primary); font-weight: 800; font-size: 1.4rem;
  margin: 0 auto 12px; overflow: hidden; border: 3px solid var(--primary-light);
}
.member-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.member-card-name { font-weight: 700; font-size: 0.95rem; text-align: center; }
.member-card-rel { font-size: 0.78rem; color: var(--primary); font-weight: 600; text-align: center; text-transform: capitalize; margin-top: 2px; }
.member-card-info { margin-top: 12px; display: grid; gap: 6px; }
.member-info-row { display: flex; gap: 8px; font-size: 0.78rem; color: var(--text-muted); align-items: flex-start; }
.member-info-row .icon { width: 14px; flex-shrink: 0; margin-top: 1px; }
.member-card-actions { display: flex; gap: 8px; margin-top: 14px; }

/* ── ALERTS ── */
.alert {
  padding: 12px 16px; border-radius: var(--radius-sm);
  font-size: 0.85rem; display: flex; align-items: flex-start; gap: 10px;
  margin-bottom: 16px;
}
.alert-success { background: #D1FAE5; color: #065F46; border: 1px solid #A7F3D0; }
.alert-danger { background: #FEE2E2; color: #991B1B; border: 1px solid #FECACA; }
.alert-info { background: var(--primary-light); color: var(--primary-dark); border: 1px solid #BFDBFE; }
.alert-warning { background: var(--accent-light); color: #92400E; border: 1px solid #FDE68A; }

/* ── AUTH PAGES ── */
.auth-wrapper {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1B4FD8 0%, #1340B0 40%, #0F2D7A 100%);
  padding: 24px; position: relative; overflow: hidden;
}
.auth-wrapper::before {
  content: ''; position: absolute; width: 600px; height: 600px;
  background: radial-gradient(circle, rgba(255,255,255,0.06) 0%, transparent 70%);
  top: -200px; right: -200px; border-radius: 50%;
}
.auth-wrapper::after {
  content: ''; position: absolute; width: 400px; height: 400px;
  background: radial-gradient(circle, rgba(255,255,255,0.04) 0%, transparent 70%);
  bottom: -100px; left: -100px; border-radius: 50%;
}
.auth-card {
  background: white; border-radius: var(--radius-lg);
  width: 100%; max-width: 440px; box-shadow: var(--shadow-lg);
  position: relative; z-index: 1; overflow: hidden;
}
.auth-card-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  padding: 32px 32px 28px; text-align: center;
}
.auth-logo {
  width: 56px; height: 56px; background: rgba(255,255,255,0.2);
  border-radius: var(--radius); display: flex; align-items: center;
  justify-content: center; font-size: 1.8rem; margin: 0 auto 16px;
}
.auth-title { color: white; font-size: 1.4rem; font-weight: 800; }
.auth-subtitle { color: rgba(255,255,255,0.7); font-size: 0.85rem; margin-top: 4px; }
.auth-body { padding: 32px; }
.auth-footer { padding: 0 32px 24px; text-align: center; font-size: 0.82rem; color: var(--text-muted); }
.auth-footer a { color: var(--primary); font-weight: 600; text-decoration: none; }

/* ── SEARCH & FILTER ── */
.search-bar {
  display: flex; gap: 12px; align-items: center; margin-bottom: 20px;
}
.search-input-wrap { flex: 1; position: relative; }
.search-input-wrap .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-light); font-size: 0.9rem;
}
.search-input {
  width: 100%; padding: 10px 14px 10px 36px; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); font-size: 0.88rem; outline: none;
  transition: var(--transition); font-family: inherit;
}
.search-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,79,216,0.1); }

/* ── EMPTY STATE ── */
.empty-state { text-align: center; padding: 48px 24px; }
.empty-state .icon { font-size: 3rem; display: block; margin-bottom: 16px; opacity: 0.4; }
.empty-state h3 { font-size: 1.05rem; font-weight: 700; margin-bottom: 8px; }
.empty-state p { font-size: 0.85rem; color: var(--text-muted); margin-bottom: 20px; }

/* ── PROFILE HEADER ── */
.profile-header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  border-radius: var(--radius); padding: 28px; margin-bottom: 20px;
  display: flex; align-items: center; gap: 20px; color: white;
}
.profile-avatar-lg {
  width: 84px; height: 84px; border-radius: 50%; object-fit: cover;
  border: 4px solid rgba(255,255,255,0.3); flex-shrink: 0; overflow: hidden;
  background: rgba(255,255,255,0.2); display: flex; align-items: center;
  justify-content: center; font-size: 2rem; font-weight: 800; color: white;
}
.profile-avatar-lg img { width: 100%; height: 100%; object-fit: cover; }
.profile-header-info .name { font-size: 1.3rem; font-weight: 800; }
.profile-header-info .mobile { opacity: 0.75; font-size: 0.85rem; margin-top: 4px; }
.profile-header-info .tags { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.profile-tag {
  background: rgba(255,255,255,0.2); color: white; font-size: 0.72rem;
  font-weight: 600; padding: 3px 10px; border-radius: 99px;
}

/* ── LOADING ── */
.loading { display: flex; align-items: center; justify-content: center; padding: 40px; }
.spinner {
  width: 36px; height: 36px; border: 3px solid var(--border);
  border-top-color: var(--primary); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── TOAST ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--white); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); padding: 14px 18px;
  display: flex; align-items: center; gap: 12px; min-width: 280px;
  border-left: 4px solid var(--primary); font-size: 0.88rem;
  animation: slideIn 0.3s ease; font-family: 'Plus Jakarta Sans', sans-serif;
}
.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--accent); }
@keyframes slideIn { from { transform: translateX(120%); } to { transform: translateX(0); } }

/* ── DIVIDER ── */
.divider {
  display: flex; align-items: center; gap: 12px; margin: 16px 0;
  color: var(--text-light); font-size: 0.78rem;
}
.divider::before, .divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 20px; }
.page-btn {
  width: 36px; height: 36px; border-radius: var(--radius-sm); border: 1.5px solid var(--border);
  background: var(--white); cursor: pointer; display: flex; align-items: center;
  justify-content: center; font-size: 0.85rem; font-weight: 600; transition: var(--transition);
}
.page-btn:hover, .page-btn.active { background: var(--primary); color: white; border-color: var(--primary); }

/* ── RESPONSIVE ── */
@media (max-width: 1024px) {
  .sidebar { width: 70px; }
  .sidebar .nav-item span:not(.nav-icon), .sidebar .logo-text, .sidebar .logo-sub,
  .sidebar .nav-section-title, .sidebar .user-info, .sidebar .nav-badge { display: none; }
  .main-content { margin-left: 70px; }
}

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: 260px; }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar .nav-item span:not(.nav-icon), .sidebar .logo-text, .sidebar .logo-sub,
  .sidebar .nav-section-title, .sidebar .user-info, .sidebar .nav-badge { display: flex; }
  .sidebar .logo-text, .sidebar .logo-sub, .sidebar .nav-section-title { display: block; }
  .main-content { margin-left: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid.cols-3 { grid-template-columns: 1fr; }
  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .members-grid { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; text-align: center; }
  .steps { gap: 4px; }
  .step-label { font-size: 0.62rem; }
  .modal { border-radius: var(--radius); }
  .auth-body { padding: 24px; }
  .auth-card-header { padding: 24px 24px 20px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .topbar { padding: 0 16px; }
  .search-bar { flex-direction: column; }
}

/* ── OVERLAY for mobile sidebar ── */
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  z-index: 99; display: none; backdrop-filter: blur(2px);
}
.sidebar-overlay.active { display: block; }

/* ── PROGRESS BAR ── */
.progress-bar-wrap { height: 6px; background: var(--border); border-radius: 99px; overflow: hidden; margin-bottom: 24px; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--primary), #60A5FA); border-radius: 99px; transition: width 0.4s ease; }

/* ── OTP INPUT ── */
.otp-group { display: flex; gap: 10px; justify-content: center; margin: 16px 0; }
.otp-input {
  width: 48px; height: 56px; text-align: center; font-size: 1.4rem; font-weight: 800;
  border: 2px solid var(--border); border-radius: var(--radius-sm);
  outline: none; transition: var(--transition); font-family: inherit;
}
.otp-input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,79,216,0.12); }

/* ── CAMERA MODAL ── */
#camera-modal video { width: 100%; border-radius: var(--radius-sm); background: #000; }
#camera-modal canvas { display: none; }

/* ── TABS ── */
.tabs { display: flex; gap: 0; border-bottom: 2px solid var(--border); margin-bottom: 24px; }
.tab-btn {
  padding: 10px 20px; border: none; background: none; cursor: pointer;
  font-size: 0.88rem; font-weight: 600; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: var(--transition); font-family: inherit;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-btn:hover { color: var(--primary); }

/* ── EXPORT BUTTONS ── */
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.export-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 20px 12px; border-radius: var(--radius); border: 2px solid var(--border);
  background: var(--white); cursor: pointer; transition: var(--transition); text-decoration: none;
}
.export-btn:hover { border-color: var(--primary); background: var(--primary-light); transform: translateY(-2px); }
.export-btn .icon { font-size: 1.8rem; }
.export-btn .label { font-size: 0.82rem; font-weight: 700; color: var(--text); }

/* Print */
@media print { .sidebar, .topbar, .modal-overlay, .toast-container { display: none; } .main-content { margin: 0; } }
