:root {
  font-family: "Segoe UI", "Aptos", system-ui, sans-serif;
  color: #18201f;
  background: #f5f2ed;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
}

button {
  font: inherit;
}

input,
select {
  width: 100%;
  border: 1px solid #d8cfbe;
  border-radius: 7px;
  background: #fffdf8;
  color: #18201f;
  font: inherit;
  padding: 11px 12px;
}

label {
  display: grid;
  gap: 7px;
  color: #3f4744;
  font-weight: 750;
}

.auth-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top left, #fff7e6 0, #f5f2ed 36%, #ece6dc 100%);
}

.auth-panel {
  width: min(100%, 460px);
  background: #fffdf8;
  border: 1px solid #e1d8c8;
  border-radius: 8px;
  padding: 28px;
}

.auth-brand {
  margin-bottom: 24px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 20px;
}

.auth-tabs button,
.ghost-button {
  border: 1px solid #d8cfbe;
  border-radius: 7px;
  background: #fffaf0;
  color: #28302d;
  padding: 10px 12px;
  font-weight: 800;
  cursor: pointer;
}

.auth-tabs button.active {
  background: #18201f;
  border-color: #18201f;
  color: #fffdf8;
}

.ghost-button.active {
  border-color: rgba(214, 177, 95, 0.55);
  background: rgba(214, 177, 95, 0.16);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-note,
.form-message,
.muted {
  margin: 0;
  color: #6d6d66;
  line-height: 1.5;
}

.form-message:not(:empty) {
  color: #8a3028;
  font-weight: 750;
}

.app-shell {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  padding: 26px;
  background: #16201e;
  color: #f7f4ee;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #d6b15f;
  color: #16201e;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 6px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #9c7c3a;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.4rem;
}

.course-nav {
  display: grid;
  gap: 8px;
}

.user-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
}

.user-card > span {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(214, 177, 95, 0.18);
  color: #d6b15f;
  font-weight: 900;
}

.user-card strong,
.user-card small {
  display: block;
}

.user-card small {
  margin-top: 3px;
  color: rgba(247, 244, 238, 0.62);
}

.course-tab {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: inherit;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 20px;
  align-items: center;
  gap: 12px;
  text-align: left;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.course-tab:hover,
.course-tab.active {
  background: rgba(214, 177, 95, 0.16);
  border-color: rgba(214, 177, 95, 0.55);
}

.course-tab:active {
  transform: translateY(1px);
}

.course-number {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
  color: #d6b15f;
}

.course-tab strong,
.course-tab small {
  display: block;
}

.course-tab strong {
  font-size: 0.98rem;
}

.course-tab small {
  margin-top: 3px;
  color: rgba(247, 244, 238, 0.62);
}

.sidebar-status {
  margin-top: auto;
  display: grid;
  gap: 10px;
  font-size: 0.92rem;
  color: rgba(247, 244, 238, 0.72);
}

.sidebar-actions {
  display: grid;
  gap: 8px;
}

.sidebar-actions .ghost-button {
  background: rgba(255, 255, 255, 0.05);
  color: #f7f4ee;
  border-color: rgba(255, 255, 255, 0.14);
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}

.progress-track span {
  display: block;
  height: 100%;
  background: #d6b15f;
}

.content {
  min-width: 0;
  padding: 34px clamp(18px, 4vw, 58px) 58px;
}

.mobile-menu,
.menu-close,
.menu-scrim {
  display: none;
}

.course-hero {
  max-width: 1240px;
  margin: 0 auto 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 28px;
  align-items: stretch;
}

.course-hero h2 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 5.4rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.course-hero p:not(.eyebrow) {
  max-width: 670px;
  margin: 22px 0 0;
  color: #5e625d;
  font-size: 1.08rem;
  line-height: 1.7;
}

.hero-panel {
  background: #fffdf8;
  border: 1px solid #e1d8c8;
  border-radius: 8px;
  padding: 18px;
  display: grid;
  gap: 14px;
  align-content: center;
}

.metric {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  border-bottom: 1px solid #eee5d8;
  padding-bottom: 12px;
}

.metric span {
  font-size: 2rem;
  font-weight: 800;
}

.metric small {
  color: #6d6d66;
}

.pass-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #7b6535;
  font-weight: 800;
}

.pass-badge.passed {
  color: #247555;
}

.course-grid {
  max-width: 1240px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 28px;
  align-items: start;
}

.lesson-stack {
  display: grid;
  gap: 18px;
}

.outcome,
.lesson,
.rail-card {
  background: #fffdf8;
  border: 1px solid #e1d8c8;
  border-radius: 8px;
}

.outcome {
  display: flex;
  gap: 16px;
  padding: 22px;
}

.text-icon,
.section-kicker {
  color: #9c7c3a;
  font-weight: 900;
}

.section-kicker {
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.outcome .text-icon {
  flex: 0 0 auto;
  color: #9c7c3a;
}

.outcome h3,
.lesson h3,
.rail-card h3 {
  margin: 0;
  color: #18201f;
}

.outcome p,
.lesson p,
.rail-card p {
  color: #5f635e;
  line-height: 1.68;
}

.lesson {
  padding: clamp(20px, 4vw, 34px);
}

.lesson-heading {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px;
}

.lesson-heading span {
  color: #9c7c3a;
  font-weight: 900;
}

.lesson-heading h3 {
  font-size: 1.45rem;
}

.callout {
  margin: 18px 0;
  padding: 16px 18px;
  border-left: 4px solid #d6b15f;
  background: #fbf4e4;
  color: #443a27;
  font-weight: 750;
}

.checklist,
.attachment-list {
  list-style: none;
  padding: 0;
  margin: 18px 0 0;
  display: grid;
  gap: 10px;
}

.checklist li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  color: #3f4744;
}

