.ai-page:not(.ai-course) .content-page-main {
  width: 100%;
  margin-right: 0;
}

.ai-page .courses-card-list .msc-list-item {
  width: calc((100% - 60px) / 3);
}

.ai-page .courses-card-list .mscl-item-btm > div:not(:last-child) {
  margin-right: 12px;
}

.ai-page h1 {
  margin-bottom: 16px;
}

.ai-page .content-page-main a.btn-blue {
  color: #fff;
  text-decoration: none;
  margin-top: 20px;
  margin-bottom: 28px;
}

.ai-page .content-page-main a.btn-blue:hover {
  color: #fff;
  background: #505ecd;
}

.ai-btn-center {
  text-align: center;
}

.ai-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  text-decoration: none;
}

.ai-back::before {
  content: "";
  width: 8px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
}

.ai-page .content-page-main a.ai-back:hover {
  color: #505ecd;
}

.ai-role,
.ai-preset,
.ai-reset {
  border: 1px solid #d5daf0;
  background: #fff;
  color: #1d1d1f;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
}

.ai-role.is-active,
.ai-preset:hover,
.ai-role:hover {
  background: #293699;
  border-color: #293699;
  color: #fff;
}

.ai-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin: 8px 0 28px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e1e5f4;
  border-left: 3px solid #293699;
  border-radius: 12px;
  color: #293699;
}

.ai-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
}

.ai-legend-note {
  flex: 1 0 100%;
  color: #3c4257;
  font-size: 14px;
  font-weight: 500;
}

.ai-tree {
  display: flex;
  align-items: center;
  max-width: 100%;
  margin: 12px 0 36px;
}

.ai-tree-trunk {
  flex: 0 0 230px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-right: 36px;
  background: #293699;
  color: #fff;
  border-radius: 16px;
  padding: 16px;
}

.ai-tree-trunk::after {
  content: "";
  position: absolute;
  top: 50%;
  right: -36px;
  width: 36px;
  height: 2px;
  background: #8b97cf;
  transform: translateY(-1px);
}

.ai-tree-trunk-title {
  font-weight: 600;
  margin-bottom: 0;
}

.ai-tree-trunk .ai-leaf {
  width: 100%;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.12);
  border-color: transparent;
  color: #fff;
}

.ai-tree-trunk .ai-leaf-name {
  color: #fff;
}

.ai-tree-trunk .ai-pill {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.ai-tree-branches {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.ai-tree-branch {
  display: grid;
  grid-template-columns: 28px minmax(148px, 190px) minmax(0, 1fr);
  column-gap: 8px;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.ai-tree-elbow {
  position: relative;
  align-self: stretch;
}

.ai-tree-elbow::before,
.ai-tree-elbow::after {
  content: "";
  position: absolute;
  background: #8b97cf;
}

.ai-tree-elbow::before {
  left: 0;
  top: -6px;
  bottom: -6px;
  width: 2px;
}

.ai-tree-branch:first-child .ai-tree-elbow::before {
  top: 50%;
}

.ai-tree-branch:last-child .ai-tree-elbow::before {
  bottom: 50%;
}

.ai-tree-branch:first-child:last-child .ai-tree-elbow::before {
  display: none;
}

.ai-tree-elbow::after {
  left: 0;
  top: 50%;
  width: calc(100% + 8px);
  height: 2px;
  transform: translateY(-1px);
}

.ai-tree-branch-name {
  background: #e8edff;
  border: 1px solid #293699;
  border-radius: 12px;
  padding: 8px 12px 10px;
  color: #293699;
  font-weight: 600;
  line-height: 1.3;
}

.ai-tree-branch-name::before {
  content: "Раздел";
  display: block;
  margin-bottom: 2px;
  color: #5c6bc4;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.ai-tree-leaves {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  min-width: 0;
}

.ai-tree-leaves > div {
  display: flex;
  min-width: 0;
}

.ai-leaf {
  position: relative;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  background: #fff;
  border: 1px solid #e1e5f4;
  border-radius: 12px;
  padding: 8px 10px 10px;
}

.ai-leaf-name {
  border: 0;
  background: none;
  padding: 0;
  color: inherit;
  font: inherit;
  font-weight: 500;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.ai-leaf-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
  margin: 0 0 6px;
}

.ai-leaf .ai-pill {
  padding: 0 5px;
  font-size: 10px;
  line-height: 16px;
}

.ai-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  white-space: nowrap;
}

.ai-pill-hours {
  background: #eef1fb;
  color: #293699;
}

.ai-pill-zn {
  background: #e8f6ee;
  color: #1d7a45;
}

.ai-pill-pr {
  background: #e7f0ff;
  color: #1d4ed8;
}

.ai-pill-vn {
  background: #f3e8ff;
  color: #6d28d9;
}

.ai-pill-must {
  background: #fff4d6;
  color: #8a5a00;
}

.ai-leaf .ai-tip-btn {
  position: static;
  flex: 0 0 16px;
  width: 16px;
  height: 16px;
  font-size: 11px;
  line-height: 16px;
}

.ai-tip-btn {
  border: 0;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #eef1fb;
  color: #293699;
  cursor: pointer;
  font-weight: 600;
  line-height: 22px;
  padding: 0;
}

.ai-tree-trunk .ai-tip-btn {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.ai-tip {
  position: absolute;
  z-index: 5;
  left: 0;
  top: calc(100% + 6px);
  width: 560px;
  max-width: calc(100vw - 48px);
  background: #fff;
  color: #1d1d1f;
  border-radius: 12px;
  border: 2px solid #293699;
  box-shadow: 0 8px 28px rgba(28, 35, 84, 0.16);
  box-sizing: border-box;
  padding: 12px;
  text-align: left;
}

.ai-tip[hidden] {
  display: none;
}

.ai-tip-meta {
  display: block;
  margin-top: 8px;
  color: #5c6278;
  font-size: 13px;
}

.ai-gloss {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 40px;
}

.ai-gloss-card {
  background: #fff;
  border: 1px solid #e1e5f4;
  border-radius: 16px;
  padding: 16px;
}

.ai-gloss-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.ai-gloss-card p {
  margin: 0;
}

.ai-constructor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
  margin-top: 16px;
}

.ai-side-card {
  position: sticky;
  top: 166px;
  background: #fff;
  border: 1px solid #e1e5f4;
  border-radius: 16px;
  padding: 16px;
}

.ai-side-card h2,
.ai-summary h3 {
  margin-top: 0;
}

.ai-roles,
.ai-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.ai-module-group {
  background: #fff;
  border: 1px solid #e1e5f4;
  border-radius: 16px;
  padding: 8px 16px 16px;
  margin-bottom: 12px;
}

.ai-module-group h2 {
  display: flex;
  justify-content: space-between;
  font-size: 20px;
}

.ai-module-group h2 span {
  color: #5c6278;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}

.ai-module {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 8px;
  margin: 4px -8px;
  border-top: 1px solid #eef1f8;
  border-radius: 12px;
  cursor: pointer;
}

.ai-module.is-on {
  background: #e8edff;
  border-top-color: transparent;
}

.ai-page .ai-check {
  -webkit-appearance: checkbox;
  appearance: auto;
  width: 18px;
  height: 18px;
  margin: 3px 0 0;
  flex: 0 0 18px;
  accent-color: #293699;
  cursor: pointer;
}

.ai-module-side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-content: flex-start;
  gap: 6px;
  max-width: 48%;
}

.ai-module-main {
  flex: 1;
  min-width: 0;
}

.ai-module-num {
  display: inline-block;
  min-width: 36px;
  color: #5c6278;
}

.ai-module-name {
  font-weight: 600;
}

.ai-module-audience {
  display: block;
  color: #5c6278;
  font-size: 14px;
}

.ai-summary-list {
  padding-left: 18px;
}

.ai-summary-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-order[disabled] {
  opacity: 0.5;
  cursor: default;
}

@media (max-width: 1199px) {
  .ai-side-card {
    top: 106px;
  }
}

@media (max-width: 1100px) {
  .ai-page .courses-card-list .msc-list-item {
    width: calc((100% - 30px) / 2);
  }
}

@media (max-width: 768px) {
  .ai-tree,
  .ai-constructor {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .ai-tree-trunk {
    flex-basis: auto;
    width: auto;
    margin-right: 0;
    margin-bottom: 8px;
  }

  .ai-tree-trunk::after,
  .ai-tree-elbow {
    display: none;
  }

  .ai-tree-branches {
    margin-left: 8px;
    padding-left: 14px;
    border-left: 2px solid #8b97cf;
  }

  .ai-tree-branch {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .ai-tree-branch-name,
  .ai-leaf {
    width: auto;
  }

  .ai-side-card {
    position: static;
    order: -1;
  }

  .ai-gloss {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  .ai-page .courses-card-list .msc-list-item {
    width: 100%;
  }
}

#ai-tree,
#roles {
  scroll-margin-top: 166px;
}

.ai-doors {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 12px;
}

.ai-door {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  min-height: 0;
  padding: 16px;
  text-align: left;
  text-decoration: none;
  color: #293699;
  background: #fff;
  border: 1px solid #293699;
  border-radius: 12px;
  font-weight: 400;
}

.ai-door-icon {
  font-size: 22px;
  line-height: 1;
}

.ai-door-title {
  font-weight: 600;
  font-size: 18px;
  line-height: 1.3;
}

.ai-door-text {
  color: #3c4257;
  font-size: 14px;
  line-height: 1.45;
}

.ai-page .content-page-main a.ai-door:hover {
  background: #e8edff;
  color: #293699;
}

.ai-doors-note {
  margin: 0 0 28px;
  color: #5c6278;
}

.ai-warn {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #fff;
  border-left: 3px solid #293699;
  border-radius: 8px;
}

.ai-summary-meta,
.ai-match {
  margin: 0 0 12px;
}

.ai-course-meta {
  color: #5c6278;
}

.ai-tip-label {
  display: block;
  margin-top: 8px;
  font-weight: 600;
}

.ai-tip a {
  display: block;
  margin-top: 4px;
}

.ai-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  width: 100%;
  max-width: 100%;
  margin: 0 0 16px;
}

.ai-filters label {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 320px;
  max-width: 100%;
  min-width: 0;
  font-weight: 600;
}

.ai-filters label:last-child {
  width: 200px;
}

.ai-filters select {
  min-width: 0;
  width: 0;
  height: 0;
}

.ai-page .ai-filters .ui-selectmenu-button {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

.ai-page .ai-filters .ui-selectmenu-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 20px;
}

.ai-page .ai-filters .ui-selectmenu-menu,
.ai-page .ai-filters .ui-selectmenu-open,
.ai-page .ai-filters .ui-menu {
  width: 100% !important;
  max-width: 100%;
  left: 0 !important;
  box-sizing: border-box;
}

.ai-page .table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  margin: 12px 0 40px;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(23, 109, 234, 0.15);
}

.ai-page table.ai-schedule {
  table-layout: fixed;
  width: 100%;
  min-width: 760px;
  margin: 0;
  overflow: hidden;
  background: #fff;
  font-size: 14px;
  border-radius: 20px;
}

.ai-page table.ai-schedule td {
  min-width: 0;
  padding: 10px 12px;
  font-size: 14px;
  vertical-align: middle;
  background: #fff;
  overflow-wrap: break-word;
}

.ai-page table.ai-schedule thead td {
  background: #f1f4f8;
}

.ai-page table.ai-schedule td:nth-child(1) { width: 26%; }
.ai-page table.ai-schedule td:nth-child(2) { width: 18%; }
.ai-page table.ai-schedule td:nth-child(3) { width: 8%; }
.ai-page table.ai-schedule td:nth-child(4) { width: 16%; }
.ai-page table.ai-schedule td:nth-child(5) { width: 14%; }
.ai-page table.ai-schedule td:nth-child(6) { width: 18%; }

.ai-page table.ai-schedule .btn {
  display: inline-block;
  width: 100%;
  max-width: 148px;
  margin: 0;
  padding: 8px 10px;
  font-size: 14px;
  line-height: 18px;
  box-sizing: border-box;
  white-space: normal;
}

.ai-schedule-empty {
  margin: 8px 0 80px;
}

.ai-summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-summary-actions .ai-reset,
.ai-page .ai-summary-actions .btn {
  height: 36px;
  margin: 0;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 18px;
  box-sizing: border-box;
}

.ai-summary-name a {
  color: #293699;
  font-weight: 600;
  text-decoration: none;
}

.ai-summary-name a:hover {
  text-decoration: underline;
}

.ai-schedule tr.is-hidden {
  display: none;
}

.ai-role-pick {
  display: block;
  position: relative;
  width: 100%;
  margin: 0 0 16px;
  font-weight: 600;
}

.ai-side-card .ui-selectmenu-button {
  width: 100% !important;
  max-width: 100%;
  box-sizing: border-box;
}

.ai-side-card .ui-selectmenu-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 20px;
}

.ai-side-card .ui-selectmenu-menu,
.ai-side-card .ui-selectmenu-open,
.ai-side-card .ui-menu {
  width: 100% !important;
  max-width: 100%;
  left: 0 !important;
  box-sizing: border-box;
}

.ai-summary-list {
  max-height: 240px;
  overflow: auto;
}

.ai-course .short-image .content-page-main {
  width: 100%;
  margin-right: 0;
}

.ai-course .content-page-secondary .ai-runs-card {
  position: sticky;
  top: 180px;
}

.ai-course .information-page-col-cnt {
  justify-content: flex-start;
  width: auto;
  max-width: 760px;
  margin-top: 28px;
}

.ai-course .information-page-col-cnt .ipcc-cnt {
  width: auto;
  max-width: 280px;
  flex: 0 1 auto;
}

.ai-course .information-page-col-cnt .ipcc-cnt:nth-child(3) {
  min-width: 0;
}

.ai-course .information-page-col-cnt .ipcc-sep {
  display: block;
  flex: 0 0 1px;
}

.ai-runs-card {
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 8px 40px rgba(23, 109, 234, 0.15);
  padding: 20px;
}

.ai-runs-card h2 {
  margin: 0 0 8px;
  font-size: 22px;
}

.ai-runs-price {
  margin: 0 0 12px;
  font-weight: 600;
}

.ai-course table.ai-runs {
  table-layout: auto;
  width: 100%;
  margin: 0;
  border-radius: 0;
  font-size: 13px;
}

.ai-course table.ai-runs td {
  padding: 6px 4px;
  font-size: 13px;
  vertical-align: middle;
  border-bottom: 1px solid #e4e7f4;
}

.ai-course table.ai-runs td:last-child {
  width: 1%;
  text-align: right;
}

.ai-course table.ai-runs .btn {
  width: auto;
  margin: 0;
  padding: 6px 10px;
  font-size: 13px;
}

.ai-profs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 28px;
}

