/* ============================================================
   Oilo Platform UI — roles, course management, tests,
   certificates, learning view. Reuses .modal scaffolding.
   ============================================================ */

/* Small / ghost buttons */
.btn-sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid transparent; }
.btn-ghost:hover { background: color-mix(in oklab, var(--ink) 6%, transparent); color: var(--ink); }

/* Wide modal panels */
.learn-panel, .test-panel, .ed-panel { width: min(620px, calc(100vw - 32px)) !important; }
.cert-modal { width: min(680px, calc(100vw - 32px)) !important; }

/* ---------- Manage list (courses / users) ---------- */
.mng-list { display: flex; flex-direction: column; gap: 10px; }
.mng-row {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
}
.mng-row-main { display: flex; align-items: center; gap: 14px; min-width: 0; }
.mng-row-info { min-width: 0; }
.mng-row-title { font-family: var(--display); font-weight: 500; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.mng-row-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; letter-spacing: .02em; }

/* Toggle switch */
.mng-switch { position: relative; display: inline-block; width: 40px; height: 23px; flex-shrink: 0; cursor: pointer; }
.mng-switch input { opacity: 0; width: 0; height: 0; }
.mng-slider { position: absolute; inset: 0; background: var(--line); border-radius: 999px; transition: .2s; }
.mng-slider::before { content: ''; position: absolute; height: 17px; width: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.mng-switch input:checked + .mng-slider { background: var(--ok, #1F8A5B); }
.mng-switch input:checked + .mng-slider::before { transform: translateX(17px); }

/* User role rows */
.usr-av { width: 38px; height: 38px; border-radius: 50%; background: var(--bg-soft, #ece8e0); display: flex; align-items: center; justify-content: center; font-weight: 600; flex-shrink: 0; }
.usr-role { padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); font-family: var(--display); font-size: 13px; cursor: pointer; }
.usr-badge { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; }
.usr-badge.admin { background: color-mix(in oklab, var(--accent) 18%, transparent); color: var(--accent); }
.usr-badge.editor { background: color-mix(in oklab, #2A6FDB 16%, transparent); color: #2A6FDB; }

/* ---------- Course / test editor ---------- */
.ed-title { font-family: var(--display); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin-bottom: 18px; padding-right: 30px; }
.ed-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ed-f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.ed-f > span { font-family: var(--mono); font-size: 10px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.ed-f.col { margin-bottom: 12px; }
.ed-f input, .ed-f textarea, .ed-f select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font-family: var(--display); font-size: 14px; color: var(--ink); resize: vertical;
}
.ed-f input:focus, .ed-f textarea:focus, .ed-f select:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.ed-f-toggle { flex-direction: row; align-items: center; justify-content: space-between; }
.ed-f-toggle input { width: auto; }
.ed-actions-top { margin: 14px 0 4px; }
.ed-sec { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 18px; }
.ed-sec-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ed-sec-h h3 { font-family: var(--display); font-size: 16px; font-weight: 500; }
.ed-list { display: flex; flex-direction: column; gap: 8px; }
.ed-item { padding: 12px 14px; background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.ed-item-h { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.ed-item-h b { flex: 1; font-weight: 500; }
.ed-num { width: 22px; height: 22px; border-radius: 6px; background: var(--ink); color: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; flex-shrink: 0; }
.ed-del { background: transparent; border: none; color: var(--ink-3); cursor: pointer; font-size: 14px; padding: 4px; }
.ed-del:hover { color: var(--bad, #C9412B); }
.ed-item-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.ed-item-desc { font-size: 13px; color: var(--ink-2); margin-top: 6px; }
.ed-empty { padding: 18px; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- Test taking ---------- */
.test-head { margin-bottom: 18px; }
.test-eyebrow { font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }
.test-progress { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-top: 6px; }
.test-bar { height: 4px; background: var(--line); border-radius: 999px; margin-top: 8px; overflow: hidden; }
.test-bar span { display: block; height: 100%; background: var(--ink); transition: width .3s; }
.test-q { font-family: var(--display); font-size: 21px; font-weight: 500; line-height: 1.3; margin: 4px 0 18px; }
.test-opts { display: flex; flex-direction: column; gap: 10px; }
.test-opt { display: flex; align-items: center; gap: 12px; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; font-size: 15px; transition: all .15s; }
.test-opt:hover { border-color: var(--ink-3); }
.test-opt.sel { border-color: var(--ink); background: color-mix(in oklab, var(--ink) 5%, transparent); }
.test-opt-k { width: 26px; height: 26px; flex-shrink: 0; border-radius: 7px; background: var(--bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 12px; }
.test-opt.sel .test-opt-k { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.test-actions { display: flex; justify-content: space-between; gap: 10px; margin-top: 22px; }

.test-result { text-align: center; padding: 8px 4px; }
.test-result-ic { width: 76px; height: 76px; border-radius: 50%; margin: 0 auto 18px; display: flex; align-items: center; justify-content: center; }
.test-result.pass .test-result-ic { background: color-mix(in oklab, var(--ok,#1F8A5B) 14%, transparent); color: var(--ok,#1F8A5B); }
.test-result.fail .test-result-ic { background: color-mix(in oklab, var(--bad,#C9412B) 14%, transparent); color: var(--bad,#C9412B); }
.test-result h2 { font-family: var(--display); font-size: 26px; font-weight: 500; margin-bottom: 8px; }
.test-score { color: var(--ink-2); font-size: 15px; }
.test-thr { font-family: var(--mono); font-size: 12px; color: var(--ink-3); }
.test-cert-note { display: flex; align-items: center; gap: 9px; justify-content: center; margin-top: 16px; padding: 12px; border-radius: 12px; background: color-mix(in oklab, var(--accent) 10%, transparent); color: var(--accent); font-size: 13px; font-weight: 500; }

/* ---------- Learning view ---------- */
.learn-head { margin-bottom: 22px; }
.learn-title { font-family: var(--display); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; margin: 6px 0 14px; padding-right: 30px; }
.learn-prog { display: flex; align-items: center; gap: 12px; }
.learn-prog-bar { flex: 1; height: 7px; background: var(--line); border-radius: 999px; overflow: hidden; }
.learn-prog-bar span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.learn-prog-num { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.learn-sec { margin-top: 20px; }
.learn-sec h3 { font-family: var(--display); font-size: 16px; font-weight: 500; margin-bottom: 10px; }
.lr-list { display: flex; flex-direction: column; gap: 8px; }
.lr { display: flex; align-items: center; gap: 13px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.lr.done { background: var(--bg); }
.lr-ic { width: 28px; height: 28px; flex-shrink: 0; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 13px; color: var(--ink-3); }
.lr.done .lr-ic { background: var(--ok,#1F8A5B); color: #fff; border-color: var(--ok,#1F8A5B); }
.lr-ic.test { background: color-mix(in oklab, var(--accent) 12%, transparent); color: var(--accent); border-color: transparent; }
.lr.done .lr-ic.test { background: var(--ok,#1F8A5B); color: #fff; }
.lr-info { flex: 1; min-width: 0; }
.lr-title { font-family: var(--display); font-weight: 500; font-size: 14px; }
.lr-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.lr-desc { font-size: 13px; color: var(--ink-2); margin-top: 5px; }

/* ---------- Certificate sheet (in-app) ---------- */
.cert-sheet .cert-frame {
  position: relative; background: linear-gradient(160deg, #fff, #FBF8F2);
  border: 1px solid var(--line); border-radius: 16px; padding: 36px 40px; overflow: hidden;
  box-shadow: 0 18px 44px rgba(26,24,21,.08);
}
.cert-frame::before { content: ''; position: absolute; inset: 13px; border: 1.5px solid var(--line); border-radius: 9px; pointer-events: none; }
.cert-frame.expired { filter: grayscale(.4); }
.cert-top { display: flex; align-items: center; justify-content: space-between; position: relative; z-index: 1; margin-bottom: 22px; }
.cert-brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 21px; }
.cert-mark { width: 25px; height: 25px; border-radius: 50%; background: var(--ink); color: var(--bg); display: flex; align-items: center; justify-content: center; font-family: var(--display); font-weight: 600; font-size: 13px; }
.cert-kind { font-family: var(--mono); font-size: 11px; letter-spacing: .22em; color: var(--accent); }
.cert-body { text-align: center; position: relative; z-index: 1; padding: 6px 0 22px; }
.cert-label { font-size: 13px; color: var(--ink-3); margin: 8px 0 4px; }
.cert-name { font-family: var(--serif); font-size: 34px; line-height: 1.1; margin: 4px 0; }
.cert-course { font-size: 18px; font-weight: 500; margin-top: 4px; }
.cert-score { font-family: var(--mono); font-size: 12px; color: var(--ink-3); margin-top: 12px; }
.cert-foot { display: flex; justify-content: space-between; gap: 14px; border-top: 1px solid var(--line); padding-top: 16px; position: relative; z-index: 1; }
.cert-foot-k { font-family: var(--mono); font-size: 9px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 3px; }
.cert-foot-v { font-size: 13px; font-weight: 500; }
.cert-code { font-family: var(--mono); letter-spacing: .04em; }
.cert-expired-stamp { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%) rotate(-16deg); font-family: var(--mono); font-size: 30px; letter-spacing: .14em; color: rgba(201,65,43,.28); border: 4px solid rgba(201,65,43,.28); padding: 5px 20px; border-radius: 10px; z-index: 2; }
.cert-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Certificate list (account tab) */
.cert-list { display: flex; flex-direction: column; gap: 10px; }
.cert-row { display: flex; align-items: center; gap: 13px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .15s; }
.cert-row:hover { border-color: var(--ink-3); }
.cert-row-ic { width: 40px; height: 40px; border-radius: 10px; flex-shrink: 0; background: color-mix(in oklab, var(--accent) 12%, transparent); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.cert-row-info { flex: 1; min-width: 0; }
.cert-row-title { font-family: var(--display); font-weight: 500; font-size: 15px; }
.cert-row-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.cert-ok { color: var(--ok,#1F8A5B); }
.cert-bad { color: var(--bad,#C9412B); }
.cert-row-chev { color: var(--ink-3); flex-shrink: 0; }

@media (max-width: 640px) {
  .ed-grid { grid-template-columns: 1fr; }
  .cert-name { font-size: 27px; }
  .cert-foot { flex-wrap: wrap; }
}

/* ---------- Cart promo field ---------- */
.cart-promo { display: flex; gap: 8px; margin-bottom: 4px; }
.cart-promo input {
  flex: 1; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); font-family: var(--mono); font-size: 13px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--ink);
}
.cart-promo input:focus { outline: none; border-color: var(--ink); background: var(--surface); }
.cart-promo button {
  padding: 11px 16px; border: 1px solid var(--ink); border-radius: 10px; background: transparent;
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap; transition: all .15s;
}
.cart-promo button:hover { background: var(--ink); color: var(--bg); }
.cart-promo-msg { font-family: var(--mono); font-size: 11px; min-height: 14px; margin-bottom: 6px; }
.cart-promo-msg.ok { color: var(--ok, #1F8A5B); }
.cart-promo-msg.bad { color: var(--bad, #C9412B); }
.cart-sub-old { text-decoration: line-through; opacity: .5; font-size: .8em; margin-right: 4px; }

/* ---------- Promo management (admin) ---------- */
.promo-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 22px; }
.promo-stat { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.promo-stat-n { font-family: var(--display); font-size: 30px; font-weight: 500; letter-spacing: -0.02em; }
.promo-stat-l { font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); margin-top: 4px; }
.promo-create { display: grid; grid-template-columns: 1.4fr .8fr .9fr 1.4fr auto; gap: 10px; align-items: end;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 18px; }
.promo-table { width: 100%; }
.promo-row-card { display: flex; align-items: center; gap: 14px; padding: 14px 18px; background: var(--surface);
  border: 1px solid var(--line); border-radius: 14px; margin-bottom: 8px; }
.promo-code { font-family: var(--mono); font-weight: 600; font-size: 15px; letter-spacing: .04em; }
.promo-meta { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 3px; }
.promo-usebar { flex: 1; max-width: 160px; }
.promo-usebar-track { height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.promo-usebar-track span { display: block; height: 100%; background: var(--accent); }
.promo-pct { font-family: var(--mono); font-size: 11px; color: var(--ink-3); margin-top: 4px; }
.promo-badge { font-family: var(--mono); font-size: 9px; letter-spacing: .06em; text-transform: uppercase; padding: 3px 8px; border-radius: 999px; }
.promo-badge.on { background: color-mix(in oklab, var(--ok,#1F8A5B) 16%, transparent); color: var(--ok,#1F8A5B); }
.promo-badge.off { background: color-mix(in oklab, var(--ink) 8%, transparent); color: var(--ink-3); }
.promo-badge.spent { background: color-mix(in oklab, var(--bad,#C9412B) 14%, transparent); color: var(--bad,#C9412B); }
@media (max-width: 760px) {
  .promo-stats-grid { grid-template-columns: 1fr 1fr; }
  .promo-create { grid-template-columns: 1fr 1fr; }
}

/* ---------- Account nav link (to admin console) ---------- */
.acc-nav-link { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  padding: 11px 14px; border: none; background: transparent; border-radius: 11px;
  font-family: var(--display); font-size: 14px; color: var(--accent); cursor: pointer; text-decoration: none; }
.acc-nav-link:hover { background: color-mix(in oklab, var(--accent) 9%, transparent); }
.acc-nav-link svg { width: 16px; height: 16px; flex-shrink: 0; }

/* ---------- Featured star + row actions ---------- */
.mng-row-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.star-toggle { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); transition: all .15s; }
.star-toggle svg { width: 17px; height: 17px; }
.star-toggle:hover { border-color: var(--ink-3); }
.star-toggle.on { color: #E2A33C; border-color: color-mix(in oklab, #E2A33C 45%, transparent); background: color-mix(in oklab, #E2A33C 12%, transparent); }

/* ---------- Video manager (moderator) ---------- */
.vm-current { margin: 6px 0 4px; }
.vm-rend { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--bg);
  border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; }
.vm-q { font-family: var(--mono); font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  background: color-mix(in oklab, var(--accent) 14%, transparent); color: var(--accent); }
.vm-size { font-family: var(--mono); font-size: 12px; color: var(--ink-3); flex: 1; }
.vm-file { width: 100%; padding: 11px; border: 1px dashed var(--line); border-radius: 10px; background: var(--bg);
  font-family: var(--display); font-size: 13px; margin-bottom: 12px; }
.vm-quality { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 8px; font-size: 14px; }
.vm-q-label { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); }
.vm-quality label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.vm-keep { margin-left: auto; }
.vm-hint { font-size: 12px; color: var(--ink-3); margin-bottom: 12px; line-height: 1.5; }
.vm-warn { font-size: 13px; color: #B0731E; background: color-mix(in oklab, #E2A33C 14%, transparent);
  border-radius: 10px; padding: 10px 13px; margin-bottom: 12px; }
.vm-progress { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.vm-prog-row { display: flex; align-items: center; gap: 10px; }
.vm-prog-q { font-family: var(--mono); font-size: 12px; width: 64px; }
.vm-prog-track { flex: 1; height: 6px; background: var(--line); border-radius: 999px; overflow: hidden; }
.vm-prog-track span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.vm-prog-pct { font-family: var(--mono); font-size: 11px; color: var(--ink-3); width: 64px; text-align: right; }
.vm-prog-row.done .vm-prog-track span { background: var(--ok, #1F8A5B); }
.vm-prog-row.skip .vm-prog-q { color: var(--ink-3); text-decoration: line-through; }

/* ---------- Lesson list rows — clickable ---------- */
.lr { cursor: pointer; transition: border-color .15s, background .15s; }
.lr:hover { border-color: var(--ink-3); background: var(--bg); }
.lr.done:hover { border-color: color-mix(in oklab, var(--ok,#1F8A5B) 40%, var(--line)); }
.lr-chev { color: var(--ink-3); flex-shrink: 0; }
.lr-actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }

/* ---------- Lesson viewer panel ---------- */
.ls-panel { width: min(700px, calc(100vw - 32px)) !important; max-height: calc(100vh - 48px); overflow-y: auto; }
.ls-eyebrow { font-family: var(--mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 6px; }
.ls-loading { padding: 60px 20px; text-align: center; color: var(--ink-3); font-family: var(--mono); font-size: 13px; }
.ls-empty { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 48px 0; color: var(--ink-3); text-align: center; }
.ls-empty svg { opacity: .4; }
.ls-empty p { font-size: 14px; }

/* Materials */
.ls-materials { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.ls-mat-img { max-width: 100%; border-radius: 10px; display: block; }
.ls-mat-video { max-width: 100%; border-radius: 10px; display: block; }
.ls-mat-link { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--ink); text-decoration: none; font-size: 14px; font-family: var(--display);
  transition: border-color .15s; }
.ls-mat-link:hover { border-color: var(--ink-3); }
.ls-mat-link svg { flex-shrink: 0; color: var(--ink-3); }
.ls-mat-icon { font-size: 20px; flex-shrink: 0; }
.ls-mat-link span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Navigation bar */
.ls-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.ls-nav-back { color: var(--ink-3); gap: 6px; }
.ls-nav-center { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.ls-nav-done-active { background: color-mix(in oklab, var(--ok,#1F8A5B) 12%, transparent) !important;
  color: var(--ok,#1F8A5B) !important; border-color: transparent !important; }

/* ---------- Lesson video player (learner) ---------- */
.vp-stage { background: #000; border-radius: 14px; overflow: hidden; margin: 6px 0 14px; aspect-ratio: 16/9; }
.vp-stage video { width: 100%; height: 100%; display: block; background: #000; }
.vp-qrow { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.vp-lbl { font-family: var(--mono); font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3); width: 76px; }
.vp-q { padding: 7px 13px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  font-family: var(--mono); font-size: 12px; cursor: pointer; transition: all .15s; min-height: 34px; }
.vp-q:hover { border-color: var(--ink-3); }
.vp-q.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }