/* ============================================================
   МедУчёба — Обучающая платформа клиники
   Дизайн-система: клинический бело-голубой стиль
   ============================================================ */

:root {
  /* Цветовые токены */
  --bg:            oklch(0.985 0.006 235);
  --bg-deep:       oklch(0.965 0.010 235);
  --surface:       oklch(1 0 0);
  --surface-2:     oklch(0.985 0.007 235);
  --surface-3:     oklch(0.965 0.012 235);
  --border:        oklch(0.915 0.012 235);
  --border-strong: oklch(0.86 0.016 235);

  --ink:           oklch(0.28 0.030 252);
  --ink-2:         oklch(0.46 0.025 252);
  --ink-3:         oklch(0.60 0.020 252);
  --ink-faint:     oklch(0.72 0.016 252);

  /* Акцент (медицинский синий) — переопределяется через Tweaks */
  --accent:        oklch(0.58 0.135 248);
  --accent-strong: oklch(0.50 0.145 248);
  --accent-soft:   oklch(0.95 0.030 248);
  --accent-softer: oklch(0.975 0.018 248);
  --accent-ink:    oklch(0.42 0.130 248);

  --teal:          oklch(0.66 0.105 195);
  --teal-soft:     oklch(0.955 0.030 195);

  --success:       oklch(0.62 0.130 158);
  --success-soft:  oklch(0.955 0.040 158);
  --success-ink:   oklch(0.44 0.110 158);

  --warning:       oklch(0.74 0.135 72);
  --warning-soft:  oklch(0.960 0.045 78);
  --warning-ink:   oklch(0.52 0.120 65);

  --danger:        oklch(0.60 0.180 25);
  --danger-soft:   oklch(0.955 0.035 25);
  --danger-ink:    oklch(0.48 0.160 25);

  --violet:        oklch(0.60 0.130 290);
  --violet-soft:   oklch(0.955 0.030 290);

  /* Радиусы (переопределяется через Tweaks) */
  --r-xs: 6px;
  --r-sm: 9px;
  --r-md: 13px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Тени — мягкие, прохладные */
  --sh-xs: 0 1px 2px oklch(0.55 0.04 252 / 0.06);
  --sh-sm: 0 1px 3px oklch(0.55 0.04 252 / 0.07), 0 1px 2px oklch(0.55 0.04 252 / 0.04);
  --sh-md: 0 4px 14px oklch(0.55 0.05 252 / 0.08), 0 1px 3px oklch(0.55 0.04 252 / 0.05);
  --sh-lg: 0 14px 40px oklch(0.50 0.06 252 / 0.12), 0 3px 10px oklch(0.50 0.05 252 / 0.06);
  --sh-accent: 0 6px 20px oklch(0.58 0.135 248 / 0.28);

  /* Плотность (переопределяется через Tweaks) */
  --pad: 24px;
  --gap: 20px;

  --font: "Onest", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  --sidebar-w: 268px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01", "cv01";
  line-height: 1.45;
}

#root { height: 100%; }

::selection { background: var(--accent-soft); color: var(--accent-ink); }

button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font-family: inherit; }
a { color: inherit; text-decoration: none; }

::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-faint); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================================================
   LAYOUT
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  height: 100%;
  overflow: hidden;
}
.app.role-admin { --accent: oklch(0.52 0.115 268); --accent-strong: oklch(0.45 0.125 268); --accent-soft: oklch(0.95 0.028 268); --accent-softer: oklch(0.975 0.016 268); --accent-ink: oklch(0.40 0.120 268); --sh-accent: 0 6px 20px oklch(0.52 0.115 268 / 0.28); }

/* ---------- Sidebar ---------- */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  position: relative;
  z-index: 30;
}
.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 22px 22px 18px;
}
.brand__mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
  display: grid; place-items: center;
  color: #fff;
  box-shadow: var(--sh-accent);
  flex-shrink: 0;
}
.brand__name { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.brand__sub { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }

.sidebar__scope {
  margin: 4px 14px 10px;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-faint);
}

