/* ============================================================
   BNI Money Matrix — Review Tracker
   Main Stylesheet
   ============================================================ */

:root {
  --bni-red: #cc0000;
  --bni-red-dark: #a00000;
  --bni-red-light: #ff4444;
  --bni-red-bg: #fff5f5;
  --google-color: #4285F4;
  --google-bg: #e8f0fe;
  --fb-color: #1877F2;
  --fb-bg: #e7f0fd;
  --green: #22c55e;
  --green-bg: #f0fdf4;
  --yellow: #f59e0b;
  --yellow-bg: #fffbeb;
  --red: #ef4444;
  --red-bg: #fef2f2;
  --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;
  --gray-900: #111827;
  --white: #ffffff;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow: 0 4px 16px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.15);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --header-h: 90px;
  --nav-h: 56px;
  --transition: 0.2s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--gray-100);
  color: var(--gray-800);
  min-height: 100vh;
  padding-top: calc(var(--header-h) + var(--nav-h) + 4px);
}

/* ============================================================
   HEADER
   ============================================================ */
#main-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: linear-gradient(135deg, var(--bni-red-dark) 0%, var(--bni-red) 60%, #e60000 100%);
  box-shadow: var(--shadow-lg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  min-height: 82px;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bni-logo {
  background: var(--white);
  border-radius: 10px;
  padding: 6px 10px;
  display: flex;
  align-items: center;
  gap: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.logo-bni {
  font-size: 20px;
  font-weight: 800;
  color: var(--bni-red);
  letter-spacing: 1px;
}

.logo-dot {
  font-size: 8px;
  color: var(--bni-red);
}

.header-title h1 {
  font-size: 20px;
  font-weight: 800;
  color: var(--white);
  line-height: 1.1;
}

.header-title p {
  font-size: 11px;
  color: rgba(255,255,255,0.75);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.header-stats {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.stat-pill {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50px;
  padding: 6px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: white;
  backdrop-filter: blur(4px);
}

.stat-pill i { font-size: 13px; opacity: 0.85; }
.stat-pill span { font-size: 16px; font-weight: 700; }
.stat-pill small { font-size: 10px; opacity: 0.8; font-weight: 500; display: block; line-height: 1; }

.chapter-progress-bar {
  height: 5px;
  background: rgba(255,255,255,0.2);
  position: relative;
  overflow: hidden;
}

.chapter-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4ade80, #22c55e);
  transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.hamburger {
  display: none;
  background: rgba(255,255,255,0.2);
  border: 1px solid rgba(255,255,255,0.3);
  border-radius: 8px;
  color: white;
  width: 40px; height: 40px;
  font-size: 18px;
  cursor: pointer;
  transition: var(--transition);
}

.hamburger:hover { background: rgba(255,255,255,0.3); }

/* ============================================================
   NAV
   ============================================================ */
#main-nav {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  z-index: 99;
  background: var(--white);
  border-bottom: 2px solid var(--gray-200);
  box-shadow: var(--shadow-sm);
}

.nav-list {
  display: flex;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-list::-webkit-scrollbar { display: none; }

.nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 20px;
  height: var(--nav-h);
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.nav-btn i { font-size: 14px; }
.nav-btn:hover { color: var(--bni-red); background: var(--bni-red-bg); }
.nav-btn.active { color: var(--bni-red); border-bottom-color: var(--bni-red); background: var(--bni-red-bg); }

/* ============================================================
   MAIN CONTENT
   ============================================================ */
#main-content { padding: 24px 20px; max-width: 1400px; margin: 0 auto; }

.view { display: none; }
.view.active { display: block; }

.view-header {
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 22px;
  font-weight: 800;
  color: var(--gray-800);
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-header h2 i { color: var(--bni-red); }
.view-header p { color: var(--gray-500); font-size: 14px; margin-top: 4px; }

/* ============================================================
   LOADING OVERLAY
   ============================================================ */
#loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
}

#loading-overlay.hidden { display: none; }

.spinner-wrap { text-align: center; }
.spinner-wrap p { color: var(--gray-500); font-size: 14px; margin-top: 12px; }

.spinner {
  width: 48px; height: 48px;
  border: 4px solid var(--gray-200);
  border-top-color: var(--bni-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

@keyframes shake {
  0%   { transform: translateX(0); }
  15%  { transform: translateX(-6px); }
  30%  { transform: translateX(6px); }
  45%  { transform: translateX(-5px); }
  60%  { transform: translateX(5px); }
  75%  { transform: translateX(-3px); }
  90%  { transform: translateX(3px); }
  100% { transform: translateX(0); }
}

/* ============================================================
   MATRIX VIEW
   ============================================================ */
.matrix-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--gray-600);
  font-weight: 500;
}

.dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  display: inline-block;
}
.dot.red { background: var(--red); }
.dot.yellow { background: var(--yellow); }
.dot.green { background: var(--green); }

.matrix-scroll-wrapper {
  overflow-x: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  background: white;
}

#matrix-container { min-width: 900px; }

.matrix-table {
  border-collapse: collapse;
  width: 100%;
  font-size: 12px;
}

.matrix-table th, .matrix-table td {
  border: 1px solid var(--gray-200);
  padding: 0;
}

.matrix-corner {
  background: var(--gray-800);
  color: white;
  font-size: 10px;
  font-weight: 600;
  padding: 8px;
  text-align: center;
  min-width: 130px;
}

.matrix-col-header {
  background: var(--gray-800);
  color: white;
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  padding: 10px 6px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  white-space: nowrap;
  min-width: 36px;
  cursor: default;
}

.matrix-row-header {
  background: var(--gray-700);
  color: white;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
  min-width: 130px;
  max-width: 160px;
}

.matrix-row-header .member-class {
  font-size: 9px;
  color: var(--gray-400);
  font-weight: 400;
  display: block;
}

.matrix-cell {
  width: 36px;
  height: 36px;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
  position: relative;
}

.matrix-cell.self-cell {
  background: var(--gray-200);
  cursor: default;
}

.matrix-cell:not(.self-cell):hover {
  transform: scale(1.15);
  z-index: 2;
  box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.matrix-cell .cell-icons {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 2px;
  font-size: 9px;
}

.cell-g, .cell-f {
  width: 14px; height: 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 7px;
  font-weight: 700;
  color: white;
}

.cell-g { background: var(--gray-300); color: var(--gray-500); }
.cell-f { background: var(--gray-300); color: var(--gray-500); }
.cell-g.done { background: var(--google-color); color: white; }
.cell-f.done { background: var(--fb-color); color: white; }

/* Cell background states */
.matrix-cell.status-none { background: #fff; }
.matrix-cell.status-partial { background: #fffbeb; }
.matrix-cell.status-full { background: #f0fdf4; }

/* ============================================================
   MEMBER CARDS VIEW
   ============================================================ */
.cards-filter {
  margin-bottom: 20px;
}

.cards-filter input {
  width: 100%;
  max-width: 400px;
  padding: 10px 16px;
  border: 2px solid var(--gray-200);
  border-radius: 50px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  outline: none;
  transition: var(--transition);
}

.cards-filter input:focus { border-color: var(--bni-red); }

#cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

.member-card {
  background: white;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--gray-200);
  overflow: hidden;
  transition: var(--transition);
}

.member-card:hover { box-shadow: var(--shadow); border-color: var(--bni-red); transform: translateY(-2px); }

.card-header {
  background: linear-gradient(135deg, var(--bni-red-dark), var(--bni-red));
  color: white;
  padding: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.card-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: rgba(255,255,255,0.25);
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
  font-weight: 800;
  color: white;
  border: 2px solid rgba(255,255,255,0.4);
  flex-shrink: 0;
}

.card-header-info h3 { font-size: 15px; font-weight: 700; }
.card-header-info p { font-size: 11px; opacity: 0.8; }

.card-progress-bar-wrap {
  padding: 10px 16px 4px;
  background: var(--gray-50);
  border-bottom: 1px solid var(--gray-200);
}

.card-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--gray-500);
  font-weight: 600;
  margin-bottom: 5px;
}

.card-progress-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 50px;
  overflow: hidden;
}

.card-progress-fill {
  height: 100%;
  border-radius: 50px;
  transition: width 0.5s ease;
  background: linear-gradient(90deg, var(--green), #16a34a);
}

.card-review-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 8px 0;
}

.card-review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  border-bottom: 1px solid var(--gray-100);
  cursor: pointer;
  transition: var(--transition);
}

.card-review-item:last-child { border-bottom: none; }
.card-review-item:hover { background: var(--gray-50); }

.card-review-member {
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-700);
  flex: 1;
}

.card-review-member small {
  display: block;
  font-size: 10px;
  font-weight: 400;
  color: var(--gray-400);
}

.review-badges {
  display: flex;
  gap: 5px;
}

.badge {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.badge.g-off { background: var(--gray-300); }
.badge.g-on { background: var(--google-color); }
.badge.f-off { background: var(--gray-300); }
.badge.f-on { background: var(--fb-color); }

.card-review-status {
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-left: 8px;
  flex-shrink: 0;
}

.card-review-status.none { background: var(--red); }
.card-review-status.partial { background: var(--yellow); }
.card-review-status.full { background: var(--green); }

/* ============================================================
   DASHBOARD VIEW
   ============================================================ */
.dashboard-selector {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.dashboard-selector label {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-700);
}

#dashboard-member-select {
  padding: 10px 16px;
  border: 2px solid var(--bni-red);
  border-radius: 50px;
  font-size: 14px;
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  background: white;
  cursor: pointer;
  outline: none;
  min-width: 220px;
}

.dash-summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.dash-stat-card {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--gray-200);
}