.ai-page .content-page-main button.ai-prof,
.ai-prof {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  width: 100%;
  min-height: 0;
  margin: 0;
  padding: 16px;
  text-align: left;
  text-decoration: none;
  color: #171717;
  background: #fff;
  border: 1px solid #d5dadf;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
}

.ai-page .content-page-main button.ai-prof:hover,
.ai-page .content-page-main button.ai-prof.is-on {
  border-color: #293699;
  background: #e8edff;
  color: #171717;
}

.ai-prof-detail {
  margin: 16px 0 80px;
  padding: 20px;
  background: #fff;
  border: 1px solid #293699;
  border-radius: 12px;
}

.ai-prof-detail[hidden] {
  display: none !important;
}

.ai-prof-detail-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.ai-prof-badge {
  display: inline-block;
  margin-right: 8px;
  padding: 2px 8px;
  border-radius: 8px;
  background: #e8edff;
  color: #293699;
  font-size: 13px;
  font-weight: 600;
  vertical-align: middle;
}

.ai-prof-detail-head strong {
  font-size: 18px;
  line-height: 1.3;
  vertical-align: middle;
}

.ai-page .content-page-main .ai-prof-detail-head a.btn {
  flex: 0 0 auto;
  margin: 0;
  padding: 8px 12px;
  font-size: 14px;
  line-height: 18px;
}