.nav { display: flex; flex-direction: column; gap: 3px; padding: 0 14px; overflow-y: auto; flex: 1; min-height: 0; }
.nav__item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
  transition: background .14s, color .14s;
  position: relative;
  text-align: left;
  width: 100%;
}
.nav__item:hover { background: var(--surface-3); color: var(--ink); }
.nav__item.is-active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 600; }
.nav__item.is-active::before {
  content: ""; position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
  width: 3px; height: 20px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.nav__item .ic { flex-shrink: 0; }
.nav__badge {
  margin-left: auto; font-size: 11px; font-weight: 700;
  background: var(--accent); color: #fff;
  min-width: 19px; height: 19px; padding: 0 6px;
  border-radius: 99px; display: grid; place-items: center;
}
.nav__item.is-active .nav__badge { background: var(--accent-strong); }

.sidebar__foot { padding: 14px; border-top: 1px solid var(--border); margin-top: auto; }

/* Role switcher */
.roleswitch {
  display: flex; padding: 3px; gap: 3px;
  background: var(--surface-3); border-radius: var(--r-sm);
  margin-bottom: 12px;
}
.roleswitch button {
  flex: 1; padding: 8px 6px; border-radius: 7px;
  font-size: 12.5px; font-weight: 600; color: var(--ink-3);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all .15s;
}
.roleswitch button.is-active { background: var(--surface); color: var(--ink); box-shadow: var(--sh-xs); }

.userchip { display: flex; align-items: center; gap: 10px; padding: 4px 4px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  display: grid; place-items: center; font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(150deg, var(--accent), var(--accent-strong));
}
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.lg { width: 64px; height: 64px; font-size: 22px; }
.avatar.xl { width: 88px; height: 88px; font-size: 30px; }
.userchip__name { font-size: 13.5px; font-weight: 600; line-height: 1.2; }
.userchip__role { font-size: 11.5px; color: var(--ink-3); }

/* ---------- Main ---------- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }

.topbar {
  height: 64px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: oklch(1 0 0 / 0.78);
  backdrop-filter: blur(12px);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
  position: sticky; top: 0; z-index: 20;
}
.topbar__menu { display: none; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); min-width: 0; }
.crumbs button:hover { color: var(--accent); }
.crumbs .sep { color: var(--border-strong); }
.crumbs .cur { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.search {
  display: flex; align-items: center; gap: 9px;
  background: var(--surface-3); border: 1px solid transparent;
  border-radius: var(--r-pill); padding: 8px 15px;
  width: 280px; color: var(--ink-3); transition: all .15s;
}
.search:focus-within { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.search input { border: none; background: none; outline: none; width: 100%; font-size: 13.5px; color: var(--ink); }
.search input::placeholder { color: var(--ink-faint); }

.topbar__spacer { flex: 1; }
.iconbtn {
  width: 40px; height: 40px; border-radius: var(--r-sm);
  display: grid; place-items: center; color: var(--ink-2);
  transition: all .14s; position: relative;
}
.iconbtn:hover { background: var(--surface-3); color: var(--ink); }
.iconbtn .dot { position: absolute; top: 9px; right: 9px; width: 7px; height: 7px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

.content { flex: 1; overflow-y: auto; min-height: 0; scroll-behavior: smooth; }
.page { max-width: 1180px; margin: 0 auto; padding: 32px 28px 80px; }
.page--wide { max-width: 1320px; }
.page--narrow { max-width: 820px; }

/* ============================================================
   TYPOGRAPHY HELPERS
   ============================================================ */
.h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.015em; }
.h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.eyebrow { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-ink); }
.muted { color: var(--ink-3); }
.muted2 { color: var(--ink-2); }
.lead { font-size: 15px; color: var(--ink-2); line-height: 1.6; }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }

.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.page-head__titles { min-width: 0; }
.page-head .h1 { margin-bottom: 6px; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 17px; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; white-space: nowrap;
  transition: all .15s; border: 1px solid transparent;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); color: #fff; box-shadow: var(--sh-accent); }
.btn--primary:hover { background: var(--accent-strong); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--border-strong); box-shadow: var(--sh-xs); }
.btn--ghost:hover { background: var(--surface-3); border-color: var(--ink-faint); }
.btn--soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn--soft:hover { background: var(--accent-softer); }
.btn--subtle { color: var(--ink-2); }
.btn--subtle:hover { background: var(--surface-3); color: var(--ink); }
.btn--danger { background: var(--danger-soft); color: var(--danger-ink); }
.btn--danger:hover { background: var(--danger); color: #fff; }
.btn--lg { padding: 13px 24px; font-size: 15px; border-radius: var(--r-md); }
.btn--sm { padding: 7px 12px; font-size: 13px; }
.btn--block { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ============================================================
   CARDS / SURFACES
   ============================================================ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card--pad { padding: var(--pad); }
.card--hover { transition: transform .18s, box-shadow .18s, border-color .18s; }
.card--hover:hover { transform: translateY(-3px); box-shadow: var(--sh-md); border-color: var(--border-strong); }
.card--click { cursor: pointer; }

.grid { display: grid; gap: var(--gap); }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
.row { display: flex; gap: var(--gap); }
.row--wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--gap); }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.center { display: flex; align-items: center; gap: 10px; }

/* ============================================================
   BADGES / PILLS / TAGS
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill);
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge .ic { margin: 0 -1px; }
.badge--blue { background: var(--accent-soft); color: var(--accent-ink); }
.badge--green { background: var(--success-soft); color: var(--success-ink); }
.badge--amber { background: var(--warning-soft); color: var(--warning-ink); }
.badge--red { background: var(--danger-soft); color: var(--danger-ink); }
.badge--teal { background: var(--teal-soft); color: oklch(0.42 0.09 195); }
.badge--violet { background: var(--violet-soft); color: oklch(0.42 0.12 290); }
.badge--gray { background: var(--surface-3); color: var(--ink-2); }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: var(--r-pill);
  font-size: 12.5px; font-weight: 500;
  background: var(--surface-3); color: var(--ink-2);
  border: 1px solid transparent; transition: all .14s;
}
.tag.is-active { background: var(--accent); color: #fff; }
button.tag:hover:not(.is-active) { border-color: var(--border-strong); color: var(--ink); }

/* ============================================================
   PROGRESS
   ============================================================ */