.dash-stat-card i { font-size: 24px; }
.dash-stat-card span { font-size: 28px; font-weight: 800; display: block; }
.dash-stat-card small { font-size: 11px; color: var(--gray-500); font-weight: 500; }
.given-card i { color: var(--bni-red); }
.received-card i { color: var(--green); }
.google-card i { color: var(--google-color); }
.fb-card i { color: var(--fb-color); }

.dash-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 24px;
}

.dash-col {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--gray-200);
}

.dash-col h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-col h3 i { color: var(--bni-red); }

.dash-review-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.dash-review-item:last-child { border-bottom: none; }

.dash-missing {
  background: white;
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--yellow);
}

.dash-missing h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--yellow);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.missing-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--gray-100);
  font-size: 13px;
}

.missing-item:last-child { border-bottom: none; }

.missing-item .btn-review-now {
  font-size: 11px;
  padding: 4px 10px;
  background: var(--bni-red);
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  transition: var(--transition);
}

.missing-item .btn-review-now:hover { background: var(--bni-red-dark); }

/* ============================================================
   LEADERBOARD VIEW
   ============================================================ */
.lb-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.lb-tab {
  padding: 8px 20px;
  border-radius: 50px;
  border: 2px solid var(--gray-200);
  background: white;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--gray-500);
  cursor: pointer;
  transition: var(--transition);
}

.lb-tab:hover { border-color: var(--bni-red); color: var(--bni-red); }
.lb-tab.active { background: var(--bni-red); border-color: var(--bni-red); color: white; }

.lb-entry {
  display: flex;
  align-items: center;
  gap: 16px;
  background: white;
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--gray-200);
  transition: var(--transition);
}

.lb-entry:hover { border-color: var(--bni-red); transform: translateX(4px); }

.lb-rank {
  font-size: 20px;
  font-weight: 800;
  color: var(--gray-300);
  min-width: 36px;
  text-align: center;
}

.lb-rank.gold { color: #f59e0b; }
.lb-rank.silver { color: #9ca3af; }
.lb-rank.bronze { color: #92400e; }

.lb-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bni-red-dark), var(--bni-red));
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.lb-info { flex: 1; }
.lb-info strong { font-size: 14px; font-weight: 700; color: var(--gray-800); display: block; }
.lb-info small { font-size: 11px; color: var(--gray-400); }

.lb-score {
  text-align: right;
}

.lb-score .score-num {
  font-size: 22px;
  font-weight: 800;
  color: var(--bni-red);
  display: block;
}

.lb-score small { font-size: 10px; color: var(--gray-400); }

.lb-bar-wrap {
  flex: 1;
  max-width: 180px;
}

.lb-bar {
  height: 8px;
  background: var(--gray-200);
  border-radius: 50px;
  overflow: hidden;
}

.lb-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--bni-red), var(--bni-red-light));
  border-radius: 50px;
  transition: width 0.6s ease;
}

