:root {
  --ink: #131313;
  --muted: #667078;
  --line: #e1e5e7;
  --soft: #f6f8f9;
  --paper: #ffffff;
  --purple: #91a3b0;
  --purple-dark: #657985;
  --cadet-soft: #e8edf0;
  --gold: #91a3b0;
  --teal: #91a3b0;
  --danger: #b83c4c;
  --success: #187955;
  --sidebar: 252px;
}

* { box-sizing: border-box; }
html { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: #fff; }
body { margin: 0; min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #fff; color: var(--ink); border-right: 1px solid var(--line); padding: 30px 22px 22px; display: flex; flex-direction: column; z-index: 10; }
.brand { display: inline-flex; align-items: center; gap: 12px; font-size: 20px; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border: 2px solid currentColor; border-radius: 50% 50% 50% 12px; font-weight: 800; font-style: italic; }
.brand strong, .brand small { display: block; }
.brand small { font-size: 10px; letter-spacing: .22em; text-transform: uppercase; opacity: .62; margin-top: 1px; }
.sidebar nav { display: grid; gap: 8px; margin-top: 62px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; border-radius: 12px; padding: 12px 14px; color: #6f777c; font-size: 14px; font-weight: 600; transition: .2s ease; }
.sidebar nav a:hover, .sidebar nav a.active { background: var(--cadet-soft); color: var(--ink); }
.sidebar nav a.active { box-shadow: inset 3px 0 var(--purple); }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--line); padding-top: 20px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px; }
.sidebar-foot strong, .sidebar-foot small { display: block; max-width: 115px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-foot strong { font-size: 12px; }
.sidebar-foot small { color: #81898e; font-size: 10px; text-transform: capitalize; margin-top: 3px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--cadet-soft); color: var(--ink); font-weight: 800; font-size: 12px; }
.avatar.small { width: 32px; height: 32px; font-size: 10px; flex: 0 0 auto; }
.icon-button { border: 0; background: transparent; color: #6f777c; font-size: 18px; }
.main { margin-left: var(--sidebar); min-height: 100vh; padding: 52px clamp(28px, 5vw, 76px) 80px; background: #fff; }

.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .16em; font-size: 10px; font-weight: 800; color: var(--purple); }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(32px, 4vw, 52px); line-height: 1.05; letter-spacing: -.045em; margin-bottom: 15px; }
h2 { font-size: 23px; letter-spacing: -.025em; }
h3 { font-size: 23px; letter-spacing: -.03em; margin-bottom: 10px; }
.muted { color: var(--muted); font-size: 13px; }
.page-header { display: flex; justify-content: space-between; gap: 40px; align-items: center; max-width: 1220px; }
.page-header > div:first-child > p:last-child, .course-hero p, .lesson-head p, .assessment-head > p { max-width: 680px; color: var(--muted); line-height: 1.65; }
.progress-ring { --progress: 0deg; width: 112px; height: 112px; border-radius: 50%; background: conic-gradient(var(--purple) var(--progress), #e2e0e8 0); display: grid; place-items: center; position: relative; flex: 0 0 auto; }
.progress-ring::after { content: ""; position: absolute; inset: 9px; background: #fff; border-radius: 50%; }
.progress-ring span { position: relative; z-index: 1; text-align: center; }
.progress-ring strong, .progress-ring small { display: block; }
.progress-ring strong { font-size: 22px; }
.progress-ring small { color: var(--muted); font-size: 10px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; margin: 52px 0 18px; }
.section-head h2, .section-head p { margin-bottom: 0; }
.pill { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 10px; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: capitalize; white-space: nowrap; }

.course-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; max-width: 1220px; }
.course-card { min-height: 330px; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: 0 14px 40px rgba(19,19,19,.04); transition: transform .2s ease, box-shadow .2s ease; }
.course-card:hover { transform: translateY(-3px); box-shadow: 0 20px 50px rgba(16,17,20,.09); }
.course-top { display: flex; justify-content: space-between; align-items: center; }
.course-icon { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--cadet-soft); color: var(--ink); font-weight: 800; font-size: 20px; }
.course-card.gold .course-icon { background: #eef2f4; color: var(--ink); }
.course-card.teal .course-icon { background: #dfe7ea; color: var(--ink); }
.course-icon.mini { width: 34px; height: 34px; border-radius: 10px; font-size: 13px; flex: 0 0 auto; }
.status-dot { font-size: 10px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.course-card p:not(.eyebrow) { color: var(--muted); font-size: 13px; line-height: 1.55; }
.course-progress { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.course-progress > div { height: 5px; background: #ebe9ef; border-radius: 10px; overflow: hidden; }
.course-progress > div span { display: block; height: 100%; background: var(--purple); border-radius: 10px; }
.course-progress small { font-size: 10px; color: var(--muted); font-weight: 700; }
.attempt-badge { display: inline-block; width: fit-content; border-radius: 99px; padding: 6px 9px; font-size: 9px; letter-spacing: .05em; text-transform: uppercase; font-weight: 800; background: #eeeef2; color: #62646a; }
.attempt-badge.passed { color: var(--success); background: #e2f6ed; }
.attempt-badge.needs_retry { color: var(--danger); background: #fbe9ec; }
.attempt-badge.awaiting_review { color: #816014; background: #fbf2dc; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; max-width: 1220px; margin-top: 46px; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; }
.panel-head h2, .panel-head p { margin-bottom: 0; }
.attempt-row, .certificate-row { min-height: 58px; display: flex; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding: 12px 0; }
.attempt-row > span:nth-child(2), .certificate-row > span:nth-child(2) { flex: 1; }
.attempt-row strong, .attempt-row small, .certificate-row strong, .certificate-row small { display: block; }
.attempt-row strong, .certificate-row strong { font-size: 12px; }
.attempt-row small, .certificate-row small { color: var(--muted); font-size: 10px; margin-top: 4px; }
.certificate-row b { font-size: 10px; color: var(--purple); }
.certificate-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; color: var(--success); background: #e2f6ed; font-weight: 900; }
.empty-state { display: flex; align-items: center; justify-content: center; gap: 14px; min-height: 150px; text-align: left; color: var(--muted); }
.empty-state > span { font-size: 36px; color: #c9c8ce; }
.empty-state strong { display: block; color: var(--ink); font-size: 13px; }
.empty-state p { margin: 5px 0 0; font-size: 11px; }

.back-link { display: inline-block; margin-bottom: 28px; color: var(--muted); font-size: 12px; font-weight: 700; }
.back-link:hover { color: var(--purple); }
.course-hero { max-width: 1220px; min-height: 265px; border-radius: 24px; padding: 42px; background: linear-gradient(120deg, #f4f6f7, #e5ebee); color: var(--ink); border: 1px solid var(--line); display: flex; align-items: flex-end; justify-content: space-between; gap: 50px; overflow: hidden; position: relative; }
.course-hero::after { content: ""; position: absolute; width: 380px; height: 380px; border: 80px solid rgba(145,163,176,.12); border-radius: 50%; right: -90px; top: -130px; }
.course-hero.gold { background: linear-gradient(120deg, #f7f8f8, #e8edef); }
.course-hero.teal { background: linear-gradient(120deg, #f1f4f5, #dde6e9); }
.course-hero > * { position: relative; z-index: 1; }
.course-hero h1 { margin-bottom: 10px; }
.course-hero p { color: var(--muted); margin-bottom: 0; }
.hero-progress { min-width: 220px; }
.hero-progress strong { display: block; font-size: 32px; }
.hero-progress span { display: block; height: 6px; border-radius: 10px; background: rgba(19,19,19,.1); margin: 10px 0; overflow: hidden; }
.hero-progress i { display: block; height: 100%; background: var(--purple); border-radius: 10px; }
.hero-progress small { color: var(--muted); }
.lesson-list { display: grid; max-width: 900px; }
.lesson-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 18px; border-top: 1px solid var(--line); padding: 18px 4px; }
.lesson-row:last-child { border-bottom: 1px solid var(--line); }
.lesson-row:hover .lesson-action { color: var(--purple); transform: translateX(3px); }
.lesson-number { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 800; }
.lesson-number.done { color: var(--success); border-color: #b7e3d2; background: #eaf8f2; }
.lesson-copy small, .lesson-copy strong { display: block; }
.lesson-copy small { color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-size: 9px; margin-bottom: 4px; }
.lesson-copy strong { font-size: 14px; }
.lesson-action { color: var(--muted); font-size: 11px; font-weight: 800; transition: .2s ease; }
.assessment-card { max-width: 900px; margin-top: 40px; padding: 28px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; background: #fff; border: 1px solid var(--line); border-radius: 18px; }
.assessment-card h2 { margin-bottom: 8px; }
.assessment-card p:not(.eyebrow) { margin-bottom: 0; color: var(--muted); font-size: 12px; }
.assessment-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 15px; background: var(--cadet-soft); color: var(--ink); font-size: 22px; }
.alert { max-width: 900px; margin-top: 18px; border-radius: 12px; padding: 13px 15px; font-size: 12px; }
.alert-info { background: #e9f1fb; color: #315a85; }
.alert-error { background: #fbe9ec; color: var(--danger); margin: 18px 0; }

.lesson-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; max-width: 1220px; margin-bottom: 24px; }
.document-frame { max-width: 1220px; height: 70vh; min-height: 620px; background: #e7e7e9; border: 1px solid var(--line); border-radius: 18px; padding: 8px; overflow: hidden; }
.document-frame iframe { width: 100%; height: 100%; border: 0; border-radius: 11px; background: #fff; }
.document-frame.compact { height: 520px; min-height: 0; }
.lesson-footer { max-width: 1220px; display: flex; justify-content: space-between; align-items: center; padding: 22px 0; }

.button { display: inline-flex; align-items: center; justify-content: center; gap: 14px; min-height: 45px; padding: 0 18px; border: 0; border-radius: 11px; font-size: 12px; font-weight: 800; }
.button.primary { background: var(--purple); color: var(--ink); box-shadow: 0 8px 20px rgba(101,121,133,.18); }
.button.primary:hover { background: #8095a2; }
.button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.button.ghost { background: transparent; color: var(--purple); }
.button.disabled { background: #e8e7eb; color: #8c8d93; cursor: not-allowed; }
.text-link { color: var(--purple); font-size: 11px; font-weight: 800; }

.assessment-head { max-width: 900px; margin-bottom: 30px; }
.assessment-head > div { display: flex; gap: 12px; margin-top: 22px; }
.assessment-head > div span { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--muted); font-size: 11px; }
.assessment-head > div b { color: var(--ink); margin-left: 5px; }
.assessment-form { max-width: 1000px; }
.assessment-section { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 24px; margin-bottom: 24px; }
.assessment-section .section-head { margin: 0 0 18px; }
.answer-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.answer-grid label, .stack-form label, .login-form label { display: grid; gap: 7px; color: #4f5157; font-size: 11px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #d9d8de; border-radius: 10px; background: #fff; padding: 12px 13px; color: var(--ink); outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(112,71,235,.1); }
textarea { resize: vertical; line-height: 1.5; }
.submit-bar { position: sticky; bottom: 20px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 18px 20px; background: rgba(19,19,19,.97); color: #fff; border-radius: 15px; box-shadow: 0 15px 40px rgba(0,0,0,.2); }
.submit-bar strong, .submit-bar small { display: block; }
.submit-bar strong { font-size: 13px; }
.submit-bar small { color: #aaaeb7; font-size: 10px; margin-top: 4px; }

.admin-header { max-width: 1220px; }
.environment { border-radius: 999px; padding: 9px 12px; background: #fff; border: 1px solid var(--line); color: var(--muted); font-size: 10px; font-weight: 800; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; max-width: 1220px; margin-top: 38px; }
.metric-grid article { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 20px; }
.metric-grid span, .metric-grid strong, .metric-grid small { display: block; }
.metric-grid span { color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-grid strong { font-size: 34px; margin: 18px 0 4px; letter-spacing: -.04em; }
.metric-grid small { color: #9a9ba0; font-size: 10px; }
.admin-cols { grid-template-columns: 1.4fr .8fr; }
.stack-form { display: grid; gap: 14px; }
.stack-form .button { margin-top: 4px; }
.form-help { color: var(--muted); font-size: 10px; line-height: 1.5; }
.users-panel { max-width: 1220px; margin-top: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th, td { text-align: left; padding: 13px 8px; border-top: 1px solid var(--line); }
th { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.table-email, .table-score { display: block; color: var(--muted); font-size: 9px; margin-top: 4px; }
.table-progress { min-width: 115px; display: flex; align-items: center; gap: 8px; }
.table-progress > span { width: 78px; height: 5px; overflow: hidden; border-radius: 9px; background: #ebe9ef; }
.table-progress i { display: block; height: 100%; border-radius: 9px; background: var(--purple); }
.table-progress b { font-size: 9px; }
td > small { color: var(--muted); font-size: 9px; }
.review-head { max-width: 1220px; display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.review-head h1 { margin-bottom: 7px; }
.review-head p:not(.eyebrow) { color: var(--muted); }
.review-grid { max-width: 1220px; display: grid; grid-template-columns: 1.4fr .6fr; gap: 20px; align-items: start; }
.answer-card { border-top: 1px solid var(--line); padding: 15px 0; }
.answer-card > span { display: block; color: var(--purple); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }
.answer-card p { margin: 7px 0 0; white-space: pre-wrap; font-size: 12px; line-height: 1.65; }
.marking-panel { position: sticky; top: 24px; }

.login-body { background: #fff; min-height: 100vh; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: 1.08fr .92fr; }
.login-panel { min-height: 100vh; background: radial-gradient(circle at 88% 14%, rgba(145,163,176,.26), transparent 32%), #fff; color: var(--ink); border-right: 1px solid var(--line); padding: 54px clamp(38px, 7vw, 110px); display: flex; flex-direction: column; justify-content: space-between; }
.brand-dark { color: var(--ink); }
.login-panel h1 { max-width: 670px; font-size: clamp(45px, 6vw, 78px); }
.login-copy { max-width: 570px; color: var(--muted); line-height: 1.7; }
.login-note { color: #7d858a; font-size: 10px; }
.login-form-wrap { min-height: 100vh; background: var(--soft); display: grid; place-items: center; padding: 35px; }
.login-form { width: min(390px, 100%); }
.login-form h2 { font-size: 30px; margin-bottom: 32px; }
.login-form label { margin: 15px 0; }
.login-form input { min-height: 49px; background: #fff; }
.login-form .button { width: 100%; margin-top: 10px; min-height: 50px; justify-content: space-between; padding-inline: 20px; }
.login-form .form-help { text-align: center; margin-top: 18px; }
.not-found { min-height: 100vh; display: grid; place-content: center; gap: 20px; text-align: center; color: #fff; }

@media (max-width: 1050px) {
  .course-grid { grid-template-columns: 1fr 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .assessment-card { grid-template-columns: auto 1fr; }
  .assessment-card .button { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  :root { --sidebar: 0px; }
  .sidebar { position: static; width: 100%; height: auto; min-height: 0; padding: 18px; flex-direction: row; align-items: center; }
  .sidebar nav { display: flex; margin: 0 0 0 auto; }
  .sidebar-foot { display: none; }
  .main { margin-left: 0; padding: 32px 18px 70px; }
  .page-header, .course-hero, .lesson-head { align-items: flex-start; flex-direction: column; }
  .progress-ring { display: none; }
  .course-grid, .two-col, .admin-cols, .review-grid, .answer-grid { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .course-hero { padding: 28px; }
  .hero-progress { width: 100%; }
  .lesson-action { display: none; }
  .document-frame { height: 72vh; min-height: 500px; }
  .assessment-card { grid-template-columns: 1fr; }
  .lesson-footer, .submit-bar { align-items: stretch; flex-direction: column; }
  .login-shell { grid-template-columns: 1fr; }
  .login-panel { min-height: 380px; padding: 35px 24px; }
  .login-panel h1 { font-size: 42px; }
  .login-form-wrap { min-height: auto; padding-block: 70px; }
}