.bar { height: 7px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.bar__fill { height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s cubic-bezier(.4,0,.2,1); }
.bar__fill.is-done { background: var(--success); }
.bar.thin { height: 5px; }
.bar.thick { height: 10px; }

/* Donut via conic-gradient */
.donut {
  --p: 0; --sz: 120px; --thick: 13px; --col: var(--accent);
  width: var(--sz); height: var(--sz); border-radius: 50%;
  background: conic-gradient(var(--col) calc(var(--p) * 1%), var(--surface-3) 0);
  display: grid; place-items: center; position: relative; flex-shrink: 0;
}
.donut::before { content: ""; position: absolute; inset: var(--thick); background: var(--surface); border-radius: 50%; }
.donut__txt { position: relative; text-align: center; line-height: 1.1; }
.donut__txt b { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; }
.donut__txt span { font-size: 11px; color: var(--ink-3); display: block; }

/* Ring (small inline) */
.ring { --p: 0; --sz: 44px; --col: var(--accent); width: var(--sz); height: var(--sz); border-radius: 50%;
  background: conic-gradient(var(--col) calc(var(--p)*1%), var(--surface-3) 0); display: grid; place-items: center; flex-shrink: 0; }
.ring::before { content:""; position:absolute; width: calc(var(--sz) - 11px); height: calc(var(--sz) - 11px); background: var(--surface); border-radius: 50%; }
.ring span { position: relative; font-size: 11px; font-weight: 700; }

/* Stat cards */
.stat { padding: 20px; }
.stat__top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.stat__ic { width: 40px; height: 40px; border-radius: var(--r-sm); display: grid; place-items: center; }
.stat__val { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1; }
.stat__label { font-size: 13px; color: var(--ink-3); margin-top: 6px; font-weight: 500; }
.stat__delta { font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 3px; }
.stat__delta.up { color: var(--success-ink); }
.stat__delta.down { color: var(--danger-ink); }

/* ============================================================
   COURSE CARDS
   ============================================================ */
.course-card { overflow: hidden; display: flex; flex-direction: column; }
.course-card__cover {
  height: 132px; position: relative; overflow: hidden;
  display: flex; align-items: flex-end; padding: 14px;
  background: var(--cover, linear-gradient(140deg, var(--accent-soft), var(--accent-softer)));
}
.course-card__cover .pat {
  position: absolute; inset: 0; opacity: .5;
  background-image: repeating-linear-gradient(135deg, oklch(1 0 0 / 0.4) 0 1px, transparent 1px 13px);
}
.course-card__ic {
  width: 46px; height: 46px; border-radius: 12px; position: relative;
  display: grid; place-items: center; background: var(--surface); color: var(--accent);
  box-shadow: var(--sh-sm);
}
.course-card__body { padding: 16px 18px 18px; display: flex; flex-direction: column; flex: 1; gap: 10px; }
.course-card__title { font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.25; }
.course-card__meta { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-3); margin-top: auto; }
.course-card__meta span { display: inline-flex; align-items: center; gap: 5px; }

/* ============================================================
   LESSON / PLAYER
   ============================================================ */
.lesson-list { display: flex; flex-direction: column; }
.lesson-item {
  display: flex; align-items: center; gap: 13px; padding: 13px 16px;
  border-radius: var(--r-sm); transition: background .14s; text-align: left; width: 100%;
}
.lesson-item:hover { background: var(--surface-2); }
.lesson-item.is-active { background: var(--accent-soft); }
.lesson-item.is-locked { opacity: .55; }
.lesson-item__ic {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2);
}
.lesson-item.is-done .lesson-item__ic { background: var(--success-soft); color: var(--success-ink); }
.lesson-item.is-active .lesson-item__ic { background: var(--accent); color: #fff; }
.lesson-item__title { font-size: 14px; font-weight: 550; line-height: 1.3; }
.lesson-item__sub { font-size: 12px; color: var(--ink-3); margin-top: 2px; }

.module-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px 6px; }
.module-head__n { font-size: 11px; font-weight: 700; color: var(--accent-ink); background: var(--accent-soft); padding: 2px 8px; border-radius: 99px; }
.module-head__t { font-size: 13px; font-weight: 650; }