/* ============================================================
   ADMIN VIEW
   ============================================================ */
.admin-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}

.admin-member-row {
  background: white;
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
  border: 2px solid var(--gray-200);
  transition: var(--transition);
}

.admin-member-row:hover { border-color: var(--gray-300); }

.admin-avatar {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bni-red-dark), var(--bni-red));
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.admin-member-info { flex: 1; }
.admin-member-info strong { font-size: 14px; font-weight: 700; color: var(--gray-800); }
.admin-member-info small { font-size: 11px; color: var(--gray-400); display: block; }

.admin-links {
  display: flex;
  gap: 8px;
}

.admin-link-badge {
  padding: 4px 10px;
  border-radius: 50px;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.admin-link-badge.has-link { background: var(--green-bg); color: var(--green); }
.admin-link-badge.no-link { background: var(--red-bg); color: var(--red); }
.admin-link-badge.warn-link { background: var(--yellow-bg); color: #b45309; }

/* Admin flag notes — shown inline under member name */
.admin-flag-note {
  font-size: 10px;
  color: #b45309;
  background: var(--yellow-bg);
  border: 1px solid #fde68a;
  border-radius: 6px;
  padding: 3px 8px;
  margin-top: 4px;
  display: flex;
  align-items: flex-start;
  gap: 5px;
  line-height: 1.4;
}

.admin-flag-note i { margin-top: 2px; flex-shrink: 0; font-size: 9px; }

/* Flag label in member edit modal */
.flag-label {
  color: #b45309 !important;
  display: flex;
  align-items: center;
  gap: 5px;
}

.flag-label i { font-size: 10px; }

.flag-label-hint {
  font-size: 10px;
  color: var(--gray-400);
  font-weight: 400;
  font-style: italic;
}

#google-flag-group input, #fb-flag-group input {
  border-color: #fde68a;
  background: var(--yellow-bg);
  font-size: 12px;
}

#google-flag-group input:focus, #fb-flag-group input:focus {
  border-color: var(--yellow);
}

/* Modal flag notes — shown below review links */
.modal-flag {
  font-size: 11px;
  color: #b45309;
  background: var(--yellow-bg);
  border: 1px solid #fde68a;
  border-left: 3px solid var(--yellow);
  border-radius: 6px;
  padding: 7px 10px;
  margin-top: -4px;
  margin-bottom: 4px;
  line-height: 1.5;
}

.modal-flag::before {
  content: '⚠️ ';
}

.admin-btn-edit, .admin-btn-delete {
  width: 34px; height: 34px;
  border-radius: 8px;
  border: 1.5px solid;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 13px;
  transition: var(--transition);
  background: white;
}

.admin-btn-edit { border-color: var(--google-color); color: var(--google-color); }
.admin-btn-edit:hover { background: var(--google-bg); }
.admin-btn-delete { border-color: var(--red); color: var(--red); }
.admin-btn-delete:hover { background: var(--red-bg); }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  background: var(--bni-red);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
}

.btn-primary:hover { background: var(--bni-red-dark); transform: translateY(-1px); }

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 2px solid var(--gray-300);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
}

.btn-secondary:hover { border-color: var(--gray-500); transform: translateY(-1px); }

.btn-danger {
  background: white;
  color: var(--red);
  border: 2px solid var(--red);
  padding: 10px 20px;
  border-radius: var(--radius-sm);
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: var(--transition);
}

.btn-danger:hover { background: var(--red-bg); transform: translateY(-1px); }

