:root {
  --navy: #1B2A4A;
  --navy-light: #2A3D66;
  --navy-dark: #111D33;
  --gold: #C9A84C;
  --gold-light: #D4B96A;
  --gold-dark: #A88B3A;
  --cream: #F5F0E8;
  --cream-dark: #E8E0D0;
  --white: #FFFFFF;
  --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;
  --red: #DC2626; --green: #16A34A; --blue: #2563EB; --purple: #7C3AED;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.07);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--cream); color: var(--gray-800); line-height: 1.6; min-height: 100vh; padding-top: 64px; }
a { color: var(--navy); text-decoration: none; } a:hover { color: var(--gold); }

/* NAV */
.navbar { background: var(--navy); padding: 0 2rem; display: flex; align-items: center; justify-content: space-between; height: 64px; position: fixed; top: 0; left: 0; right: 0; z-index: 100; box-shadow: var(--shadow-md); }
.navbar-brand { display: flex; align-items: center; gap: 12px; color: var(--white); font-weight: 700; font-size: 1rem; letter-spacing: 0.5px; }
.navbar-brand .logo-text { font-family: Georgia, serif; text-transform: uppercase; letter-spacing: 3px; font-size: 0.85rem; }
.navbar-brand .logo-accent { color: var(--gold); }
.navbar-brand .portal-badge { background: var(--gold); color: var(--navy); font-size: 0.6rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; letter-spacing: 1px; text-transform: uppercase; }
.navbar-nav { display: flex; align-items: center; gap: 1.5rem; list-style: none; }
.navbar-nav a { color: var(--cream); font-size: 0.9rem; font-weight: 500; } .navbar-nav a:hover { color: var(--gold); }
.navbar-nav .btn-sm { background: var(--gold); color: var(--navy); padding: 6px 16px; border-radius: var(--radius); font-weight: 600; font-size: 0.85rem; }

/* AUTH */
.auth-container { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); padding: 2rem; margin-top: -64px; padding-top: calc(2rem + 64px); }
.auth-card { background: var(--white); border-radius: 12px; padding: 3rem; width: 100%; max-width: 440px; box-shadow: var(--shadow-lg); }
.auth-card .brand { text-align: center; margin-bottom: 2rem; }
.auth-card .brand h1 { font-family: Georgia, serif; text-transform: uppercase; letter-spacing: 4px; font-size: 1.2rem; color: var(--navy); margin-bottom: 4px; }
.auth-card .brand .subtitle { color: var(--gold); font-size: 0.85rem; font-weight: 600; letter-spacing: 2px; text-transform: uppercase; }
.auth-card h2 { font-size: 1.4rem; color: var(--navy); margin-bottom: 1.5rem; text-align: center; }
.form-group { margin-bottom: 1rem; }
.form-group label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--gray-700); margin-bottom: 4px; }
.form-control { width: 100%; padding: 10px 14px; border: 1.5px solid var(--gray-300); border-radius: var(--radius); font-size: 0.95rem; color: var(--gray-800); background: var(--white); }
.form-control:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,168,76,0.15); }
select.form-control { cursor: pointer; }
textarea.form-control { min-height: 80px; resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 20px; border: none; border-radius: var(--radius); font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-primary { background: var(--gold); color: var(--navy); width: 100%; } .btn-primary:hover { background: var(--gold-dark); }
.btn-navy { background: var(--navy); color: var(--white); } .btn-navy:hover { background: var(--navy-light); }
.btn-outline { background: transparent; border: 1.5px solid var(--gray-300); color: var(--gray-700); } .btn-outline:hover { border-color: var(--navy); }
.btn-sm { font-size: 0.85rem; padding: 6px 14px; }
.error-msg { background: #FEF2F2; color: var(--red); border: 1px solid #FECACA; padding: 10px 14px; border-radius: var(--radius); font-size: 0.9rem; margin-bottom: 1rem; }

/* LAYOUT */
.page-container { max-width: 1200px; margin: 0 auto; padding: 2rem; }

/* DASHBOARD */
.welcome-banner { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); color: var(--white); border-radius: 12px; padding: 2rem 2.5rem; margin-bottom: 2rem; display: flex; align-items: center; justify-content: space-between; }
.welcome-banner h2 { font-size: 1.5rem; font-family: Georgia, serif; margin-bottom: 4px; }
.welcome-banner .gold-text { color: var(--gold); }
.welcome-banner p { color: var(--cream); opacity: 0.85; font-size: 0.95rem; }

/* STATS */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.stat-card { background: var(--white); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); text-align: center; }
.stat-card .stat-value { font-size: 2rem; font-weight: 700; color: var(--navy); }
.stat-card .stat-label { font-size: 0.8rem; color: var(--gray-500); margin-top: 2px; }
.stat-card.gold .stat-value { color: var(--gold); }