.player {
  aspect-ratio: 16/9; border-radius: var(--r-lg); overflow: hidden; position: relative;
  background: linear-gradient(160deg, oklch(0.30 0.04 252), oklch(0.22 0.05 258));
  display: grid; place-items: center;
}
.player .pat { position: absolute; inset: 0; opacity: .12; background-image: repeating-linear-gradient(90deg, #fff 0 1px, transparent 1px 42px), repeating-linear-gradient(0deg, #fff 0 1px, transparent 1px 42px); }
.player__play { width: 78px; height: 78px; border-radius: 50%; background: oklch(1 0 0 / 0.16); backdrop-filter: blur(4px); display: grid; place-items: center; color: #fff; border: 1.5px solid oklch(1 0 0 / 0.35); transition: all .2s; position: relative; }
.player__play:hover { background: oklch(1 0 0 / 0.26); transform: scale(1.06); }
.player__label { position: absolute; bottom: 16px; left: 18px; color: oklch(1 0 0 / 0.85); font-size: 12px; font-family: var(--mono); display: flex; align-items: center; gap: 8px; }
.player__bar { position: absolute; bottom: 0; left: 0; right: 0; height: 4px; background: oklch(1 0 0 / 0.18); }
.player__bar i { display: block; height: 100%; width: 34%; background: var(--accent); }

/* Placeholder image slot */
.imgph {
  background: var(--surface-3);
  background-image: repeating-linear-gradient(135deg, oklch(0.92 0.012 235) 0 1px, transparent 1px 11px);
  border: 1px dashed var(--border-strong); border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--ink-faint);
  font-family: var(--mono); font-size: 11.5px; text-align: center; padding: 14px;
}

/* Article text */
.prose { font-size: 15.5px; line-height: 1.72; color: var(--ink-2); }
.prose > * + * { margin-top: 16px; }
.prose h3 { font-size: 18px; font-weight: 650; color: var(--ink); margin-top: 30px; letter-spacing: -0.01em; }
.prose ul { padding-left: 4px; list-style: none; display: flex; flex-direction: column; gap: 10px; }
.prose ul li { position: relative; padding-left: 26px; }
.prose ul li::before { content: ""; position: absolute; left: 4px; top: 9px; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); transform: rotate(45deg); }
.prose strong { color: var(--ink); font-weight: 650; }
.callout { background: var(--accent-softer); border: 1px solid var(--accent-soft); border-left: 3px solid var(--accent); border-radius: var(--r-md); padding: 16px 18px; font-size: 14.5px; color: var(--ink-2); display: flex; gap: 12px; }
.callout .ic { color: var(--accent); flex-shrink: 0; margin-top: 1px; }
.callout--warn { background: var(--warning-soft); border-color: var(--warning-soft); border-left-color: var(--warning); }
.callout--warn .ic { color: var(--warning-ink); }

/* ============================================================
   QUIZ
   ============================================================ */
.quiz-head { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; }
.quiz-progress { flex: 1; }
.quiz-progress__top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); margin-bottom: 7px; font-weight: 500; }
.quiz-timer { display: flex; align-items: center; gap: 7px; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; color: var(--ink-2); background: var(--surface); border: 1px solid var(--border); padding: 8px 13px; border-radius: var(--r-sm); }

.q-card { padding: 32px; }
.q-type { font-size: 12px; font-weight: 600; color: var(--ink-3); margin-bottom: 10px; }
.q-text { font-size: 21px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.35; margin-bottom: 6px; }
.q-hint { font-size: 13.5px; color: var(--ink-3); margin-bottom: 22px; }

.opt {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 18px; border: 1.5px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); transition: all .14s; text-align: left; width: 100%; font-size: 15px; font-weight: 500;
}
.opt:hover { border-color: var(--accent); background: var(--accent-softer); }
.opt.is-sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.is-correct { border-color: var(--success); background: var(--success-soft); color: var(--success-ink); }
.opt.is-wrong { border-color: var(--danger); background: var(--danger-soft); color: var(--danger-ink); }
.opt.is-missed { border-color: var(--success); background: var(--surface); }
.opt__mark {
  width: 24px; height: 24px; border-radius: 7px; border: 1.5px solid var(--border-strong);
  flex-shrink: 0; display: grid; place-items: center; color: #fff; transition: all .14s;
  font-size: 13px; font-weight: 700;
}
.opt__mark.radio { border-radius: 50%; }
.opt.is-sel .opt__mark { background: var(--accent); border-color: var(--accent); }
.opt.is-correct .opt__mark { background: var(--success); border-color: var(--success); }
.opt.is-wrong .opt__mark { background: var(--danger); border-color: var(--danger); }
.opt__key { width: 26px; height: 26px; border-radius: 7px; background: var(--surface-3); display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--ink-3); flex-shrink: 0; }

