:root {
  --navy: #1E2761;
  --navy-light: #2E3A85;
  --orange: #FF6B35;
  --orange-dark: #E2551F;
  --bg: #F5F6FA;
  --card: #FFFFFF;
  --text: #1F2333;
  --text-muted: #6B7089;
  --border: #E3E5EF;
  --green: #1F9D55;
  --red: #D64545;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

h1, h2, h3 { font-family: Georgia, 'Lora', 'Times New Roman', serif; color: var(--navy); margin: 0 0 .5em; }

a { color: var(--navy-light); text-decoration: none; }
a:hover { text-decoration: underline; }

.topbar {
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
}
.topbar .brand { display: flex; align-items: center; gap: 10px; font-family: Georgia, serif; font-weight: 700; font-size: 20px; letter-spacing: .5px; }
.topbar .brand .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--orange); display: inline-block; }
.topbar nav { display: flex; align-items: center; gap: 20px; }
.topbar nav a { color: #E7E9FA; }
.topbar nav a.active { color: var(--orange); font-weight: 600; }
.topbar .user { color: #C9CCF0; font-size: 14px; }

.container { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.container.wide { max-width: 1140px; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 16px;
}

.btn {
  display: inline-block;
  background: var(--orange);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: var(--orange-dark); text-decoration: none; }
.btn.secondary { background: var(--navy); }
.btn.secondary:hover { background: var(--navy-light); }
.btn.outline { background: transparent; border: 1px solid var(--border); color: var(--text); }
.btn.outline:hover { border-color: var(--navy); }
.btn.danger { background: var(--red); }
.btn:disabled { background: #C7C9D6; cursor: not-allowed; }

.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.locked { background: #EDEEF5; color: var(--text-muted); }
.badge.unlocked { background: #FFEADD; color: var(--orange-dark); }
.badge.completed { background: #E4F6EA; color: var(--green); }

.progress-bar { background: #EDEEF5; border-radius: 999px; height: 10px; overflow: hidden; }
.progress-bar > div { background: var(--orange); height: 100%; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 14px; }
.form-group input[type=text], .form-group input[type=email], .form-group input[type=password],
.form-group input[type=number], .form-group select, .form-group textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 15px; font-family: inherit;
}
.form-group textarea { min-height: 140px; resize: vertical; }
.hint { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

table { width: 100%; border-collapse: collapse; }
table th, table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 14px; }
table th { color: var(--text-muted); font-weight: 600; font-size: 13px; text-transform: uppercase; }

.flash-error { background: #FDEBEB; color: var(--red); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }
.flash-ok { background: #E4F6EA; color: var(--green); padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; }

.module-list { list-style: none; margin: 0; padding: 0; }
.module-list li {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 10px; background: #fff;
}
.module-list li.locked { opacity: .6; }
.module-list .module-meta { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.lesson-list li:last-child { border-bottom: none; }
.check { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.check.done { background: var(--green); border-color: var(--green); color: #fff; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--navy); background-image: radial-gradient(circle at 85% 15%, var(--navy-light) 0%, var(--navy) 55%); padding: 20px; }
.login-box { background: #fff; padding: 40px; border-radius: 14px; width: 380px; max-width: 100%; border-top: 4px solid var(--orange); box-shadow: 0 24px 60px rgba(13,18,51,0.35); }
.login-box .brand { display: flex; align-items: center; gap: 10px; justify-content: center; margin-bottom: 6px; }
.login-box .brand .dot { width: 14px; height: 14px; border-radius: 50%; background: var(--orange); }
.login-box .brand span { font-family: Georgia, serif; font-weight: 700; font-size: 22px; color: var(--navy); }
.login-sub { text-align: center; font-size: 13px; color: var(--text-muted); margin: 0 0 26px 0; }
.login-access-note { margin: 22px 0 0 0; padding-top: 18px; border-top: 1px solid var(--border); font-size: 12.5px; line-height: 1.5; color: var(--text-muted); text-align: center; }
.login-access-note a { color: var(--orange); font-weight: 600; }

.quiz-question { margin-bottom: 22px; }
.quiz-question p.qtext { font-weight: 600; margin-bottom: 10px; }
.quiz-question label { display: block; padding: 8px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; cursor: pointer; }
.quiz-question label:hover { border-color: var(--orange); }
.quiz-question input { margin-right: 8px; }

.result-box { text-align: center; padding: 40px 20px; }
.result-score { font-size: 48px; font-weight: 700; font-family: Georgia, serif; }
.result-score.pass { color: var(--green); }
.result-score.fail { color: var(--red); }

.actions-row { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }

.chat-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.chat-msg { max-width: 70%; padding: 10px 14px; border-radius: 12px; }
.chat-msg .meta { font-size: 12px; opacity: .7; margin-bottom: 4px; }
.chat-msg .body { white-space: pre-wrap; }
.chat-msg.student { align-self: flex-start; background: #EDEEF5; }
.chat-msg.admin { align-self: flex-end; background: var(--navy); color: #fff; }
.chat-msg.admin .meta { color: #C9CCF0; }
.chat-empty { color: var(--text-muted); padding: 20px 0; text-align: center; }
.text-muted { color: var(--text-muted); }
.mb-0 { margin-bottom: 0; }
