:root {
  --navy: #0D1B2A;
  --navy-light: #162236;
  --gold: #C9A84C;
  --gold-light: #E8C96A;
  --white: #FFFFFF;
  --off-white: #F5F3EE;
  --text-dark: #1a1a1a;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --radius: 6px;
  --radius-lg: 12px;
  --shadow: 0 1px 3px rgba(0,0,0,0.08);
}

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

body {
  font-family: 'Georgia', serif;
  background: var(--off-white);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAV */
.navbar {
  background: var(--navy);
  border-bottom: 2px solid var(--gold);
  padding: 0 2rem;
  height: 64px;
  display: flex;
  align-items: center;
}
.nav-inner {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.nav-brand:hover { text-decoration: none; }
.nav-brand * { text-decoration: none; }
.brand-crest { color: var(--gold); font-size: 22px; }
.brand-name { display: block; color: var(--white); font-size: 16px; font-weight: bold; letter-spacing: 0.08em; }
.brand-sub { display: block; color: var(--gold); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; font-family: sans-serif; }
.nav-right { display: flex; align-items: center; gap: 1.5rem; }
.nav-user { color: rgba(255,255,255,0.7); font-size: 14px; font-family: sans-serif; }
.nav-link { color: var(--gold); font-size: 14px; text-decoration: none; font-family: sans-serif; letter-spacing: 0.04em; }
.nav-link:hover { color: var(--gold-light); }
.nav-logout { color: rgba(255,255,255,0.5); }
.nav-logout:hover { color: var(--white); }

/* FLASH */
.flash-container { padding: 0.75rem 2rem; background: #fef3cd; border-bottom: 1px solid #fcd34d; }
.flash { font-size: 14px; font-family: sans-serif; }
.flash-error { color: #dc2626; }

/* MAIN */
.main-content { flex: 1; padding: 2.5rem 2rem; }
.page-container { max-width: 860px; margin: 0 auto; }
.page-header { margin-bottom: 2rem; border-bottom: 1px solid var(--border); padding-bottom: 1.25rem; }
.page-header h2 { font-size: 1.6rem; color: var(--navy); letter-spacing: 0.02em; }
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 4px; font-family: sans-serif; }

/* DEADLINE BADGE */
.deadline-badge { display: inline-flex; align-items: center; gap: 8px; margin-top: 0.75rem; background: var(--navy); color: var(--white); padding: 6px 14px; border-radius: var(--radius); font-family: sans-serif; font-size: 13px; }
.deadline-label { color: var(--gold); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.deadline-date { color: var(--white); font-weight: bold; }

/* LESSON LIST */
.lessons-list { display: flex; flex-direction: column; gap: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--white); }
.lesson-row { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); transition: background 0.15s; }
.lesson-row:last-child { border-bottom: none; }
.lesson-row:hover:not(.lesson-locked) { background: #fafaf8; }
.lesson-locked { opacity: 0.5; }
.lesson-info { display: flex; align-items: center; gap: 1rem; }
.lesson-number { width: 28px; height: 28px; background: var(--navy); color: var(--gold); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-family: sans-serif; font-weight: bold; flex-shrink: 0; }
.lesson-title { font-size: 15px; color: var(--text-dark); }

/* STATUS BADGES */
.status-badge { font-family: sans-serif; font-size: 12px; padding: 5px 12px; border-radius: 20px; font-weight: 500; text-decoration: none; display: inline-block; }
.status-locked { background: #f3f4f6; color: var(--text-muted); }
.status-accepted { background: #d1fae5; color: #065f46; }
.status-pending { background: #fef3cd; color: #92400e; }
.status-resubmit { background: #fee2e2; color: #991b1b; }
.status-begin { background: var(--gold); color: var(--navy); font-weight: bold; }
.status-in_progress { background: #dbeafe; color: #1e40af; }
.status-pass { background: #d1fae5; color: #065f46; }
.status-incomplete { background: #fee2e2; color: #991b1b; }
.status-withdrawn { background: #f3f4f6; color: var(--text-muted); }

/* LOGIN */
.login-wrapper { min-height: calc(100vh - 64px - 48px); display: flex; align-items: center; justify-content: center; padding: 2rem; }
.login-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 3rem 2.5rem; width: 100%; max-width: 420px; box-shadow: 0 4px 24px rgba(13,27,42,0.10); }
.login-header { text-align: center; margin-bottom: 2rem; }
.login-crest { font-size: 36px; color: var(--gold); margin-bottom: 0.75rem; }
.login-header h1 { font-size: 1.25rem; color: var(--navy); line-height: 1.4; letter-spacing: 0.02em; }
.login-sub { color: var(--text-muted); font-size: 13px; margin-top: 6px; font-family: sans-serif; text-transform: uppercase; letter-spacing: 0.1em; }
.login-help { text-align: center; color: var(--text-muted); font-size: 12px; margin-top: 1.5rem; font-family: sans-serif; }
.form-error { background: #fee2e2; color: #991b1b; font-size: 13px; padding: 8px 12px; border-radius: var(--radius); margin-bottom: 1rem; font-family: sans-serif; }

/* FORMS */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-size: 13px; font-family: sans-serif; color: var(--text-muted); margin-bottom: 6px; letter-spacing: 0.04em; text-transform: uppercase; }
.form-group input[type="text"],
.form-group input[type="password"],
.form-group input[type="file"],
.form-group select,
.form-group textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border); border-radius: var(--radius); font-size: 15px; font-family: sans-serif; color: var(--text-dark); background: var(--white); transition: border 0.15s; }
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { outline: none; border-color: var(--gold); }

/* BUTTONS */
.btn { display: inline-block; padding: 10px 22px; border-radius: var(--radius); font-size: 14px; font-family: sans-serif; font-weight: 600; letter-spacing: 0.04em; cursor: pointer; border: none; text-decoration: none; transition: background 0.15s, transform 0.1s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--navy); color: var(--gold); }
.btn-primary:hover { background: var(--navy-light); }
.btn-secondary { background: var(--gold); color: var(--navy); }
.btn-secondary:hover { background: var(--gold-light); }
.btn-full { width: 100%; text-align: center; padding: 12px; font-size: 15px; }

/* LESSON PAGE */
.back-link { display: inline-block; color: var(--gold); font-family: sans-serif; font-size: 13px; text-decoration: none; margin-bottom: 1.5rem; }
.back-link:hover { color: var(--navy); }
.lesson-header { margin-bottom: 2rem; }
.lesson-header h2 { font-size: 1.5rem; color: var(--navy); }
.lesson-description { color: var(--text-muted); margin-top: 0.5rem; font-size: 15px; line-height: 1.7; }
.audio-section, .submission-section { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; margin-bottom: 1.5rem; }
.audio-section h3, .submission-section h3 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-family: sans-serif; margin-bottom: 1rem; }
.audio-player { width: 100%; height: 48px; }
.info-box { padding: 10px 16px; border-radius: var(--radius); font-family: sans-serif; font-size: 14px; margin-bottom: 1rem; }
.info-pending { background: #fef3cd; color: #92400e; }
.info-accepted { background: #d1fae5; color: #065f46; }
.info-resubmit { background: #fee2e2; color: #991b1b; }
.info-closed { background: #f3f4f6; color: var(--text-muted); }
.resubmit-note { font-family: sans-serif; font-size: 13px; color: var(--text-muted); margin-bottom: 1rem; }
.feedback-box { background: #fffbeb; border-left: 3px solid #d97706; padding: 12px 16px; border-radius: var(--radius); font-family: sans-serif; font-size: 13px; color: #78350f; margin-bottom: 1rem; white-space: pre-wrap; }

/* HISTORY */
.history-list { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--white); }
.history-row { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.25rem; border-bottom: 1px solid var(--border); }
.history-row:last-child { border-bottom: none; }
.history-title { display: block; font-size: 15px; color: var(--text-dark); }
.history-dates { display: block; font-size: 12px; color: var(--text-muted); font-family: sans-serif; margin-top: 3px; }

/* ADMIN */
.admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.25rem; }
.admin-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.admin-card h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-family: sans-serif; margin-bottom: 0.5rem; }
.admin-count { font-size: 2rem; color: var(--navy); font-weight: bold; margin-bottom: 1rem; }

/* FOOTER */
.footer { background: var(--navy); color: rgba(255,255,255,0.4); text-align: center; padding: 1rem; font-size: 12px; font-family: sans-serif; }

/* EMPTY STATE */
.empty-state { color: var(--text-muted); font-family: sans-serif; font-size: 14px; text-align: center; padding: 3rem; }

/* ADMIN TABLES */
.admin-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--white); }
.admin-table { width: 100%; border-collapse: collapse; font-family: sans-serif; font-size: 14px; }
.admin-table thead { background: var(--navy); color: var(--white); }
.admin-table thead th { padding: 10px 14px; text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; font-weight: 500; }
.admin-table tbody tr { border-bottom: 1px solid var(--border); }
.admin-table tbody tr:last-child { border-bottom: none; }
.admin-table tbody tr:hover { background: #fafaf8; }
.admin-table td { padding: 10px 14px; color: var(--text-dark); vertical-align: middle; }
.admin-table td.muted { color: var(--text-muted); }
.admin-table td.mono { font-family: monospace; font-size: 13px; }
.table-link { color: var(--gold); text-decoration: none; font-weight: 600; font-size: 13px; }
.table-link:hover { color: var(--navy); }

/* FORM CARDS & DETAIL SECTIONS */
.form-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 1.5rem; }
.form-hint { display: block; font-size: 12px; color: var(--text-muted); margin-top: 4px; font-family: sans-serif; }
.detail-section { margin-bottom: 2rem; }
.section-title { font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); font-family: sans-serif; margin-bottom: 1rem; }
.flash-success { background: #d1fae5; color: #065f46; padding: 10px 16px; border-radius: var(--radius); font-family: sans-serif; font-size: 14px; }

/* PAGE TITLE AS BACK LINK */
.page-title-link { color: var(--navy); text-decoration: none; }
.page-title-link:hover { color: var(--gold); }
.page-title-link::before { content: '← '; font-size: 0.85em; color: var(--gold); }

/* Program year tabs */
.program-tab { padding: 7px 18px; font-family: sans-serif; font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none; border-radius: var(--radius); letter-spacing: 0.04em; transition: background 0.15s, color 0.15s; white-space: nowrap; }
.program-tab:hover { color: var(--navy); background: rgba(13,27,42,0.07); text-decoration: none; }
.program-tab-active { background: var(--navy); color: var(--gold); text-decoration: none; }
.program-tab-active:hover { background: var(--navy); color: var(--gold); text-decoration: none; }


/* YEAR 3 CARD */
.year3-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 40px 36px;
  margin-top: 8px;
}

/* MOBILE */
@media (max-width: 640px) {
  .navbar { padding: 0 1rem; }
  .nav-user { display: none; }
  .main-content { padding: 1.5rem 1rem; }
  .login-wrapper { padding: 1rem; }
  .login-card { padding: 2rem 1.25rem; }
  .lesson-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .history-row { flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .year3-card { padding: 24px 20px; }
}

.program-progress { display: flex; align-items: center; gap: 8px; padding: 10px 0 20px; font-family: sans-serif; font-size: 13px; }
.prog-step { color: var(--text-muted); }
.prog-current { color: var(--navy); font-weight: 600; }
.prog-done { color: var(--gold); }
.prog-sep { color: var(--text-muted); opacity: 0.4; }
.doc-links-list { display: flex; flex-direction: column; gap: 8px; }
.doc-link-item { font-family: sans-serif; font-size: 14px; color: var(--navy); text-decoration: none; padding: 10px 14px; background: var(--light-bg); border-radius: var(--radius); display: block; }
.doc-link-item:hover { background: var(--border-color); }