/* Matching */
.match-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 14px; padding: 8px 0; }
.match-term { padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-3); font-weight: 600; font-size: 14.5px; }
.match-sel { width: 100%; padding: 13px 14px; border: 1.5px solid var(--border); border-radius: var(--r-md); background: var(--surface); font-size: 14px; color: var(--ink); appearance: none; cursor: pointer; }
.match-sel:focus { border-color: var(--accent); outline: none; }
.match-arrow { color: var(--ink-faint); }

/* Certificate */
.cert {
  position: relative; border-radius: var(--r-xl); overflow: hidden;
  background: linear-gradient(160deg, var(--surface), var(--accent-softer));
  border: 1px solid var(--accent-soft);
  padding: 44px 48px;
}
.cert__border { position: absolute; inset: 14px; border: 1.5px solid var(--accent-soft); border-radius: var(--r-lg); pointer-events: none; }
.cert__corner { position: absolute; width: 30px; height: 30px; border: 2px solid var(--accent); }
.cert__seal { width: 92px; height: 92px; border-radius: 50%; background: linear-gradient(150deg, var(--accent), var(--accent-strong)); display: grid; place-items: center; color: #fff; box-shadow: var(--sh-accent); }

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap { overflow-x: auto; border-radius: var(--r-lg); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; font-size: 11.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--ink-faint); padding: 13px 16px;
  border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2);
}
.tbl th.num, .tbl td.num { text-align: right; }
.tbl td { padding: 14px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.tbl tbody tr { transition: background .12s; }
.tbl tbody tr:hover { background: var(--surface-2); }
.tbl tbody tr.is-click { cursor: pointer; }
.tbl tbody tr:last-child td { border-bottom: none; }
.cell-user { display: flex; align-items: center; gap: 11px; }
.cell-user__name { font-weight: 600; font-size: 14px; line-height: 1.2; }
.cell-user__sub { font-size: 12px; color: var(--ink-3); }
.cell-prog { display: flex; align-items: center; gap: 10px; min-width: 130px; }
.cell-prog .bar { flex: 1; }
.cell-prog span { font-size: 12.5px; font-weight: 600; color: var(--ink-2); width: 34px; text-align: right; }

/* Mini bar chart */
.barchart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; }
.barchart__col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 8px; height: 100%; justify-content: flex-end; }
.barchart__bar { width: 100%; max-width: 46px; border-radius: 7px 7px 3px 3px; background: linear-gradient(var(--accent), var(--accent-strong)); transition: height .5s cubic-bezier(.4,0,.2,1); position: relative; min-height: 4px; }
.barchart__bar.alt { background: linear-gradient(var(--teal), oklch(0.56 0.10 195)); }
.barchart__bar:hover::after { content: attr(data-v); position: absolute; top: -24px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; font-size: 11px; padding: 3px 7px; border-radius: 5px; white-space: nowrap; font-weight: 600; }
.barchart__lbl { font-size: 11.5px; color: var(--ink-3); font-weight: 500; }

/* Sparkline-ish line chart */
.linechart { position: relative; height: 200px; }
.linechart svg { width: 100%; height: 100%; overflow: visible; }

/* Legend */
.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12.5px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.legend i { width: 11px; height: 11px; border-radius: 4px; }

