:root {
  --bg: #f4f6fb; --card: #fff; --ink: #1c2434; --muted: #6b7280;
  --line: #e5e7eb; --brand: #3056d3; --brand-dark: #243fa6;
  --ok: #1f9d55; --ok-bg: #e6f6ec; --err: #d64545; --err-bg: #fcecec;
  --warn: #b4690e; --info-bg: #eef4ff;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin:0; font-family:-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  background:var(--bg); color:var(--ink); line-height:1.5; }
a { color:var(--brand); text-decoration:none; }
a:hover { text-decoration:underline; }

.topbar { display:flex; align-items:center; gap:24px; background:var(--card);
  border-bottom:1px solid var(--line); padding:12px 28px; box-shadow:var(--shadow); }
.brand { display:flex; align-items:baseline; gap:8px; }
.brand:hover { text-decoration:none; }
.brand-mark { font-weight:800; letter-spacing:1px; color:#fff; background:var(--brand);
  padding:4px 10px; border-radius:7px; font-size:15px; }
.brand-sub { color:var(--muted); font-size:13px; }
.nav { display:flex; gap:18px; margin-left:8px; }
.nav a { color:var(--ink); font-weight:500; font-size:14px; }
.user-chip { margin-left:auto; display:flex; align-items:center; gap:10px; font-size:14px; }
.user-name { color:var(--muted); }
.logout { font-size:13px; }

.role-badge { text-transform:capitalize; font-size:11px; font-weight:700; padding:2px 9px;
  border-radius:999px; letter-spacing:.3px; }
.role-admin { background:#efe7fb; color:#6b21a8; }
.role-instructor { background:#e0f0ff; color:#1d4ed8; }
.role-learner { background:var(--ok-bg); color:var(--ok); }

.provider { font-size:11px; font-weight:600; padding:2px 8px; border-radius:999px; }
.provider-microsoft { background:#e8f0fe; color:#1a56db; }
.provider-local { background:#eef1f5; color:#5b6472; }

.container { max-width:960px; margin:28px auto; padding:0 20px; }
.footer { text-align:center; color:var(--muted); font-size:12px; padding:28px 0; }
h1 { font-size:24px; margin:0 0 4px; }
h2 { font-size:18px; margin:0 0 12px; }
.subtitle { color:var(--muted); margin:0 0 22px; }

.card { background:var(--card); border:1px solid var(--line); border-radius:var(--radius);
  box-shadow:var(--shadow); padding:20px; margin-bottom:16px; }
.card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px; }
.card h3 { margin:0 0 6px; font-size:16px; }
.card .meta { color:var(--muted); font-size:13px; margin-bottom:10px; }
.card .desc { font-size:14px; color:#374151; }
.pill { display:inline-block; font-size:11px; padding:2px 8px; border-radius:999px;
  background:#eef2ff; color:var(--brand-dark); font-weight:600; }

.btn { display:inline-block; background:var(--brand); color:#fff; border:none; padding:9px 16px;
  border-radius:8px; font-size:14px; font-weight:600; cursor:pointer; }
.btn:hover { background:var(--brand-dark); text-decoration:none; }
.btn-sm { padding:6px 12px; font-size:13px; }
.btn-ghost { background:#eef1f8; color:var(--brand-dark); }
.btn-ghost:hover { background:#e2e7f4; }
.btn-danger { background:var(--err); }
.btn-danger:hover { background:#b63434; }
.btn-row { display:flex; gap:10px; flex-wrap:wrap; margin-top:12px; }

/* Microsoft button */
.btn-ms { display:flex; align-items:center; justify-content:center; gap:10px; width:100%;
  background:#fff; color:#3b3b3b; border:1px solid #d2d6dc; padding:11px 16px; margin-bottom:6px; }
.btn-ms:hover { background:#f6f7f9; text-decoration:none; }
.ms-logo { display:grid; grid-template-columns:9px 9px; grid-template-rows:9px 9px; gap:2px; }
.ms-logo span { display:block; width:9px; height:9px; }
.ms-logo span:nth-child(1){ background:#f25022; }
.ms-logo span:nth-child(2){ background:#7fba00; }
.ms-logo span:nth-child(3){ background:#00a4ef; }
.ms-logo span:nth-child(4){ background:#ffb900; }
.divider { display:flex; align-items:center; text-align:center; color:var(--muted);
  font-size:12px; margin:16px 0; }
.divider::before, .divider::after { content:""; flex:1; border-bottom:1px solid var(--line); }
.divider span { padding:0 10px; }
.form-head { font-weight:700; font-size:13px; color:var(--muted); text-transform:uppercase;
  letter-spacing:.4px; margin-bottom:4px; }

form.stacked label { display:block; font-weight:600; font-size:14px; margin:14px 0 5px; }
form.stacked input[type=text], form.stacked input[type=email], form.stacked input[type=password],
form.stacked textarea, form.stacked select {
  width:100%; padding:10px 12px; border:1px solid var(--line); border-radius:8px;
  font-size:14px; font-family:inherit; }
form.stacked textarea { min-height:110px; resize:vertical; }
form.inline { margin:0; display:inline; }
form.inline select { padding:5px 8px; border:1px solid var(--line); border-radius:7px; font-size:13px; }
.hint { color:var(--muted); font-size:12px; margin-top:4px; }

.progress { background:#eceef3; border-radius:999px; height:10px; overflow:hidden; margin:8px 0; }
.progress > span { display:block; height:100%; background:var(--brand); border-radius:999px; }
.progress-label { font-size:13px; color:var(--muted); }

.unit-list { list-style:none; padding:0; margin:0; }
.unit-item { display:flex; align-items:center; gap:12px; padding:14px 16px;
  border:1px solid var(--line); border-radius:9px; margin-bottom:10px; background:#fff; }
.unit-item .kind-icon { width:34px; height:34px; border-radius:8px; flex:0 0 auto;
  display:grid; place-items:center; font-size:16px; background:#eef2ff; }
.unit-item .unit-main { flex:1; }
.unit-item .unit-title { font-weight:600; font-size:15px; }
.unit-item .unit-kind { font-size:12px; color:var(--muted); text-transform:capitalize; }
.check { color:var(--ok); font-weight:700; font-size:14px; }
.todo { color:var(--muted); font-size:13px; }

table { width:100%; border-collapse:collapse; font-size:14px; }
th, td { text-align:left; padding:10px 12px; border-bottom:1px solid var(--line); }
th { color:var(--muted); font-weight:600; font-size:12px; text-transform:uppercase; letter-spacing:.3px; }
.tag-done { color:var(--ok); font-weight:600; }
.tag-pending { color:var(--warn); font-weight:600; }

.flash { padding:12px 16px; border-radius:9px; margin-bottom:16px; font-size:14px; }
.flash-success { background:var(--ok-bg); color:var(--ok); }
.flash-error { background:var(--err-bg); color:var(--err); }
.flash-info { background:var(--info-bg); color:var(--brand-dark); }

.question { border:1px solid var(--line); border-radius:9px; padding:16px; margin-bottom:14px; }
.question .q-prompt { font-weight:600; margin-bottom:10px; }
.option { display:flex; align-items:center; gap:9px; padding:7px 0; }
.option.correct { color:var(--ok); font-weight:600; }

.login-wrap { max-width:420px; margin:56px auto; }
.demo-accounts { font-size:13px; color:var(--muted); margin-top:18px; border-top:1px solid var(--line); padding-top:14px; }
.demo-accounts code { background:#eef1f8; padding:1px 6px; border-radius:5px; color:var(--ink); }

.certificate { background:linear-gradient(135deg,#fdfbf6,#fff); border:3px double var(--brand);
  border-radius:14px; padding:48px 40px; text-align:center; }
.certificate .seal { font-size:44px; }
.certificate h1 { font-size:30px; letter-spacing:2px; color:var(--brand-dark); }
.certificate .recipient { font-size:26px; font-weight:700; margin:18px 0 6px; }
.certificate .course-name { font-size:20px; color:var(--ink); margin:6px 0 18px; }
.certificate .meta { color:var(--muted); font-size:14px; }

.video-frame { position:relative; padding-bottom:56.25%; height:0; border-radius:10px; overflow:hidden; }
.video-frame iframe { position:absolute; inset:0; width:100%; height:100%; border:0; }
.empty { color:var(--muted); font-style:italic; padding:10px 0; }
.pre-wrap { white-space:pre-wrap; }

/* Player */
.player-head { margin-bottom:16px; }
.player-head .back-link { font-size:13px; display:inline-block; margin-bottom:8px; }
.player-head h1 { margin:6px 0 10px; }
.unit-stage { padding:26px; }
.stage-kind { display:inline-block; font-size:12px; font-weight:700; letter-spacing:.4px;
  color:var(--brand-dark); background:#eef2ff; padding:3px 10px; border-radius:999px;
  margin-bottom:10px; text-transform:uppercase; }
.unit-stage h2 { font-size:22px; margin:0 0 14px; }
.stage-body { font-size:15px; line-height:1.7; }
.player-nav { display:flex; justify-content:space-between; align-items:center; gap:12px; margin:18px 0 8px; }
.player-nav form { margin:0; }
.step-rail { display:flex; gap:8px; justify-content:center; margin:20px 0 6px; }
.step-dot { width:10px; height:10px; border-radius:999px; background:#d4d9e6; }
.step-dot.past { background:var(--ok); }
.step-dot.active { background:var(--brand); transform:scale(1.35); }

/* Drag reorder */
.drag-handle { flex:0 0 auto; cursor:grab; color:#9aa2b4; font-size:18px; line-height:1;
  padding:4px 2px; user-select:none; }
.drag-handle:hover { color:var(--brand); }
.drag-handle:active { cursor:grabbing; }
.unit-list.reorderable .unit-item { transition:box-shadow .12s, opacity .12s; }
.unit-item.dragging { opacity:.6; box-shadow:0 6px 18px rgba(16,24,40,.18); border-color:var(--brand); }

/* Entra settings */
.status-row { display:flex; align-items:center; gap:8px; font-size:14px; }
.status-dot { width:11px; height:11px; border-radius:999px; flex:0 0 auto; }
.status-dot.on { background:var(--ok); box-shadow:0 0 0 3px var(--ok-bg); }
.status-dot.off { background:#c3c8d4; box-shadow:0 0 0 3px #eef1f5; }
.inline-check { display:inline-flex; align-items:center; gap:6px; font-weight:400;
  margin-top:8px; font-size:13px; }
.inline-check input { width:auto; }
.detected-box { margin-top:10px; padding:12px 14px; background:#f6f8fc;
  border:1px solid var(--line); border-radius:9px; }
.detected-label { font-size:12px; color:var(--muted); margin-bottom:6px; }
.detected-box code { background:#fff; border:1px solid var(--line); padding:4px 8px;
  border-radius:6px; font-size:13px; word-break:break-all; }
.detected-box .btn { margin-left:6px; margin-top:6px; }

@media (max-width:640px) {
  .topbar { flex-wrap:wrap; gap:12px; }
  .nav, .user-chip { margin-left:0; }
}