/* WEEK CARDS */
.weeks-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.week-card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); padding: 1.25rem; transition: all 0.2s; display: block; position: relative; overflow: hidden; }
.week-card:hover { border-color: var(--gold); box-shadow: var(--shadow-md); transform: translateY(-1px); color: var(--gray-800); }
.week-card .week-num { position: absolute; top: 0; right: 0; background: var(--navy); color: var(--gold); font-size: 0.7rem; font-weight: 700; padding: 4px 12px; border-radius: 0 0 0 8px; letter-spacing: 1px; }
.week-card.completed .week-num { background: var(--green); color: var(--white); }
.week-card.current .week-num { background: var(--gold); color: var(--navy); }
.week-card h3 { font-size: 1rem; color: var(--navy); margin-bottom: 4px; margin-top: 4px; }
.week-card p { font-size: 0.82rem; color: var(--gray-500); line-height: 1.5; }
.week-card .week-score { margin-top: 0.75rem; display: flex; gap: 0.5rem; align-items: center; }
.week-card .pts-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.pts-green { background: #DCFCE7; color: var(--green); }
.pts-gold { background: #FEF3C7; color: var(--gold-dark); }
.pts-gray { background: var(--gray-100); color: var(--gray-500); }

/* LEADERBOARD */
.leaderboard-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.leaderboard-table th { background: var(--navy); color: var(--white); padding: 10px 14px; text-align: left; font-size: 0.8rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.leaderboard-table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); font-size: 0.9rem; }
.leaderboard-table tr:hover td { background: var(--cream); }
.rank-badge { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; }
.rank-1 { background: var(--gold); color: var(--navy); }
.rank-2 { background: #C0C0C0; color: var(--navy); }
.rank-3 { background: #CD7F32; color: var(--white); }
.rank-other { background: var(--gray-100); color: var(--gray-600); }
.fellow-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.75rem; color: var(--white); flex-shrink: 0; }

/* WEEK PAGE */
.week-header { margin-bottom: 2rem; }
.week-header .week-badge { display: inline-block; background: var(--navy); color: var(--gold); font-size: 0.7rem; font-weight: 700; padding: 4px 12px; border-radius: 10px; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 8px; }
.week-header h1 { font-size: 1.6rem; font-family: Georgia, serif; color: var(--navy); margin-bottom: 4px; }
.week-header .subtitle { color: var(--gray-500); font-size: 0.95rem; font-style: italic; }

.content-section { background: var(--white); border-radius: var(--radius); padding: 1.5rem; margin-bottom: 1.5rem; box-shadow: var(--shadow); }
.content-section h2 { font-size: 1.1rem; color: var(--navy); margin-bottom: 1rem; display: flex; align-items: center; gap: 8px; }
.content-section h2 .section-icon { width: 28px; height: 28px; background: var(--gold); border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; }

.topics-list { list-style: none; padding: 0; }
.topics-list li { padding: 8px 0; border-bottom: 1px solid var(--gray-100); font-size: 0.9rem; color: var(--gray-700); display: flex; align-items: flex-start; gap: 10px; }
.topics-list li::before { content: ''; width: 6px; height: 6px; background: var(--gold); border-radius: 50%; flex-shrink: 0; margin-top: 8px; }

.deliverable-card { background: var(--cream); border: 1px solid var(--cream-dark); border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem; }
.deliverable-card h3 { font-size: 1rem; color: var(--navy); margin-bottom: 4px; }
.deliverable-card .del-desc { font-size: 0.85rem; color: var(--gray-500); margin-bottom: 0.75rem; }
.deliverable-card .del-pts { font-size: 0.8rem; font-weight: 700; color: var(--gold-dark); }

.rubric-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; margin-top: 0.75rem; }
.rubric-table th { background: var(--navy); color: var(--white); padding: 6px 10px; text-align: left; font-size: 0.75rem; text-transform: uppercase; }
.rubric-table td { padding: 6px 10px; border-bottom: 1px solid var(--gray-100); }
.rubric-table tr:last-child td { border-bottom: none; font-weight: 700; }

.engagement-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem; }
.eng-item { text-align: center; padding: 1rem 0.5rem; background: var(--cream); border-radius: var(--radius); border: 1px solid var(--cream-dark); }
.eng-item .eng-icon { font-size: 1.5rem; margin-bottom: 4px; }
.eng-item .eng-label { font-size: 0.7rem; color: var(--gray-500); font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; }
.eng-item .eng-status { font-size: 0.8rem; font-weight: 700; margin-top: 4px; }
.eng-item.earned { border-color: var(--green); background: #F0FDF4; }
.eng-item.earned .eng-status { color: var(--green); }
.eng-item.pending .eng-status { color: var(--gray-400); }

.key-takeaway { background: linear-gradient(135deg, var(--navy) 0%, var(--navy-light) 100%); color: var(--cream); border-radius: var(--radius); padding: 1.5rem; margin-top: 1.5rem; font-style: italic; font-size: 1rem; line-height: 1.6; text-align: center; }

/* ADMIN */
.data-table { width: 100%; border-collapse: collapse; background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: var(--navy); color: var(--white); padding: 10px 14px; text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.5px; }
.data-table td { padding: 10px 14px; border-bottom: 1px solid var(--gray-100); font-size: 0.9rem; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 0.75rem; font-weight: 600; }
.badge-admin { background: var(--gold); color: var(--navy); }
.badge-fellow { background: var(--gray-100); color: var(--gray-600); }

/* TOAST */
.toast { position: fixed; bottom: 2rem; right: 2rem; background: var(--navy); color: var(--white); padding: 12px 24px; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 0.9rem; font-weight: 500; transform: translateY(100px); opacity: 0; transition: all 0.3s; z-index: 9999; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: var(--green); }

/* ERROR */
.error-container { text-align: center; padding: 4rem 2rem; }
.error-container h1 { font-size: 3rem; color: var(--navy); margin-bottom: 1rem; }

/* CHECKBOX TOGGLE */
.toggle { position: relative; display: inline-block; width: 40px; height: 22px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 22px; transition: 0.3s; }
.toggle .slider::before { content: ''; position: absolute; height: 16px; width: 16px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: 0.3s; }
.toggle input:checked + .slider { background: var(--green); }
.toggle input:checked + .slider::before { transform: translateX(18px); }

@media (max-width: 768px) {
  .navbar { padding: 0 1rem; }
  .page-container { padding: 1rem; }
  .weeks-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .engagement-grid { grid-template-columns: repeat(3, 1fr); }
  .welcome-banner { flex-direction: column; gap: 1rem; padding: 1.5rem; }
}