/* ============================================================
   FORMS (test builder, assign)
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.input, .textarea, .selectbox {
  width: 100%; padding: 11px 14px; border: 1.5px solid var(--border); border-radius: var(--r-sm);
  background: var(--surface); font-size: 14px; color: var(--ink); transition: all .14s; outline: none;
}
.input:focus, .textarea:focus, .selectbox:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder, .textarea::placeholder { color: var(--ink-faint); }
.textarea { resize: vertical; min-height: 80px; line-height: 1.5; }
.selectbox { appearance: none; cursor: pointer; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 13px center; padding-right: 38px; }

.checkbox { display: flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; }
.checkbox__box { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: #fff; transition: all .14s; flex-shrink: 0; }
.checkbox.is-on .checkbox__box { background: var(--accent); border-color: var(--accent); }

.switch { width: 42px; height: 24px; border-radius: 99px; background: var(--border-strong); position: relative; transition: background .18s; flex-shrink: 0; }
.switch.is-on { background: var(--accent); }
.switch i { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .18s; box-shadow: var(--sh-xs); }
.switch.is-on i { left: 21px; }

/* Builder question block */
.qblock { border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface); transition: box-shadow .15s; }
.qblock__head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.qblock__num { width: 28px; height: 28px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex-shrink: 0; }
.qblock__body { padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.opt-edit { display: flex; align-items: center; gap: 10px; }
.opt-edit__radio { width: 20px; height: 20px; border: 1.5px solid var(--border-strong); border-radius: 50%; flex-shrink: 0; cursor: pointer; display: grid; place-items: center; }
.opt-edit__radio.is-on { border-color: var(--success); }
.opt-edit__radio.is-on::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--success); }

/* ============================================================
   MISC
   ============================================================ */
.divider { height: 1px; background: var(--border); margin: 4px 0; }
.dot-sep { color: var(--border-strong); margin: 0 2px; }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-3); }
.empty .ic { color: var(--ink-faint); margin-bottom: 12px; }

.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 13px 20px; border-radius: var(--r-md);
  font-size: 14px; font-weight: 500; box-shadow: var(--sh-lg); z-index: 200;
  display: flex; align-items: center; gap: 10px; opacity: 0; transition: all .28s; pointer-events: none;
}
.toast.is-show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast .ic { color: var(--success); }

.fade-in { opacity: 1; animation: fadeIn .35s cubic-bezier(.4,0,.2,1); }
@keyframes fadeIn { from { transform: translateY(9px); } to { transform: none; } }
.pop-in { opacity: 1; animation: popIn .4s cubic-bezier(.34,1.56,.64,1); }
@keyframes popIn { from { transform: scale(.94); } to { transform: scale(1); } }

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   DENSITY VARIANTS (Tweaks)
   ============================================================ */
.app[data-density="compact"] { --pad: 18px; --gap: 14px; }
.app[data-density="compact"] .page { padding: 24px 24px 60px; }
.app[data-density="comfy"] { --pad: 28px; --gap: 26px; }

/* Dashboard layout variants (Tweaks) — see employee dashboard */

/* ============================================================
   RESPONSIVE
   ============================================================ */
.scrim { display: none; }

@media (max-width: 1080px) {
  .cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; width: var(--sidebar-w);
    transform: translateX(-100%); transition: transform .25s cubic-bezier(.4,0,.2,1);
    box-shadow: var(--sh-lg);
  }
  .app.nav-open .sidebar { transform: translateX(0); }
  .app.nav-open .scrim { display: block; position: fixed; inset: 0; background: oklch(0.30 0.04 252 / 0.4); z-index: 25; backdrop-filter: blur(2px); }
  .topbar__menu { display: grid; }
  .search { width: 180px; }
}
@media (max-width: 720px) {
  .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; }
  .row { flex-direction: column; }
  .page { padding: 22px 18px 60px; }
  .topbar { padding: 0 16px; }
  .search { display: none; }
  .split-2 { grid-template-columns: 1fr !important; }
  .q-card { padding: 22px; }
  .q-text { font-size: 18px; }
  .cert { padding: 28px 22px; }
}

/* Two-column page split */
.split-2 { display: grid; grid-template-columns: 1fr 340px; gap: var(--gap); align-items: start; }
.split-2 > * { min-width: 0; }
.split-lesson { display: grid; grid-template-columns: 1fr 320px; gap: var(--gap); align-items: start; }
.split-lesson > * { min-width: 0; }
@media (max-width: 1000px) { .split-lesson { grid-template-columns: 1fr; } }
.sticky-side { position: sticky; top: 88px; }