.checklist span {
  color: #247555;
}

.complete-button,
.submit-quiz {
  border: 0;
  border-radius: 7px;
  background: #18201f;
  color: #fffdf8;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.complete-button {
  margin-top: 20px;
}

.complete-button.done {
  background: #247555;
}

.complete-button:active,
.submit-quiz:active,
.mobile-menu:active {
  transform: translateY(1px);
}

.mobile-menu {
  border: 0;
  border-radius: 7px;
  background: #18201f;
  color: #fffdf8;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease;
}

.right-rail {
  position: sticky;
  top: 22px;
  display: grid;
  gap: 18px;
}

.rail-card {
  padding: 20px;
}

.rail-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rail-title .text-icon {
  color: #9c7c3a;
}

.attachment-list li {
  padding: 11px 0;
  border-top: 1px solid #eee5d8;
  color: #3f4744;
}

.quiz-list {
  display: grid;
  gap: 18px;
}

.knownman-quiz {
  scroll-margin-top: 18px;
}

.knownman-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.knownman-question {
  padding: 16px;
  border: 1px solid #eee5d8;
  border-radius: 8px;
  background: #fffaf0;
}

.knownman-question .answer {
  background: #fffdf8;
}

.quiz-question h4 {
  margin: 0 0 10px;
  color: #18201f;
  line-height: 1.35;
}

.quiz-question small {
  display: block;
  margin-top: 8px;
  color: #6c6252;
  line-height: 1.45;
}

.answer {
  width: 100%;
  text-align: left;
  border: 1px solid #e2d9c8;
  background: #fffaf0;
  color: #29302d;
  border-radius: 7px;
  padding: 10px 11px;
  margin-top: 7px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.answer input {
  margin-top: 3px;
}

.answer.selected {
  border-color: #9c7c3a;
  background: #fbf0d6;
}

.answer.correct {
  border-color: #247555;
  background: #e9f5ee;
}

.answer.wrong {
  border-color: #a8463d;
  background: #f8e8e6;
}

.submit-quiz {
  width: 100%;
  margin-top: 18px;
}

.submit-quiz:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.result {
  margin-top: 14px;
  padding: 13px;
  border-radius: 7px;
  background: #f8e8e6;
  color: #8a3028;
  display: flex;
  align-items: center;
  gap: 9px;
}

.result[hidden] {
  display: none;
}

.result.passed {
  background: #e9f5ee;
  color: #247555;
}

.admin-panel {
  max-width: 1240px;
  margin: 0 auto;
}

.admin-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.admin-head-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.admin-head h2 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
}

.admin-users {
  display: grid;
  gap: 18px;
}

.admin-user {
  background: #fffdf8;
  border: 1px solid #e1d8c8;
  border-radius: 8px;
  padding: 18px;
}

.admin-user-form {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr) auto;
  gap: 14px;
  align-items: end;
}

.admin-user-form > div {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.admin-user-form > div:nth-child(2) {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.upload-panel {
  margin-bottom: 18px;
}

.upload-panel h3 {
  margin: 0 0 14px;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.4fr) auto;
  gap: 12px;
  align-items: end;
}

.admin-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.admin-stats span {
  border-radius: 7px;
  background: #f2eadc;
  color: #453d30;
  padding: 8px 10px;
  font-weight: 800;
}

.admin-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  border-top: 1px solid #eee5d8;
  padding-top: 14px;
}

.admin-detail h3 {
  margin: 0 0 8px;
}

.admin-detail p {
  margin: 7px 0;
  color: #4f5753;
  line-height: 1.5;
}

.attempt-detail {
  margin-bottom: 12px;
}

.attempt-detail ul {
  list-style: none;
  display: grid;
  gap: 6px;
  margin: 8px 0 0;
  padding: 0;
}

.attempt-detail li {
  color: #4f5753;
  line-height: 1.45;
}

.attempt-detail li span {
  color: #9c7c3a;
  font-weight: 900;
}

.attempt-detail em {
  color: #8a3028;
  font-style: normal;
  font-weight: 750;
}

@media (max-width: 980px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 340px);
    transform: translateX(-105%);
    transition: transform 220ms ease;
    z-index: 3;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-menu {
    display: inline-flex;
    margin-bottom: 20px;
  }

  .menu-scrim {
    display: none;
    position: fixed;
    inset: 0;
    border: 0;
    background: rgba(22, 32, 30, 0.35);
    z-index: 2;
  }

  .menu-scrim.visible {
    display: block;
  }

  .menu-close.visible {
    display: grid;
    position: fixed;
    top: 16px;
    left: min(calc(88vw - 52px), 288px);
    z-index: 4;
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 7px;
    background: rgba(255, 255, 255, 0.12);
    color: #fffdf8;
    place-items: center;
  }

  .course-hero,
  .course-grid {
    grid-template-columns: 1fr;
  }

  .right-rail {
    position: static;
  }

  .admin-user-form,
  .upload-form,
  .admin-detail {
    grid-template-columns: 1fr;
  }

  .admin-user-form > div,
  .admin-user-form > div:nth-child(2) {
    grid-template-columns: 1fr;
  }

  .admin-head {
    display: grid;
  }
}

@media (max-width: 620px) {
  .content {
    padding: 18px 14px 38px;
  }

  .course-hero h2 {
    font-size: 2.55rem;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }
}