.ai-prof-desc {
  margin: 10px 0;
  color: #3c4257;
}

.ai-prof-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  margin-top: 14px;
}

.ai-prof-actions .btn {
  margin: 0;
}

.ai-prof-role {
  color: #293699;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
}

.ai-prof-course {
  color: #171717;
  font-size: 14px;
  line-height: 1.4;
}

.ai-prof-meta {
  color: #3c4257;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.3;
}

@media (max-width: 1199px) {
  #ai-tree,
  #roles {
    scroll-margin-top: 106px;
  }
}

@media (max-width: 900px) {
  .ai-doors,
  .ai-profs {
    grid-template-columns: 1fr 1fr;
  }

  .ai-filters label,
  .ai-filters label:last-child {
    width: 100%;
  }
}

@media (max-width: 767px) {
  .ai-profs {
    grid-template-columns: 1fr;
  }

  .ai-course .information-page-col-cnt {
    flex-wrap: wrap;
    max-width: none;
  }

  .ai-course .information-page-col-cnt .ipcc-cnt {
    max-width: 100%;
  }

  .ai-course .content-page-secondary .ai-runs-card {
    position: static;
  }

  .ai-course table.ai-runs,
  .ai-course table.ai-runs tbody,
  .ai-course table.ai-runs tr,
  .ai-course table.ai-runs td,
  .ai-course table.ai-runs td:last-child {
    display: block;
    width: 100% !important;
    white-space: normal;
    text-align: left;
  }

  .ai-course table.ai-runs tr {
    padding: 8px 0;
    border-bottom: 1px solid #e4e7f4;
  }

  .ai-course table.ai-runs td {
    border-bottom: 0;
    padding: 2px 0;
  }

  .ai-course table.ai-runs .btn {
    width: 100%;
    margin-top: 6px;
  }
}