/* ============================================================
   MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
}

.modal-overlay.hidden { display: none; }

.modal-box {
  background: white;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 460px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  animation: modalIn 0.25s ease;
}

.modal-sm { max-width: 380px; }

@keyframes modalIn {
  from { opacity: 0; transform: scale(0.92) translateY(20px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 16px; right: 16px;
  width: 32px; height: 32px;
  border-radius: 50%;
  border: none;
  background: var(--gray-100);
  color: var(--gray-500);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  transition: var(--transition);
}

.modal-close:hover { background: var(--gray-200); color: var(--gray-800); }

.modal-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.modal-avatar {
  width: 52px; height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--bni-red-dark), var(--bni-red));
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  font-weight: 800;
  color: white;
  flex-shrink: 0;
}

.modal-header h3 { font-size: 16px; font-weight: 700; color: var(--gray-800); }
.modal-header p { font-size: 12px; color: var(--gray-500); margin-top: 2px; }

.modal-body { margin-bottom: 20px; }

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  background: var(--gray-50);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  border: 2px solid var(--gray-200);
  transition: var(--transition);
}

.toggle-row:hover { border-color: var(--gray-300); }

.toggle-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.toggle-icon { font-size: 22px; }
.google-icon { color: var(--google-color); }
.fb-icon { color: var(--fb-color); }

.toggle-info strong { font-size: 14px; font-weight: 700; display: block; }
.toggle-date { font-size: 11px; color: var(--gray-400); display: block; height: 14px; }

/* SLIDER TOGGLE */
.slider-toggle {
  position: relative;
  width: 52px;
  height: 28px;
  cursor: pointer;
  display: block;
}

.slider-toggle input { opacity: 0; width: 0; height: 0; position: absolute; }

.slider-track {
  position: absolute;
  inset: 0;
  background: var(--gray-300);
  border-radius: 50px;
  transition: 0.3s ease;
}

.slider-track::before {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 22px;
  height: 22px;
  background: white;
  border-radius: 50%;
  transition: 0.3s ease;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}

.slider-toggle input:checked + .slider-track { background: var(--green); }
.slider-toggle input:checked + .slider-track::before { transform: translateX(24px); }

.modal-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.link-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}

.link-btn.hidden { display: none; }
.google-link { background: var(--google-bg); color: var(--google-color); }
.google-link:hover { background: #d2e3fc; }
.fb-link { background: var(--fb-bg); color: var(--fb-color); }
.fb-link:hover { background: #d0e4fd; }

.modal-footer {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-top: 16px;
  border-top: 1px solid var(--gray-200);
}

.modal-box h3 { font-size: 18px; font-weight: 800; margin-bottom: 8px; color: var(--gray-800); }
.modal-box p { font-size: 14px; color: var(--gray-500); margin-bottom: 20px; }

/* ============================================================
   FORMS
   ============================================================ */
.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  margin-bottom: 5px;
}

.form-group input {
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: 'Inter', sans-serif;
  color: var(--gray-800);
  outline: none;
  transition: var(--transition);
  background: white;
}

.form-group input:focus { border-color: var(--bni-red); }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-800);
  color: white;
  padding: 12px 24px;
  border-radius: 50px;
  font-size: 13px;
  font-weight: 600;
  z-index: 9999;
  box-shadow: var(--shadow-lg);
  transition: opacity 0.3s ease;
}

.toast.hidden { opacity: 0; pointer-events: none; }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden { display: none !important; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  :root {
    --header-h: 80px;
  }

  .header-inner { padding: 10px 16px; min-height: 72px; }
  .header-title h1 { font-size: 16px; }
  .header-stats { display: none; }
  .hamburger { display: flex; align-items: center; justify-content: center; }

  .nav-btn span { display: none; }
  .nav-btn { padding: 0 16px; }
  .nav-btn i { font-size: 18px; }

  #main-content { padding: 16px 12px; }

  .dash-two-col { grid-template-columns: 1fr; }

  #cards-grid { grid-template-columns: 1fr; }

  .admin-actions { flex-direction: column; }

  .lb-bar-wrap { display: none; }

  .matrix-col-header { min-width: 28px; }
  .matrix-cell { width: 28px; height: 28px; }

  .admin-links { display: none; }

  .modal-box { padding: 20px; }
}

@media (max-width: 480px) {
  .dash-summary-grid { grid-template-columns: 1fr 1fr; }
  .lb-entry { flex-wrap: wrap; }
}
