* { box-sizing: border-box; }
body {
  margin: 0;
  background: #f4f5f7;
  color: #0f172a;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: #2563eb; text-decoration: none; }
a:hover { color: #1d4ed8; }
button { font-family: inherit; cursor: pointer; }
select, input { font-family: inherit; }

.btn {
  height: 40px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 600;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}
.btn-primary { background: #2563eb; color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-secondary { background: #fff; color: #0f172a; border: 1px solid #d7dbe2; }
.btn-secondary:hover { background: #f4f5f7; }
.btn-text { background: transparent; color: #2563eb; border: 0; }
.btn-text:hover { background: #eff4ff; }
.btn:disabled { background: #a8c2f8; cursor: not-allowed; }

.card {
  background: #fff;
  border: 1px solid #e6e8ec;
  border-radius: 12px;
}

.kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .09em;
  color: #94a3b8;
}

.progress-track {
  height: 8px;
  background: #e8eaee;
  border-radius: 99px;
  position: relative;
}
.progress-fill {
  position: absolute;
  left: 0; top: 0;
  height: 8px;
  border-radius: 99px;
  background: #2563eb;
}

.tag {
  display: inline-flex;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
}
.tag-certified { background: #e7f5ed; color: #1a7f47; }
.tag-progress { background: #eff4ff; color: #1d4ed8; }
.tag-behind { background: #fdecec; color: #b42318; }
.tag-locked { background: #f1f2f5; color: #64748b; }

/* Auth split screen */
.auth-wrap { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); min-height: 100vh; }
.auth-brand { background: #1e293b; color: #fff; padding: 56px 56px 44px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 56px; }
.auth-form { width: 100%; max-width: 340px; }
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; padding: 0 12px; height: 40px; font-size: 14px; color: #0f172a;
  background: #fff; border: 1px solid #d7dbe2; border-radius: 8px; outline: none; font-family: inherit;
}
.field textarea { height: auto; padding: 10px 12px; resize: vertical; }
.error-msg { font-size: 13px; color: #b42318; margin: 0 0 14px; }
.info-msg { font-size: 13px; color: #1a7f47; margin: 0 0 14px; }

/* App shell */
.app-shell { display: grid; grid-template-columns: 240px minmax(0,1fr); min-height: 100vh; }
.sidebar { background: #1e293b; color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar-nav { padding: 0 16px; display: flex; flex-direction: column; gap: 4px; }
.sidebar-nav a { display: block; padding: 9px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #cbd5e1; }
.sidebar-nav a.active { background: #2563eb; color: #fff; }
.sidebar-section-label { padding: 0 20px 8px; font-size: 11px; font-weight: 700; letter-spacing: .09em; color: #64748b; }
.sidebar-divider { margin: 18px 20px; height: 1px; background: #334155; }
main { padding: 28px 36px 72px; }

.skillset-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(300px,1fr)); gap: 14px; }
.lesson-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(340px,1fr)); gap: 14px; }
.lesson-grid .kicker, .lesson-grid .tag { white-space: nowrap; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(170px,1fr)); gap: 14px; margin-bottom: 18px; }

.clickable-card { cursor: pointer; }
.clickable-card:hover { border-color: #2563eb; }

.quiz-option {
  display: grid; grid-template-columns: 26px minmax(0,1fr); gap: 14px; align-items: center;
  padding: 14px 16px; border-radius: 10px; cursor: pointer; border: 1px solid #e0e3e8; background: #fff;
}
.quiz-option.selected { border-color: #2563eb; background: #f7faff; }
.quiz-option.correct { border-color: #1a7f47; background: #f3faf6; }
.quiz-option.incorrect { border-color: #b42318; background: #fdf5f4; }
.quiz-option.disabled { cursor: default; }
.quiz-mark {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: #f1f2f5; color: #64748b; border: 1px solid #e0e3e8;
}
.quiz-option.selected .quiz-mark { background: #2563eb; color: #fff; border-color: #2563eb; }
.quiz-option.correct .quiz-mark { background: #1a7f47; color: #fff; border-color: #1a7f47; }
.quiz-option.incorrect .quiz-mark { background: #b42318; color: #fff; border-color: #b42318; }

.video-embed { aspect-ratio: 16/9; background: #e8eaee; border-radius: 10px; overflow: hidden; margin-bottom: 8px; }
.video-embed iframe { width: 100%; height: 100%; border: 0; }
.video-placeholder { aspect-ratio: 16/9; background: #e8eaee; border-radius: 10px; display: grid; place-items: center; margin-bottom: 8px; text-align: center; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .07em; color: #94a3b8; padding: 12px 22px; border-bottom: 1px solid #eef0f3; }
td { padding: 14px 22px; border-bottom: 1px solid #f1f2f5; }

/* Content editor */
.content-field {
  width: 100%; padding: 8px 12px; font-size: 14px; color: #0f172a; font-family: inherit;
  background: #fff; border: 1px solid #d7dbe2; border-radius: 8px; outline: none; resize: vertical; margin-bottom: 4px;
}

.content-title-input {
  width: 100%; font-size: 17px; font-weight: 700; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 8px; margin: -6px -8px 4px; outline: none;
}
.content-title-input:hover, .content-title-input:focus { border-color: #d7dbe2; background: #fbfbfc; }
.content-blurb-input {
  width: 100%; font-size: 13px; color: #64748b; border: 1px solid transparent; border-radius: 8px;
  padding: 6px 8px; margin: 0 -8px 10px; outline: none; font-family: inherit; resize: vertical;
}
.content-blurb-input:hover, .content-blurb-input:focus { border-color: #d7dbe2; background: #fbfbfc; }

.save-flash { font-size: 12px; font-weight: 600; color: #1a7f47; opacity: 0; transition: opacity .2s; }
.save-flash.show { opacity: 1; }
.save-flash.error { color: #b42318; }

.content-lesson-list { border-top: 1px solid #eef0f3; margin-top: 6px; }
.content-lesson-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
  padding: 10px 0; border-bottom: 1px solid #f1f2f5;
}
.content-lesson-pos { flex: 0 0 auto; font-size: 12px; color: #94a3b8; }
.content-lesson-title { flex: 1 1 200px; min-width: 160px; font-size: 14px; font-weight: 600; color: #0f172a; }
.content-lesson-title:hover { color: #2563eb; }
.content-lesson-flags { display: flex; gap: 6px; flex: 0 0 auto; }
.content-status {
  font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; background: #f1f2f5; color: #94a3b8; white-space: nowrap;
}
.content-status.on { background: #eff4ff; color: #1d4ed8; }
.content-lesson-actions { display: flex; gap: 4px; flex: 0 0 auto; margin-left: auto; }
.icon-btn {
  width: 26px; height: 26px; border-radius: 6px; border: 1px solid #d7dbe2; background: #fff;
  color: #475569; font-size: 13px; display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: #f4f5f7; }
.icon-btn:disabled { opacity: .35; cursor: not-allowed; }
.icon-btn-danger { color: #b42318; border-color: #f6d5d2; }
.icon-btn-danger:hover { background: #fdf5f4; }

.content-add-lesson { display: flex; gap: 10px; margin-top: 14px; }
.content-add-lesson input {
  flex: 1; height: 36px; padding: 0 12px; font-size: 13px; border: 1px solid #d7dbe2; border-radius: 8px; outline: none;
}

.content-preview {
  border: 1px dashed #d7dbe2; border-radius: 10px; padding: 18px 20px; background: #fbfbfc;
}

/* Shared rendering for lesson body content -- used both on the live lesson
   page and the admin content editor's preview panel, so they always match. */
.lesson-body { font-size: 15px; line-height: 1.65; color: #334155; }
.lesson-body h2 { font-size: 20px; font-weight: 700; color: #0f172a; margin: 28px 0 12px; }
.lesson-body h2:first-child { margin-top: 0; }
.lesson-body h3 { font-size: 16px; font-weight: 700; color: #0f172a; margin: 20px 0 8px; }
.lesson-body p { margin: 0 0 14px; }
.lesson-body ul, .lesson-body ol { margin: 0 0 14px; padding-left: 22px; }
.lesson-body li { margin-bottom: 6px; }
.lesson-body strong { color: #0f172a; }
.lesson-body blockquote {
  background: #eff4ff; border-left: 3px solid #2563eb; border-radius: 0 8px 8px 0;
  padding: 14px 18px; margin: 0 0 18px; color: #1e3a8a; font-style: italic;
}
.lesson-body .lesson-highlight {
  background: #eff4ff; border: 1px solid #c7d7fb; border-left: 4px solid #2563eb; border-radius: 10px;
  padding: 20px 24px 8px; margin: 0 0 28px;
}
.lesson-body .lesson-highlight > :last-child { margin-bottom: 14px; }
.lesson-body .lesson-mission {
  background: #fff; border: 2px solid #2563eb; border-radius: 10px; padding: 18px 22px; margin: 6px 0 20px;
  font-size: 20px; line-height: 1.4; font-weight: 700; color: #0f172a; text-align: center;
}
.lesson-body .lesson-mission::before {
  content: 'OUR MISSION'; display: block; font-size: 11px; letter-spacing: .12em; font-weight: 700; color: #2563eb; margin-bottom: 6px;
}
.lesson-body a { color: #2563eb; font-weight: 600; }
.lesson-body table { width: 100%; border-collapse: collapse; margin: 0 0 18px; font-size: 14px; }
.lesson-body th { text-align: left; background: #f4f5f7; font-weight: 700; color: #475569; padding: 10px 14px; border-bottom: 1px solid #e6e8ec; }
.lesson-body td { padding: 10px 14px; border-bottom: 1px solid #eef0f3; vertical-align: top; }
.lesson-body table tr:last-child td { border-bottom: 0; }

.content-question textarea, .content-question input[type=text] { width: 100%; margin-bottom: 4px; }
.quiz-edit-options { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.quiz-edit-option { display: flex; align-items: center; gap: 10px; }
.quiz-edit-label { font-size: 12px; font-weight: 700; color: #64748b; width: 14px; }
.quiz-edit-option-text { flex: 1; height: 36px; padding: 0 10px; font-size: 13px; border: 1px solid #d7dbe2; border-radius: 8px; outline: none; }

/* Lesson feedback */
.fb-btn.fb-on { background: #eff4ff; border-color: #2563eb; color: #1d4ed8; }

/* Celebration popup */
.celebrate-overlay {
  position: fixed; inset: 0; z-index: 1000; background: rgba(15, 23, 42, .55);
  display: flex; align-items: center; justify-content: center; padding: 20px; overflow: hidden;
}
.celebrate-card {
  position: relative; background: #fff; border-radius: 16px; padding: 32px 36px; max-width: 460px; width: 100%;
  text-align: center; box-shadow: 0 20px 60px rgba(15, 23, 42, .35);
}
.celebrate-card h2 { font-size: 26px; font-weight: 700; margin: 0 0 16px; color: #0f172a; }
.celebrate-set { background: #e7f5ed; border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; color: #14532d; }
.celebrate-raise { font-size: 20px; font-weight: 700; color: #1a7f47; margin-top: 4px; }
.celebrate-list { text-align: left; font-size: 14px; line-height: 1.6; color: #334155; margin: 0 0 14px; padding-left: 20px; }
.celebrate-total { font-size: 14px; color: #475569; margin: 0 0 16px; }
.celebrate-note { font-size: 12px; color: #94a3b8; margin: -6px 0 14px; }
.celebrate-card .btn { margin-top: 6px; }
.celebrate-confetti { position: absolute; inset: 0; pointer-events: none; }
.celebrate-confetti i {
  position: absolute; top: -14px; width: 9px; height: 15px; border-radius: 2px; opacity: .9;
  animation: celebrate-fall 3.2s ease-in infinite;
}
@keyframes celebrate-fall {
  0% { transform: translateY(0) rotate(0deg); }
  100% { transform: translateY(110vh) rotate(540deg); }
}
@media (prefers-reduced-motion: reduce) { .celebrate-confetti { display: none; } }

/* ---- Brand chat ---- */
.app-shell { display: flex; height: 100vh; height: 100dvh; }
.side { width: 270px; background: #0f172a; color: #e2e8f0; display: flex; flex-direction: column; padding: 16px; flex-shrink: 0; }
.side .brand { font-weight: 700; font-size: 16px; margin-bottom: 14px; }
.side .new-chat { background: #2563eb; color: #fff; border: 0; border-radius: 8px; height: 40px; font-weight: 600; font-size: 14px; }
.side .convs { flex: 1; overflow-y: auto; margin: 14px -6px; }
.side .conv { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: #cbd5e1; cursor: pointer; }
.side .conv:hover, .side .conv.active { background: #1e293b; color: #fff; }
.side .conv span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side .conv button { background: none; border: 0; color: #64748b; font-size: 16px; display: none; }
.side .conv:hover button { display: block; }
.side .foot { font-size: 13px; color: #94a3b8; border-top: 1px solid #1e293b; padding-top: 12px; }
.side .foot a, .side .foot button { color: #cbd5e1; background: none; border: 0; padding: 0; font-size: 13px; margin-right: 12px; }
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: none; align-items: center; gap: 10px; padding: 10px 14px; background: #0f172a; color: #fff; }
.topbar button { background: none; border: 0; color: #fff; font-size: 22px; }
.msgs { flex: 1; overflow-y: auto; padding: 24px 16px; }
.msgs-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.empty { text-align: center; margin-top: 8vh; }
.empty h1 { font-size: 28px; margin: 0 0 8px; }
.empty p { color: #64748b; margin: 0 0 22px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip { background: #fff; border: 1px solid #d7dbe2; border-radius: 99px; padding: 8px 14px; font-size: 13px; color: #0f172a; }
.chip:hover { border-color: #2563eb; color: #2563eb; }
.msg { max-width: 88%; line-height: 1.55; font-size: 15px; }
.msg.user { align-self: flex-end; background: #2563eb; color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; }
.msg.bot { align-self: flex-start; background: #fff; border: 1px solid #e6e8ec; padding: 12px 16px; border-radius: 14px 14px 14px 4px; }
.msg.bot p { margin: 0 0 8px; } .msg.bot p:last-child { margin: 0; }
.msg.bot ul { margin: 4px 0 8px; padding-left: 20px; }
.msg.bot .src { color: #64748b; font-size: 13px; }
.fb { margin-top: 8px; display: flex; gap: 6px; }
.fb button { background: none; border: 1px solid #e6e8ec; border-radius: 6px; padding: 2px 8px; font-size: 13px; color: #64748b; }
.fb button.on { border-color: #2563eb; color: #2563eb; background: #eff4ff; }
.dots::after { content: '…'; animation: blink 1s infinite; }
@keyframes blink { 50% { opacity: .2; } }
.composer { padding: 12px 16px 18px; }
.composer form { max-width: 760px; margin: 0 auto; display: flex; gap: 8px; }
.composer textarea { flex: 1; resize: none; border: 1px solid #d7dbe2; border-radius: 10px; padding: 11px 14px; font-size: 15px; font-family: inherit; max-height: 140px; }
.composer textarea:focus { outline: 2px solid #bfd3ff; border-color: #2563eb; }
.composer .btn { height: 44px; }
.composer .note { max-width: 760px; margin: 6px auto 0; font-size: 12px; color: #94a3b8; text-align: center; }
@media (max-width: 780px) {
  .side { position: fixed; z-index: 20; inset: 0 auto 0 0; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .topbar { display: flex; }
  .msg { max-width: 96%; }
}

/* ---- Admin ---- */
.admin-wrap { max-width: 980px; margin: 0 auto; padding: 24px 16px 60px; }
.admin-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 18px; }
.tab { background: #fff; border: 1px solid #d7dbe2; border-radius: 8px; padding: 8px 16px; font-size: 14px; font-weight: 600; }
.tab.on { background: #0f172a; color: #fff; border-color: #0f172a; }
.panel { padding: 18px; margin-bottom: 18px; }
.panel h3 { margin: 0 0 12px; font-size: 16px; }
.row-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.row-form input, .row-form select, .row-form textarea { border: 1px solid #d7dbe2; border-radius: 8px; padding: 9px 12px; font-size: 14px; }
.tbl-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; color: #94a3b8; letter-spacing: .06em; padding: 6px 8px; }
.tbl td { padding: 9px 8px; border-top: 1px solid #eef0f3; vertical-align: top; }
.muted { color: #64748b; font-size: 13px; }
.tag { font-size: 12px; background: #eef2ff; color: #3730a3; padding: 2px 8px; border-radius: 99px; }
.tag.off { background: #f1f5f9; color: #64748b; }
.tag.bad { background: #fee2e2; color: #991b1b; }
.bar { height: 8px; background: #e8eaee; border-radius: 99px; overflow: hidden; margin: 6px 0; }
.bar > div { height: 100%; background: #2563eb; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 8px; font-size: 14px; display: none; z-index: 50; }

.brands { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; max-width: 560px; margin: 0 auto; }
.brand-card { background: #fff; border: 1px solid #d7dbe2; border-radius: 12px; padding: 22px 30px; min-width: 170px; font-size: 18px; font-weight: 700; color: #0f172a; }
.brand-card:hover { border-color: #2563eb; color: #2563eb; box-shadow: 0 2px 10px rgba(37,99,235,.12); }
.brandbar { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px; background: #fff; border-bottom: 1px solid #e6e8ec; font-size: 14px; }
.composer textarea:disabled { background: #f1f5f9; cursor: not-allowed; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; margin-top: 10px; }
.cards:empty { display: none; }
.pcard { background: #fff; border: 1px solid #e6e8ec; display: flex; flex-direction: column; }
.pimg { display: block; aspect-ratio: 1; background: #fff; border-bottom: 1px solid #eef0f3; }
.pimg img { width: 100%; height: 100%; object-fit: contain; display: block; }
.pbody { padding: 10px 12px 12px; font-size: 13px; }
.ptitle { font-weight: 600; color: #0f172a; line-height: 1.3; margin-bottom: 3px; }
.pmeta { color: #64748b; font-size: 12px; margin-bottom: 6px; }
.plinks { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }

.fcard { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; padding: 14px 16px; background: #fff; border: 1px solid #d7dbe2; text-decoration: none; color: #0f172a; max-width: 460px; }
.fcard:hover { border-color: #b0202e; }
.fcard .ficon { width: 38px; height: 38px; background: #b0202e; color: #fff; display: flex; align-items: center; justify-content: center; font-size: 18px; flex-shrink: 0; }
.fcard strong { display: block; font-size: 14px; } .fcard small { color: #777; font-size: 12px; }
