/* ============================================================
   JSS CareerReady — clean, polished design system
   ============================================================ */
:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --border: #e6e9f0;
  --border-strong: #d4d9e4;
  --text: #1a2233;
  --text-soft: #5b6478;
  --text-mute: #939bad;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1ff;
  --green: #16a34a;
  --green-soft: #e7f6ec;
  --amber: #d97706;
  --amber-soft: #fdf1e0;
  --red: #dc2626;
  --red-soft: #fdeaea;
  --purple: #7c3aed;
  --purple-soft: #f1eafe;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16,24,40,.05);
  --shadow: 0 4px 16px rgba(16,24,40,.07);
  --shadow-lg: 0 12px 40px rgba(16,24,40,.14);
  --sidebar-w: 258px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14.5px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3, h4 { line-height: 1.25; color: var(--text); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border: 1px solid transparent; border-radius: var(--radius-sm);
  font-weight: 600; font-size: 14px; background: var(--surface-2); color: var(--text);
  transition: all .15s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn i { font-size: 13px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text-soft); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--red-soft); color: var(--red); }
.btn-danger:hover { background: #fbdcdc; }
.btn-sm { padding: 6px 12px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

/* ---------- Login ---------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: linear-gradient(135deg, #eef3ff 0%, #f4f6fb 45%, #ecfdf5 100%);
}
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 20px;
  box-shadow: var(--shadow-lg); padding: 38px 34px; border: 1px solid var(--border);
}
.login-logo {
  width: 56px; height: 56px; border-radius: 16px; background: var(--primary);
  display: grid; place-items: center; color: #fff; font-size: 26px; margin: 0 auto 18px;
  box-shadow: 0 8px 20px rgba(37,99,235,.35);
}
.login-card h1 { font-size: 22px; text-align: center; font-weight: 800; }
.login-card .sub { text-align: center; color: var(--text-soft); margin: 6px 0 26px; font-size: 13.5px; }
.login-hint {
  margin-top: 18px; padding: 12px 14px; background: var(--primary-soft); border-radius: 10px;
  font-size: 12.5px; color: var(--primary-dark); text-align: center;
}
.login-alt { margin-top: 16px; text-align: center; font-size: 13px; color: var(--text-soft); }
.login-alt a { font-weight: 700; }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-weight: 600; font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.field .hint { font-weight: 400; color: var(--text-mute); font-size: 12px; }
.input, .select, .textarea {
  width: 100%; padding: 10px 13px; border: 1px solid var(--border-strong); border-radius: 10px;
  background: var(--surface); color: var(--text); transition: border-color .15s, box-shadow .15s;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.textarea { resize: vertical; min-height: 84px; }
.form-error { color: var(--red); font-size: 13px; margin-top: 4px; min-height: 18px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

/* ---------- App layout ---------- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; position: fixed; inset: 0 auto 0 0; z-index: 40;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 11px; padding: 20px 22px; border-bottom: 1px solid var(--border);
}
.sidebar-brand .mark {
  width: 38px; height: 38px; border-radius: 11px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 18px; flex: none;
}
.sidebar-brand .name { font-weight: 800; font-size: 15.5px; }
.sidebar-brand .role { font-size: 11.5px; color: var(--text-mute); font-weight: 600; text-transform: capitalize; }
.nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.nav-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 10px;
  color: var(--text-soft); font-weight: 600; font-size: 14px; margin-bottom: 3px; transition: all .12s;
}
.nav-item i { width: 20px; text-align: center; font-size: 15px; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.active { background: var(--primary-soft); color: var(--primary-dark); }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border); }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-dark);
  display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none;
}
.user-chip .u-name { font-weight: 700; font-size: 13.5px; }
.user-chip .u-mail { font-size: 11.5px; color: var(--text-mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }
.topbar {
  height: 64px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 28px;
  position: sticky; top: 0; z-index: 30;
}
.topbar .page-title { font-size: 18px; font-weight: 700; }
.topbar .page-sub { font-size: 12.5px; color: var(--text-mute); }
.hamburger { display: none; background: none; border: none; font-size: 20px; color: var(--text-soft); }
.content { padding: 28px; max-width: 1180px; margin: 0 auto; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 20px;
}
.card + .card { margin-top: 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.card-head h2 { font-size: 16px; font-weight: 700; }
.card-head .sub { font-size: 12.5px; color: var(--text-mute); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* ---------- KPI cards ---------- */
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm); display: flex; align-items: center; gap: 16px;
}
.kpi .kpi-icon {
  width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; font-size: 19px; flex: none;
}
.kpi .kpi-val { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.kpi .kpi-label { font-size: 12.5px; color: var(--text-soft); font-weight: 600; }
.i-blue { background: var(--primary-soft); color: var(--primary); }
.i-green { background: var(--green-soft); color: var(--green); }
.i-amber { background: var(--amber-soft); color: var(--amber); }
.i-purple { background: var(--purple-soft); color: var(--purple); }
.i-red { background: var(--red-soft); color: var(--red); }

/* ---------- Table ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
table.tbl th {
  text-align: left; padding: 12px 16px; background: var(--surface-2); color: var(--text-soft);
  font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-bottom: 1px solid var(--border);
}
table.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tbl tr:last-child td { border-bottom: none; }
table.tbl tr:hover td { background: var(--surface-2); }

/* ---------- Badges & pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.badge-blue { background: var(--primary-soft); color: var(--primary-dark); }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red-soft); color: var(--red); }
.badge-purple { background: var(--purple-soft); color: var(--purple); }
.badge-gray { background: var(--surface-2); color: var(--text-soft); }

/* ---------- Progress bar ---------- */
.progress { height: 8px; background: var(--surface-2); border-radius: 20px; overflow: hidden; min-width: 90px; }
.progress > span { display: block; height: 100%; background: var(--primary); border-radius: 20px; transition: width .3s; }
.progress.g > span { background: var(--green); }

/* ---------- Empty state ---------- */
.empty {
  text-align: center; padding: 48px 24px; color: var(--text-mute);
}
.empty i { font-size: 40px; margin-bottom: 14px; color: var(--border-strong); display: block; }
.empty h3 { font-size: 16px; color: var(--text-soft); margin-bottom: 6px; }
.empty p { font-size: 13.5px; max-width: 340px; margin: 0 auto; }

/* ---------- Toast ---------- */
#toast { position: fixed; top: 20px; right: 20px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--text); color: #fff; padding: 12px 18px; border-radius: 10px; box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 10px; animation: toastIn .25s ease;
  max-width: 340px;
}
.toast.ok { background: #15803d; }
.toast.err { background: #b91c1c; }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,.5); z-index: 90;
  display: grid; place-items: center; padding: 24px; animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh; display: flex; flex-direction: column; animation: modalIn .2s ease;
}
.modal.wide { max-width: 760px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { padding: 20px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 17px; font-weight: 700; }
.modal-head .x { background: none; border: none; font-size: 20px; color: var(--text-mute); width: 32px; height: 32px; border-radius: 8px; }
.modal-head .x:hover { background: var(--surface-2); color: var(--text); }
.modal-body { padding: 24px; overflow-y: auto; }
.modal-foot { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Misc helpers ---------- */
.flex { display: flex; }
.between { justify-content: space-between; }
.center { align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.wrap { flex-wrap: wrap; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.text-soft { color: var(--text-soft); } .text-mute { color: var(--text-mute); }
.text-sm { font-size: 13px; } .text-xs { font-size: 12px; }
.fw-700 { font-weight: 700; }
.section-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--text-mute); margin-bottom: 12px; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.chart-box { position: relative; height: 260px; }
.list-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item .li-icon { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-size: 16px; flex: none; }
.li-title { font-weight: 700; font-size: 14px; }
.li-sub { font-size: 12.5px; color: var(--text-mute); }
.pill-row { display: flex; flex-wrap: wrap; gap: 8px; }
.spinner { width: 34px; height: 34px; border: 3px solid var(--border); border-top-color: var(--primary); border-radius: 50%; animation: spin .7s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* option builder */
.opt-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.opt-row input[type=radio] { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.opt-row .input { flex: 1; }
.opt-row .rm { background: var(--red-soft); color: var(--red); border: none; width: 34px; height: 34px; border-radius: 8px; flex: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .sidebar { transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .hamburger { display: block; }
  .content { padding: 18px; }
  .grid-4 { grid-template-columns: 1fr; }
  .sidebar-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 39; }
}

/* ============================================================
   Single-page layout additions (Guide + Student)
   ============================================================ */
.page-wrap { min-height: 100vh; display: flex; flex-direction: column; }
.appbar {
  height: 62px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 30;
}
.appbar .brand { display: flex; align-items: center; gap: 11px; }
.appbar .brand .mark {
  width: 36px; height: 36px; border-radius: 10px; background: var(--primary); color: #fff;
  display: grid; place-items: center; font-size: 17px; flex: none;
}
.appbar .brand .name { font-weight: 800; font-size: 15.5px; line-height: 1.1; }
.appbar .brand .role-tag { font-size: 11px; color: var(--text-mute); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }
.appbar .right { display: flex; align-items: center; gap: 10px; }
.appbar .who { text-align: right; line-height: 1.15; }
.appbar .who .n { font-weight: 700; font-size: 13.5px; }
.appbar .who .e { font-size: 11.5px; color: var(--text-mute); }

.tabbar {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 22px; display: flex; gap: 4px; overflow-x: auto; position: sticky; top: 62px; z-index: 29;
}
.tab {
  padding: 14px 16px; font-weight: 600; font-size: 14px; color: var(--text-soft);
  border: none; background: none; border-bottom: 2.5px solid transparent; white-space: nowrap; transition: all .12s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--primary-dark); border-bottom-color: var(--primary); }
.tab i { margin-right: 7px; }

.page-body { flex: 1; padding: 26px 22px; max-width: 1120px; margin: 0 auto; width: 100%; }
.page-intro { margin-bottom: 20px; }
.page-intro h1 { font-size: 21px; font-weight: 800; }
.page-intro p { color: var(--text-soft); font-size: 14px; margin-top: 3px; }

.role-select-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.pick-card {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius);
  padding: 20px; cursor: pointer; transition: all .15s;
}
.pick-card:hover { border-color: var(--primary); transform: translateY(-2px); box-shadow: var(--shadow); }
.pick-card.active { border-color: var(--primary); background: var(--primary-soft); }

.section-space > * + * { margin-top: 18px; }

.cred-box {
  background: var(--surface-2); border: 1px dashed var(--border-strong); border-radius: 10px;
  padding: 14px 16px; font-size: 14px;
}
.cred-box b { color: var(--primary-dark); }

@media (max-width: 760px) {
  .appbar .who { display: none; }
  .page-body { padding: 18px 14px; }
  .tabbar { padding: 0 10px; }
  .tab { padding: 13px 12px; font-size: 13.5px; }
}

/* ============================================================
   Feature-upgrade additions (v2)
   ============================================================ */

/* ---------- Question images ---------- */
.q-image { max-width: 320px; max-height: 240px; border-radius: 10px; display: block; margin-bottom: 12px; border: 1px solid var(--border); }
.q-thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; flex: none; border: 1px solid var(--border); }

/* ---------- Post-submit right/wrong feedback (student assessment) ---------- */
.opt-label.opt-correct-fb { background: var(--green-soft); border-radius: 8px; padding: 6px 8px; color: var(--green); font-weight: 700; }
.opt-label.opt-wrong-fb { background: var(--red-soft); border-radius: 8px; padding: 6px 8px; color: var(--red); font-weight: 700; }
.quiz-q input:disabled, .quiz-q textarea:disabled, .quiz-q input[data-answer]:disabled { opacity: .7; }

/* ---------- Guide's answer-review (manual grading) ---------- */
.review-opt { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 8px; font-size: 13.5px; }
.review-opt-correct { background: var(--green-soft); border-color: var(--green); color: var(--green); font-weight: 700; }
.review-opt-wrong { background: var(--red-soft); border-color: var(--red); color: var(--red); font-weight: 700; }

/* ---------- Task progress notes ---------- */
.task-notes-row td { border-bottom: 1px solid var(--border); padding-top: 0; }
.task-notes { background: var(--surface-2); border-radius: var(--radius-sm); padding: 12px 14px; margin: -6px 0 10px; }
.task-note { font-size: 13px; color: var(--text-soft); margin-bottom: 6px; }
.task-note:last-of-type { margin-bottom: 0; }
.task-note i { color: var(--text-mute); margin-right: 4px; }

/* ---------- Roadmap — vertical timeline ---------- */
.rm-progress-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 22px; }
.rm-progress-top { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.rm-progress-pct { font-size: 28px; font-weight: 800; color: var(--primary-dark); letter-spacing: -.5px; }
.rm-progress-label { font-size: 13px; color: var(--text-soft); font-weight: 600; }

.timeline { position: relative; padding-left: 6px; }
.timeline-stage-label {
  font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .5px;
  color: var(--primary-dark); margin: 24px 0 12px 56px;
}
.timeline-stage-label:first-child { margin-top: 2px; }
.timeline-item { position: relative; display: flex; gap: 16px; padding-bottom: 22px; cursor: pointer; }
.timeline-item:last-child { padding-bottom: 4px; }
.timeline-item:not(:last-child)::before {
  content: ''; position: absolute; left: 24px; top: 30px; bottom: -22px; width: 2px; background: var(--border-strong);
}
.timeline-item.done:not(:last-child)::before { background: var(--green); }
.timeline-node {
  position: relative; z-index: 1; flex: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--surface); border: 2.5px solid var(--border-strong); display: grid; place-items: center;
  color: transparent; font-size: 13px; margin-left: 10px; transition: all .15s;
}
.timeline-item.done .timeline-node { background: var(--green); border-color: var(--green); color: #fff; }
.timeline-content {
  flex: 1; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 16px; transition: all .15s;
}
.timeline-item:hover .timeline-content { border-color: var(--primary); }
.timeline-item.done .timeline-content { background: var(--green-soft); border-color: transparent; }
.timeline-task { font-weight: 600; font-size: 14px; }
.timeline-item.done .timeline-task { text-decoration: line-through; color: var(--text-soft); }
