/* AI Academy ФАРМАСЕЛ — design system */
@font-face { font-family: Manrope; font-weight: 400; font-display: swap; src: url(/fonts/Manrope-Regular.ttf) format('truetype'); }
@font-face { font-family: Manrope; font-weight: 600; font-display: swap; src: url(/fonts/ManropeSemiBold-Regular.ttf) format('truetype'); }
@font-face { font-family: Manrope; font-weight: 700; font-display: swap; src: url(/fonts/Manrope-Bold.ttf) format('truetype'); }

:root {
  --ground: #edf1f6;
  --card: #ffffff;
  --navy: #13294b;
  --navy-2: #1d3a66;
  --blue: #2563c9;
  --blue-deep: #1b4ea6;
  --sky: #3a9bdc;
  --mist: #dcebfa;
  --mist-2: #f1f6fc;
  --ink: #1d2430;
  --graphite: #2b2f36;
  --muted: #5a6473;
  --faint: #8a94a3;
  --line: #e2e8f0;
  --line-2: #eef2f7;
  --ok: #17845a;
  --ok-bg: #e5f5ee;
  --warn: #a8670f;
  --warn-bg: #fdf3e2;
  --bad: #c03a33;
  --bad-bg: #fbe9e8;
  --r-card: 22px;
  --r-inner: 14px;
  --r-field: 12px;
  --shadow: 0 1px 2px rgba(19, 41, 75, .05), 0 10px 28px -16px rgba(19, 41, 75, .18);
  --shadow-lift: 0 2px 4px rgba(19, 41, 75, .06), 0 18px 36px -18px rgba(19, 41, 75, .28);
  --hatch: repeating-linear-gradient(-45deg, #c9def4 0 2px, transparent 2px 7px);
  --ease: cubic-bezier(.16, 1, .3, 1);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 15px/1.55 Manrope, system-ui, sans-serif;
  font-feature-settings: "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
}
::selection { background: var(--mist); color: var(--navy); }
* { scrollbar-width: thin; scrollbar-color: #c3cfdd transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #c3cfdd; border-radius: 99px; border: 3px solid var(--ground); }
a { color: var(--blue); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--blue-deep); }
:focus-visible { outline: 2px solid var(--sky); outline-offset: 2px; border-radius: 8px; }
h1, h2, h3 { margin: 0; color: var(--ink); text-wrap: balance; letter-spacing: -.02em; }
h1 { font-size: clamp(26px, 2.4vw, 34px); font-weight: 600; line-height: 1.15; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 600; line-height: 1.35; }
p { margin: 0; }
.num, table td.num { font-variant-numeric: tabular-nums; }
.ico { flex: none; display: block; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: 76px minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: 100vh; padding: 16px 20px 28px 16px; gap: 18px 20px; max-width: 1560px; margin: 0 auto; }
.topbar { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 18px 0 8px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); flex: none; }
.brand-mark { width: 38px; height: 38px; border-radius: 50%; background: var(--navy); display: grid; place-items: center; color: #fff; }
.brand-mark svg { width: 22px; height: 22px; }
.brand b { font-weight: 700; font-size: 15px; letter-spacing: -.01em; line-height: 1.1; }
.brand small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.nav { margin: 0 auto; display: flex; gap: 4px; padding: 6px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); overflow-x: auto; max-width: 100%; }
.nav a { padding: 9px 18px; border-radius: 999px; color: var(--graphite); text-decoration: none; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .25s var(--ease), color .25s var(--ease); }
.nav a:hover { background: var(--mist-2); color: var(--navy); }
.nav a[aria-current="page"] { background: var(--navy); color: #fff; }
.tools { display: flex; align-items: center; gap: 12px; flex: none; }
.tool-group { display: flex; gap: 4px; padding: 6px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: var(--graphite); background: transparent; border: 0; cursor: pointer; position: relative; text-decoration: none; transition: background .2s var(--ease); }
.icon-btn:hover { background: var(--mist-2); color: var(--navy); }
.icon-btn .dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--sky); border: 2px solid #fff; }
.user-chip { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 16px 0 7px; background: var(--card); border-radius: 999px; box-shadow: var(--shadow); text-decoration: none; color: var(--ink); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--mist); color: var(--navy); display: grid; place-items: center; font-weight: 700; font-size: 14px; flex: none; }
.user-chip b { display: block; font-size: 14px; font-weight: 600; line-height: 1.2; }
.user-chip small { display: block; font-size: 12px; color: var(--muted); line-height: 1.2; }

.rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 16px; align-self: start; height: calc(100vh - 120px); z-index: 40; }
.rail-group { background: var(--card); border-radius: 999px; box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.rail-group.bottom { margin-top: auto; }
.rail a, .rail button { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); text-decoration: none; background: none; border: 0; cursor: pointer; transition: background .2s var(--ease), color .2s var(--ease); position: relative; }
.rail a:hover, .rail button:hover { background: var(--mist-2); color: var(--navy); }
.rail a[aria-current="page"] { background: var(--navy); color: #fff; }
.rail a .tip, .rail button .tip { position: absolute; left: 54px; top: 50%; transform: translateY(-50%) translateX(-4px); background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .18s var(--ease), transform .18s var(--ease); z-index: 20; }
.rail a:hover .tip, .rail a:focus-visible .tip, .rail button:hover .tip { opacity: 1; transform: translateY(-50%); }

main { min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin: 4px 0 22px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin-top: 6px; font-size: 15px; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13.5px; color: var(--muted); margin-bottom: 10px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); text-decoration: none; font-weight: 600; }
.crumbs a:hover { color: var(--navy); }

/* ---------- surfaces ---------- */
.card { background: var(--card); border-radius: var(--r-card); box-shadow: var(--shadow); padding: 22px 24px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card-head p { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.well { background: var(--mist-2); border-radius: var(--r-inner); padding: 16px; }
.grid { display: grid; gap: 20px; }
.g-dash { grid-template-columns: 1.15fr 1fr 1fr; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g-side { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.g-side-l { grid-template-columns: 300px minmax(0, 1fr); align-items: start; }
.stack { display: grid; gap: 20px; align-content: start; }
.stack-sm { display: grid; gap: 10px; }
.row { display: flex; align-items: center; gap: 12px; }
.row.wrap { flex-wrap: wrap; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 26px; }

/* signature: the single saturated next-step card */
.next {
  position: relative; overflow: hidden; color: #fff; border-radius: var(--r-card); padding: 24px 26px;
  background: linear-gradient(155deg, #2f74da 0%, #1f55b3 58%, #173f88 100%);
  box-shadow: 0 18px 40px -22px rgba(31, 85, 179, .7);
  display: flex; flex-direction: column; min-height: 248px;
}
.next::after { content: ""; position: absolute; right: -40px; bottom: -40px; width: 220px; height: 220px; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.14) 0 2px, transparent 2px 9px); border-radius: 50%; pointer-events: none; }
.next .label { display: flex; justify-content: space-between; align-items: center; font-weight: 600; font-size: 14px; color: #dbe9fb; }
.next .label .ico-wrap { width: 36px; height: 36px; border-radius: 12px; background: rgba(255,255,255,.16); display: grid; place-items: center; color: #fff; }
.next h2 { color: #fff; font-size: 22px; margin-top: 18px; max-width: 26ch; }
.next p { color: #d6e5fa; margin-top: 6px; font-size: 14px; }
.next .actions { margin-top: auto; padding-top: 18px; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; position: relative; z-index: 1; }

/* level ladder */
.ladder { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; align-items: end; height: 120px; margin-top: 8px; }
.ladder .rung { border-radius: 12px; position: relative; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 8px; font-weight: 700; font-size: 13px; color: var(--navy); background: var(--hatch), #f3f7fc; }
.ladder .rung.done { background: var(--navy); color: #fff; }
.ladder .rung.current { background: var(--sky); color: #fff; }
.ladder .rung:nth-child(1) { height: 40%; } .ladder .rung:nth-child(2) { height: 60%; } .ladder .rung:nth-child(3) { height: 80%; } .ladder .rung:nth-child(4) { height: 100%; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* progress with hatched remainder */
.bar { height: 12px; border-radius: 99px; background: var(--hatch), #f3f7fc; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 99px; background: var(--blue); transition: width .8s var(--ease); }
.bar.done > span { background: var(--ok); }
.bar.thin { height: 8px; }

/* metrics */
.metric { display: flex; flex-direction: column; gap: 4px; }
.metric .v { font-size: 30px; font-weight: 700; letter-spacing: -.02em; color: var(--ink); line-height: 1.1; font-variant-numeric: tabular-nums; }
.metric .k { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.metric .ico-wrap { width: 38px; height: 38px; border-radius: 12px; background: var(--mist-2); color: var(--navy); display: grid; place-items: center; margin-bottom: 8px; }

/* lists */
.list { display: grid; }
.list > * { padding: 14px 0; border-top: 1px solid var(--line-2); }
.list > *:first-child { border-top: 0; padding-top: 2px; }
.course-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 160px auto; gap: 14px; align-items: center; text-decoration: none; color: inherit; }
.course-row:hover h3 { color: var(--blue); }
.tile { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--mist-2); color: var(--navy); }
.tile.navy { background: var(--navy); color: #fff; }
.tile.sky { background: var(--sky); color: #fff; }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; background: var(--line-2); color: var(--graphite); white-space: nowrap; }
.chip.dot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.chip.ok { background: var(--ok-bg); color: var(--ok); }
.chip.warn { background: var(--warn-bg); color: var(--warn); }
.chip.bad { background: var(--bad-bg); color: var(--bad); }
.chip.info { background: var(--mist); color: var(--navy); }
.chip.navy { background: var(--navy); color: #fff; }
.chip.on-dark { background: rgba(255,255,255,.18); color: #fff; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 22px; border-radius: 999px; font: 600 14.5px/1 Manrope, sans-serif; border: 1px solid transparent; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease), transform .2s var(--ease), box-shadow .2s var(--ease); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); color: #fff; box-shadow: 0 8px 20px -10px rgba(19,41,75,.6); }
.btn-blue { background: var(--blue); color: #fff; }
.btn-blue:hover { background: var(--blue-deep); color: #fff; }
.btn-white { background: #fff; color: var(--navy); }
.btn-white:hover { background: var(--mist); color: var(--navy); }
.btn-soft { background: var(--line-2); color: var(--graphite); }
.btn-soft:hover { background: var(--mist); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--graphite); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--sky); color: var(--navy); }
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.btn-ghost-light:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn-danger { background: var(--bad-bg); color: var(--bad); }
.btn-danger:hover { background: var(--bad); color: #fff; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13.5px; }
.btn[disabled], .btn.is-disabled { opacity: .45; pointer-events: none; }
.btn-icon { width: 36px; height: 36px; padding: 0; border-radius: 50%; }

/* forms */
.form { display: grid; gap: 18px; }
.field { display: grid; gap: 7px; }
.field > label, .label { font-weight: 600; font-size: 13.5px; color: var(--graphite); }
.field .hint { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 46px; padding: 11px 14px; border-radius: var(--r-field); border: 1px solid var(--line);
  background: #f7f9fc; color: var(--ink); font: 500 14.5px/1.4 Manrope, sans-serif; transition: border-color .2s var(--ease), background .2s var(--ease), box-shadow .2s var(--ease);
}
textarea.input { min-height: 110px; resize: vertical; }
.input::placeholder { color: #7b8594; }
.input:hover { border-color: #cdd7e3; }
.input:focus { outline: none; border-color: var(--sky); background: #fff; box-shadow: 0 0 0 4px rgba(58,155,220,.16); }
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' fill='none' stroke='%235a6473' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 7 4 4 4-4'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px; }
.check { display: flex; align-items: flex-start; gap: 10px; font-weight: 500; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--navy); margin-top: 2px; flex: none; }
.form-row { display: grid; gap: 16px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-row.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.actions-bar { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding-top: 6px; }
.search { position: relative; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 42px; border-radius: 999px; background: #fff; }
.drop { border: 1.5px dashed #b9cde4; border-radius: var(--r-inner); padding: 26px; text-align: center; background: var(--mist-2); color: var(--muted); cursor: pointer; transition: border-color .2s, background .2s; display: grid; gap: 8px; justify-items: center; }
.drop:hover, .drop.over { border-color: var(--sky); background: #e8f2fc; }
.drop input { display: none; }
.drop b { color: var(--navy); }

/* alerts */
.flash { padding: 13px 16px; border-radius: var(--r-inner); font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; margin-bottom: 18px; }
.flash.ok { background: var(--ok-bg); color: #0f5e40; }
.flash.bad { background: var(--bad-bg); color: #8f2a25; }
.flash.info { background: var(--mist); color: var(--navy); }

/* tables */
.table-wrap { border: 1px solid var(--line); border-radius: 16px; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; font-size: 13px; color: var(--muted); background: #f5f7fa; padding: 12px 16px; white-space: nowrap; }
.table td { padding: 13px 16px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.table tr:hover td { background: #fafcfe; }
.table td.actions { text-align: right; white-space: nowrap; }
.table .person { display: flex; align-items: center; gap: 10px; }
.table .person .avatar { width: 34px; height: 34px; font-size: 12.5px; }
.table .person b { display: block; font-weight: 600; }
.table .person small { color: var(--muted); font-size: 12.5px; }

/* empty states */
.empty { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 34px 18px; border-radius: var(--r-inner); background: var(--hatch), #f6f9fd; }
.empty .tile { width: 52px; height: 52px; background: #fff; box-shadow: var(--shadow); }
.empty h3 { font-size: 16px; }
.empty p { color: var(--muted); max-width: 46ch; font-size: 14px; }

/* tabs / filters */
.segmented { display: inline-flex; padding: 5px; background: #fff; border-radius: 999px; box-shadow: var(--shadow); gap: 2px; flex-wrap: wrap; }
.segmented a { padding: 8px 16px; border-radius: 999px; font-weight: 600; font-size: 13.5px; color: var(--graphite); text-decoration: none; }
.segmented a:hover { background: var(--mist-2); }
.segmented a[aria-current="true"] { background: var(--navy); color: #fff; }

/* catalog cards */
.course-card { display: flex; flex-direction: column; gap: 12px; text-decoration: none; color: inherit; transition: transform .3s var(--ease), box-shadow .3s var(--ease); }
.course-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.course-card .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.course-card p { color: var(--muted); font-size: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.course-card .foot { margin-top: auto; display: grid; gap: 10px; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); font-weight: 600; }
.meta span { display: inline-flex; align-items: center; gap: 6px; }

/* course structure */
.module { border: 1px solid var(--line); border-radius: 18px; overflow: hidden; }
.module + .module { margin-top: 14px; }
.module-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 18px; background: #f7f9fc; }
.module-head h3 { font-size: 15px; }
.item { display: grid; grid-template-columns: 36px minmax(0,1fr) auto; gap: 12px; align-items: center; padding: 12px 18px; border-top: 1px solid var(--line-2); text-decoration: none; color: inherit; }
a.item:hover { background: var(--mist-2); }
.item .tile { width: 36px; height: 36px; border-radius: 11px; }
.item.locked .tile { background: var(--hatch), #f3f7fc; color: var(--faint); }
.item .t { font-weight: 600; }
.item small { display: block; color: var(--muted); font-size: 12.5px; }

/* lesson viewer */
.viewer { background: var(--graphite); border-radius: var(--r-card); padding: 14px; box-shadow: var(--shadow); }
.viewer-stage { background: #22262c; border-radius: 16px; display: grid; place-items: center; min-height: 420px; position: relative; overflow: hidden; }
.viewer-stage canvas { max-width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 4px 2px; color: #e7ecf3; flex-wrap: wrap; }
.viewer-bar .pages { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 14px; }
.viewer .btn-soft { background: #3a3f47; color: #f1f4f8; }
.viewer .btn-soft:hover { background: #4a505a; color: #fff; }
.viewer-progress { height: 4px; border-radius: 99px; background: #3a3f47; margin: 10px 4px 0; overflow: hidden; }
.viewer-progress span { display: block; height: 100%; background: var(--sky); width: 0; transition: width .4s var(--ease); }
.viewer:fullscreen { border-radius: 0; display: flex; flex-direction: column; padding: 18px; }
.viewer:fullscreen .viewer-stage { flex: 1; }
.loading { color: #aeb7c4; font-weight: 600; display: flex; gap: 10px; align-items: center; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #4a505a; border-top-color: var(--sky); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* test taking */
.q { padding: 22px 24px; }
.q-head { display: flex; gap: 12px; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.q-num { font-weight: 700; color: var(--sky); font-variant-numeric: tabular-nums; }
.q h3 { font-size: 16.5px; line-height: 1.45; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; transition: border-color .2s var(--ease), background .2s var(--ease); font-weight: 500; }
.opt + .opt { margin-top: 8px; }
.opt:hover { border-color: #b9cde4; background: var(--mist-2); }
.opt input { width: 18px; height: 18px; accent-color: var(--navy); margin-top: 2px; flex: none; }
.opt:has(input:checked) { border-color: var(--navy); background: #f1f5fb; }
.opt.correct { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.qnav { display: flex; flex-wrap: wrap; gap: 6px; }
.qnav a { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-weight: 700; font-size: 13px; text-decoration: none; color: var(--graphite); background: var(--line-2); font-variant-numeric: tabular-nums; }
.qnav a.answered { background: var(--navy); color: #fff; }
.timer { font-variant-numeric: tabular-nums; font-weight: 700; }
.score-ring { width: 128px; height: 128px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c, var(--blue)) calc(var(--p) * 1%), #e8eef6 0); }
.score-ring > div { width: 100px; height: 100px; border-radius: 50%; background: #fff; display: grid; place-items: center; font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* admin builder */
.qb { border: 1px solid var(--line); border-radius: 18px; padding: 18px; background: #fff; display: grid; gap: 14px; }
.qb + .qb { margin-top: 14px; }
.qb-head { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.qb-opt { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; }
.qb-opt input[type=text] { min-height: 40px; padding: 8px 12px; }
.pill-num { min-width: 30px; height: 30px; padding: 0 8px; border-radius: 99px; background: var(--navy); color: #fff; display: inline-grid; place-items: center; font-weight: 700; font-size: 13px; }
.sticky-actions { position: sticky; bottom: 16px; z-index: 5; margin-top: 18px; background: rgba(255,255,255,.92); backdrop-filter: blur(8px); border-radius: 999px; padding: 8px 8px 8px 22px; box-shadow: var(--shadow-lift); display: flex; justify-content: space-between; align-items: center; gap: 12px; }

/* auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); padding: 16px; gap: 16px; }
.auth-panel { background: var(--card); border-radius: 28px; box-shadow: var(--shadow); display: grid; place-items: center; padding: 40px 24px; }
.auth-form { width: min(400px, 100%); display: grid; gap: 22px; }
.auth-art { border-radius: 28px; padding: 40px; color: #fff; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; background: linear-gradient(160deg, #1f55b3, #13294b 70%); }
.auth-art::after { content: ""; position: absolute; inset: auto -120px -120px auto; width: 460px; height: 460px; border-radius: 50%; background: repeating-linear-gradient(-45deg, rgba(255,255,255,.1) 0 2px, transparent 2px 10px); }
.auth-art h2 { color: #fff; font-size: clamp(26px, 2.6vw, 38px); line-height: 1.15; max-width: 16ch; }
.auth-art p { color: #cfdcf0; max-width: 42ch; margin-top: 14px; }
.ladder-art { display: flex; gap: 10px; align-items: flex-end; height: 160px; position: relative; z-index: 1; }
.ladder-art div { flex: 1; border-radius: 14px; background: rgba(255,255,255,.12); padding: 10px; font-weight: 700; font-size: 13px; display: flex; align-items: flex-end; }
.ladder-art div:nth-child(1) { height: 35%; } .ladder-art div:nth-child(2) { height: 55%; } .ladder-art div:nth-child(3) { height: 78%; background: rgba(58,155,220,.55); } .ladder-art div:nth-child(4) { height: 100%; background: #fff; color: var(--navy); }

/* certificate */
.cert { background: #fff; border-radius: 24px; padding: 56px; box-shadow: var(--shadow); position: relative; overflow: hidden; }
.cert::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 14px; background: linear-gradient(var(--navy) 70%, var(--sky) 70%); }

.dialog { border: 0; border-radius: 22px; padding: 26px; width: min(520px, calc(100vw - 32px)); box-shadow: var(--shadow-lift); color: var(--ink); }
.dialog::backdrop { background: rgba(19,41,75,.35); backdrop-filter: blur(2px); }

/* motion: one authored entrance for the main column */
@media (prefers-reduced-motion: no-preference) {
  main > * { animation: rise .5s var(--ease) both; }
  main > *:nth-child(2) { animation-delay: .04s; }
  main > *:nth-child(3) { animation-delay: .08s; }
  main > *:nth-child(4) { animation-delay: .12s; }
}
@keyframes rise { from { transform: translateY(6px); } }

/* responsive */
@media (max-width: 1200px) {
  .g-dash { grid-template-columns: 1fr 1fr; }
  .g-dash > .next { grid-column: 1 / -1; }
  .g-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .g-side { grid-template-columns: 1fr; }
  .user-chip .who { display: none; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); padding: 12px 16px 96px; }
  .topbar { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; margin: 0; }
  .tools { margin-left: auto; }
  .rail { position: fixed; left: 12px; right: 12px; bottom: 12px; top: auto; height: auto; flex-direction: row; z-index: 30; }
  .rail-group { flex-direction: row; border-radius: 999px; flex: 1; justify-content: space-around; }
  .rail-group.bottom { flex: none; margin: 0; }
  .rail .tip { display: none; }
  .rail { gap: 8px; }
  .rail-group { padding: 6px; gap: 2px; }
  .rail-group.admin { display: none; }
  .rail a, .rail button { width: 42px; height: 42px; }
  .g-dash, .g-2, .g-3, .g-side-l { grid-template-columns: 1fr; }
  .form-row, .form-row.three { grid-template-columns: 1fr; }
  .course-row { grid-template-columns: 44px minmax(0, 1fr); }
  .course-row > :nth-child(n+3) { grid-column: 2; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 260px; }
}
@media (max-width: 560px) {
  .g-4 { grid-template-columns: 1fr; }
  .card { padding: 18px; border-radius: 18px; }
  .brand small { display: none; }
  .tool-group .hide-sm { display: none; }
  .tool-group:not(:has(> :not(.hide-sm))) { display: none; }
  .row:has(> .btn) { flex-wrap: wrap; }
  .app { padding: 10px 12px 96px; gap: 14px; }
  .topbar { gap: 8px; }
  .brand { height: 48px; padding: 0 14px 0 6px; gap: 8px; }
  .brand-mark { width: 36px; height: 36px; }
  .brand b { font-size: 14px; }
  .tools { gap: 6px; }
  .tool-group { padding: 4px; gap: 2px; }
  .icon-btn { width: 38px; height: 38px; }
  .user-chip { height: 48px; padding: 0 6px; }
  .avatar { width: 36px; height: 36px; font-size: 13px; }
  .nav a { padding: 8px 14px; font-size: 13.5px; }
  h1 { font-size: 24px; }
  .page-head { margin-bottom: 16px; }
  .viewer { padding: 8px; border-radius: 16px; }
  .viewer-stage { min-height: 0; border-radius: 10px; padding: 6px; touch-action: pan-y; }
  .viewer-bar .small { display: none; }
  .viewer-bar { padding: 10px 2px 0; }
  .module-head { padding: 12px 14px; }
  .module-head .num, .module-head .small { white-space: nowrap; }
  .item { grid-template-columns: 32px minmax(0, 1fr); gap: 4px 12px; padding: 12px 14px; align-items: start; }
  .item .tile { width: 32px; height: 32px; }
  .item > :nth-child(3) { grid-column: 2; justify-self: start; }
  .item > svg:nth-child(3) { display: none; }
  .item .t { font-size: 14px; line-height: 1.35; }
  main select.input, main input.input { min-width: 0 !important; max-width: 100%; }
}
@media (max-width: 380px) {
  .rail { left: 8px; right: 8px; bottom: 8px; gap: 6px; }
  .rail-group { padding: 4px; }
  .rail a, .rail button { width: 36px; height: 36px; }
  .brand b { font-size: 13px; }
  .brand { padding-right: 10px; }
}
@media print {
  body { background: #fff; }
  .topbar, .rail, .no-print { display: none !important; }
  .app { display: block; padding: 0; }
  .cert { box-shadow: none; }
}

/* Бічна панель уроку: уроки поточного модуля */
.seq-card { position: sticky; top: 24px; }
.seq-head { margin-bottom: 14px; }
.seq-kicker { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sky); margin-bottom: 6px; }
.seq-head h2 { font-size: 18px; line-height: 1.3; overflow-wrap: anywhere; }
.seq-progress { height: 6px; border-radius: 99px; background: var(--line-2); overflow: hidden; margin: 12px 0 8px; }
.seq-progress span { display: block; height: 100%; background: var(--sky); border-radius: inherit; }
.seq { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; max-height: calc(100vh - 260px); overflow-y: auto; margin: 0 -10px; padding: 0 10px; }
.seq-item { display: flex; align-items: flex-start; gap: 12px; min-width: 0; padding: 10px; border-radius: var(--r-inner); color: inherit; text-decoration: none; transition: background .15s var(--ease); }
.seq-item:hover { background: var(--mist-2); }
.seq-item.current { background: var(--mist); }
.seq-item.current .seq-title { font-weight: 700; color: var(--navy); }
.seq-item.test { padding-left: 24px; }
.seq-mark { flex: none; width: 28px; height: 28px; border-radius: 99px; display: grid; place-items: center; font-size: 12.5px; font-weight: 700; background: var(--line-2); color: var(--graphite); }
.seq-mark.cur { background: var(--sky); color: #fff; }
.seq-mark.done { background: var(--navy); color: #fff; }
.seq-item.test .seq-mark { width: 24px; height: 24px; border-radius: 8px; background: var(--mist-2); color: var(--sky); }
.seq-item.test .seq-mark.done { background: var(--ok-bg); color: var(--ok); }
.seq-body { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 4px; }
.seq-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; font-size: 14.5px; line-height: 1.35; }
.seq-item.test .seq-title { font-size: 13.5px; color: var(--muted); padding-top: 0; }
.seq-item.test .seq-body { padding-top: 2px; }
.seq-item.test .chip { font-size: 11.5px; padding: 2px 8px; }
.seq-all { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 14px; padding: 11px; border-radius: var(--r-inner); background: var(--line-2); color: var(--graphite); font-weight: 600; font-size: 14px; text-decoration: none; }
.seq-all:hover { background: var(--mist); color: var(--navy); }
@media (max-width: 1100px) { .seq-card { position: static; } .seq { max-height: none; } }
