/* ==========================================================================
   Студия курсов (#ta-course-builder, #cb-creator)
   ========================================================================== */

.cb-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  padding: 20px 22px 44px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.cb-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.cb-topbar-title {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}

.cb-topbar-title h1 {
  margin: 0;
  font-size: clamp(22px, 2.4vw, 27px);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.cb-count-pill {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--line);
}

.cb-tone-blue { --cb-tone: var(--accent); }
.cb-tone-violet { --cb-tone: var(--pro, #7C3AED); }
.cb-tone-green { --cb-tone: var(--confirm); }
.cb-tone-amber { --cb-tone: var(--notif); }
.cb-tone-cyan { --cb-tone: #0284C7; }

/* Каталог «Мои курсы» */
.cb-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.cb-filter-pills {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.cb-toolbar-search {
  flex: 1 1 240px;
  max-width: 340px;
}

.cb-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 0;
}

.cb-search-ico {
  position: absolute;
  left: 11px;
  color: var(--muted);
  pointer-events: none;
  display: inline-flex;
}

.cb-search-inp {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  transition: border-color .16s ease, box-shadow .16s ease;
}

.cb-search-inp:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}

.cb-catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr));
  gap: 14px;
  min-width: 0;
}

.cb-cat-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 18px 18px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
  min-width: 0;
  transition: border-color .18s cubic-bezier(0.2, 0.8, 0.2, 1),
              background-color .18s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.cb-cat-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cb-tone, var(--accent));
}

.cb-cat-card:hover {
  border-color: var(--line-strong, var(--line));
}

.cb-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cb-cat-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.cb-cat-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  line-height: 1.28;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.cb-cat-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cb-cat-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-cat-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: auto;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.cb-code-copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: border-color .15s ease, color .15s ease;
}

.cb-code-copy:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cb-group-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.cb-mini-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--ink-2);
}

.cb-status-dot {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.cb-status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--muted);
}

.cb-status-dot.is-pub {
  color: var(--confirm);
}

.cb-status-dot.is-pub::before {
  background: var(--confirm);
}

/* Пустой экран с 3 шагами */
.cb-empty-studio {
  display: grid;
  gap: 18px;
  padding: 28px 24px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px dashed var(--line-strong, var(--line));
}

.cb-onboard-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cb-onboard-step {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.cb-onboard-step > span {
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
  color: var(--accent);
}

/* Внутри курса — рабочее пространство */
.cb-ws-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.cb-ws-top-right {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-status-btn {
  display: inline-flex;
  align-items: center;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.cb-status-btn:hover {
  border-color: var(--line-strong, var(--line));
  background: var(--surface-2);
}

.cb-status-btn.is-pub {
  border-color: color-mix(in srgb, var(--confirm) 35%, var(--line));
  background: var(--confirm-soft, color-mix(in srgb, var(--confirm) 10%, transparent));
}

.cb-hero {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  overflow: hidden;
}

.cb-hero::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cb-tone, var(--accent));
}

.cb-hero-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-hero-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.cb-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.cb-hero-heading {
  min-width: 0;
  flex: 1 1 200px;
  display: grid;
  gap: 3px;
}

.cb-hero-top .cb-group-pills {
  flex-shrink: 0;
  justify-content: flex-end;
  margin-top: 2px;
}

.cb-hero-badges {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-code-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
}

.cb-hero-title {
  margin: 0;
  font-size: clamp(19px, 2vw, 23px);
  font-weight: 700;
  line-height: 1.25;
  color: var(--ink);
}

.cb-hero-desc {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.48;
  color: var(--ink-2);
}

.cb-ws-meta-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.cb-ws-invite {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-ws-invite-code,
.cb-ws-invite-acts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cb-invite-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg);
  border: 1px dashed var(--line-strong, var(--line));
}

.cb-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}

.cb-tab-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.cb-tab-btn:hover {
  color: var(--ink);
}

.cb-tab-btn.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
}

.cb-panel {
  display: grid;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  min-width: 0;
}

/* Программа и модули */

.cb-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.cb-step-row {
  display: grid;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px solid var(--line);
  transition: border-color .15s ease;
  min-width: 0;
}

.cb-step-row:hover {
  border-color: var(--line-strong, var(--line));
}

.cb-step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.cb-step-num {
  width: 26px;
  height: 26px;
  flex: none;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.cb-step-info {
  display: grid;
  gap: 3px;
  min-width: 0;
  flex: 1 1 auto;
}

.cb-step-title {
  font-size: 14px;
  font-weight: 650;
  color: var(--ink);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.cb-step-del-btn {
  color: var(--bad);
  padding-inline: 8px;
}

.cb-empty-program {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 20px;
  border-radius: 14px;
  background: var(--bg);
  border: 1px dashed var(--line-strong, var(--line));
}

/* Конструктор урока */

.cb-field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.cb-label {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
}

.cb-opt-list {
  display: grid;
  gap: 8px;
}

.cb-opt-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cb-opt-row .ta-input {
  flex: 1 1 auto;
  min-width: 0;
}

.cb-opt-check {
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 10px;
  border: 1.5px solid var(--line-strong, var(--line));
  background: var(--surface);
  color: transparent;
  font-size: 14px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.cb-opt-check.is-correct {
  border-color: var(--confirm);
  background: var(--confirm);
  color: #fff;
}

.cb-pair-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.cb-classify-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 8px;
}

.cb-classify-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Живой интерактивный предпросмотр и «Глазами ученика» */

.cb-prev-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 10px;
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 12%, transparent));
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-hw-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}

.cb-hw-title-row .crs-step-title {
  min-width: 0;
}

.cb-hw-title-badges {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.cb-hw-deadline {
  white-space: nowrap;
}

.cb-prev-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-hw-submit {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--surface-2);
}

.cb-hw-submit-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.cb-hw-attach-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cb-hw-attach-btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.cb-prev-code {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  overflow-x: auto;
  color: var(--ink);
}

/* Мастер создания курса */
.cb-creator {
  display: grid;
  gap: 16px;
  padding: 20px 22px 44px;
  max-width: 1060px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

.cb-creator-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.cb-swatch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.cb-swatch {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  border: 2px solid transparent;
  background: var(--cb-tone, var(--accent));
  cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease;
}

.cb-swatch:hover {
  transform: scale(1.08);
}

.cb-swatch.is-active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--cb-tone, var(--accent));
}

.cb-preset-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.cb-preset-card {
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 11px 12px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}

.cb-preset-card:hover {
  border-color: var(--line-strong, var(--line));
}

.cb-preset-card.is-active {
  border-color: var(--accent);
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 10%, transparent));
}

.cb-preset-card b {
  font-size: 13px;
  font-weight: 650;
}

.cb-preset-card span {
  font-size: 11.5px;
  line-height: 1.35;
  color: var(--muted);
}

.cb-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink-2);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.cb-pick-chip:hover {
  border-color: var(--line-strong, var(--line));
  color: var(--ink);
}

.cb-pick-chip.is-on {
  border-color: var(--accent);
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
  color: var(--accent);
}

.cb-inline-add {
  display: flex;
  gap: 8px;
  align-items: center;
}

.cb-inline-add .ta-input {
  flex: 1 1 auto;
  min-width: 0;
}

.cb-grp-combo {
  position: relative;
}

.cb-grp-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  min-height: 40px;
  padding: 5px 8px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .14s ease, box-shadow .14s ease;
}

.cb-grp-box:focus-within,
.cb-grp-combo.is-open .cb-grp-box {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
}

.cb-grp-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  padding: 0 6px 0 9px;
  border-radius: 999px;
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.cb-grp-tag-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: currentColor;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: .75;
}

.cb-grp-tag-x:hover {
  opacity: 1;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
}

.cb-grp-inp {
  flex: 1 1 150px;
  min-width: 120px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  padding: 4px 2px;
}

.cb-grp-inp::placeholder {
  color: var(--muted);
}

.cb-grp-caret {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, transform .15s ease;
}

.cb-grp-caret:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.cb-grp-combo.is-open .cb-grp-caret svg {
  transform: rotate(180deg);
}

.cb-grp-menu {
  position: relative;
  margin-top: 6px;
  border-radius: 12px;
  border: 1px solid var(--line-strong, var(--line));
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(15, 23, 42, .10);
  overflow: hidden;
  z-index: 20;
}

.cb-grp-menu[hidden] {
  display: none;
}

.cb-grp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--muted);
}

.cb-grp-head-acts {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cb-grp-head-btn {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 2px 4px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--accent);
  cursor: pointer;
}

.cb-grp-head-btn:hover {
  text-decoration: underline;
}

.cb-grp-list {
  display: grid;
  gap: 2px;
  max-height: 230px;
  overflow-y: auto;
  padding: 6px;
}

.cb-grp-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  text-align: left;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: background-color .1s ease, border-color .1s ease;
}

.cb-grp-opt:hover {
  background: var(--surface-2);
}

.cb-grp-opt.is-on {
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 12%, transparent));
  border-color: color-mix(in srgb, var(--accent) 30%, transparent);
}

.cb-grp-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: none;
  border-radius: 5px;
  border: 1.5px solid var(--line-strong, var(--line));
  background: var(--surface);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
}

.cb-grp-opt.is-on .cb-grp-check {
  background: var(--accent);
  border-color: var(--accent);
}

.cb-grp-opt-info {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex: 1 1 auto;
  min-width: 0;
}

.cb-grp-opt-info b {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.cb-grp-opt-info span {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-grp-add-opt {
  display: block;
  width: calc(100% - 12px);
  margin: 0 6px 6px;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px dashed var(--accent);
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 10%, transparent));
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}

.cb-grp-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 10px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  color: var(--muted);
}

.cb-grp-done-btn {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--ink);
  padding: 3px 10px;
  font: inherit;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}

.cb-grp-done-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.cb-publish-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 10px 13px;
  border-radius: 13px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}

.cb-switch-track {
  width: 42px;
  height: 24px;
  flex: none;
  border-radius: 999px;
  background: var(--line-strong, var(--line));
  padding: 2px;
  display: inline-flex;
  align-items: center;
  transition: background-color .16s ease;
}

.cb-switch-track.is-on {
  background: var(--confirm);
  justify-content: flex-end;
}

.cb-switch-thumb {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .2);
}

.cb-danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--bad) 28%, var(--line));
  background: color-mix(in srgb, var(--bad) 6%, var(--surface));
}

@media (max-width: 959px) {
  .cb-shell,
  .cb-creator {
    padding: 12px 12px calc(92px + env(safe-area-inset-bottom, 0px));
  }
  .cb-toolbar-search {
    max-width: 100%;
    flex-basis: 100%;
  }
  .cb-onboard-steps {
    grid-template-columns: minmax(0, 1fr);
  }
  
  
  .cb-preset-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  
  .cb-hero {
    padding: 15px;
  }
  .cb-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: auto auto auto;
    justify-content: stretch;
    overflow: hidden;
  }
  .cb-tab-btn {
    min-width: 0;
    padding: 0 8px;
    font-size: 12px;
    justify-content: center;
  }
  
  .cb-panel {
    padding: 14px;
  }
}

@media (max-width: 600px) {
  .cb-pair-row,
.cb-classify-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .cb-pair-arrow {
    display: none;
  }
  
}

/* Единая студия модулей, тем и шагов (совместима со student .crs-*) */
.cb-syllabus-card {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.cb-syllabus-card .crs-mod-head {
  border-radius: 12px;
  padding: 10px 14px;
}

.cb-syllabus-card .crs-mod-list {
  margin-left: 12px;
  padding-left: 10px;
  border-left: 2px solid color-mix(in srgb, var(--line-strong) 55%, transparent);
  gap: 6px;
}

.cb-mod-head-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cb-mod-head-row .crs-mod-head {
  flex: 1 1 auto;
  min-width: 0;
}

.cb-mod-acts,
.cb-topic-acts {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-sizing: border-box;
  flex: none;
}

.cb-mod-acts .btn.is-on,
.cb-topic-act-btn.is-on {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.cb-mod-del-btn:hover {
  color: var(--bad, #e11d48) !important;
  background: var(--bad-soft, rgba(225, 29, 72, .10)) !important;
  border-color: transparent !important;
}

.cb-vis-btn:hover:not(.is-hidden),
.cb-vis-head-btn:hover:not(.is-hidden) {
  background: var(--surface-2);
  color: var(--ink);
}

.cb-vis-btn.is-hidden,
.btn.sm.cb-topic-act-btn.cb-vis-btn.is-hidden,
.cb-vis-head-btn.is-hidden {
  background: color-mix(in srgb, var(--warn, #d97706) 14%, transparent);
  color: var(--warn, #b45309);
  border-color: color-mix(in srgb, var(--warn, #d97706) 35%, transparent);
}

.cb-vis-btn.is-hidden:hover,
.btn.sm.cb-topic-act-btn.cb-vis-btn.is-hidden:hover,
.cb-vis-head-btn.is-hidden:hover {
  background: color-mix(in srgb, var(--warn, #d97706) 22%, transparent);
  color: var(--warn, #b45309);
  border-color: color-mix(in srgb, var(--warn, #d97706) 45%, transparent);
}

.cb-hidden-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  background: color-mix(in srgb, var(--warn, #d97706) 13%, var(--surface));
  color: var(--warn, #b45309);
  border: 1px solid color-mix(in srgb, var(--warn, #d97706) 30%, transparent);
  white-space: nowrap;
  flex: none;
}

.cb-hidden-pill svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.crs-mod.is-hidden-student > .cb-mod-head-row .crs-mod-head {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--warn, #d97706) 36%, var(--line));
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
}

.crs-mod.is-hidden-student > .cb-mod-head-row .crs-mod-head .crs-mod-left {
  opacity: .78;
}

.crs-mod.is-hidden-student .crs-mod-list .crs-trow:not(.cb-ghost-topic),
.cb-topic-row-wrap.is-hidden-student .crs-trow {
  border-style: dashed;
  background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
}

.cb-topic-row-wrap.is-hidden-student .crs-trow {
  border-color: color-mix(in srgb, var(--warn, #d97706) 34%, var(--line));
}

.crs-mod.is-hidden-student .crs-mod-list .crs-trow:not(.cb-ghost-topic) .crs-trow-title,
.cb-topic-row-wrap.is-hidden-student .crs-trow-title {
  opacity: .66;
}

.crs-trow.is-inline-editing,
.crs-trow.is-inline-editing:hover,
.crs-mod-head.is-inline-editing,
.crs-mod-head.is-inline-editing:hover {
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  border: 1.5px solid var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 15%, transparent);
}

.cb-shell .crs-trow,
.cb-topic-row-line .crs-trow,
.cb-syllabus-card .crs-trow,
.cb-syllabus-card .crs-trow.is-inline-editing,
.cb-syllabus-card .crs-trow.cb-ghost-topic {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 44px;
  border-radius: 11px;
  padding: 7px 14px;
  box-sizing: border-box;
}

.cb-shell .crs-course-hero .crs-trow {
  min-height: 44px;
}

.cb-topic-studio .crs-drawer-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.cb-ghost-spacer {
  visibility: hidden;
  pointer-events: none;
}

.cb-ghost-acts-spacer,
.cb-topic-acts.cb-ghost-acts-spacer {
  width: 132px;
  flex: none;
  pointer-events: none;
  border: 0;
  background: transparent;
  padding: 0;
}

.crs-trow.is-inline-editing {
  cursor: text;
}

.crs-mod-head.is-inline-editing {
  cursor: text;
}

.cb-inline-title-inp {
  width: 100%;
  min-width: 0;
  height: 28px;
  padding: 2px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  color: var(--ink);
  font-family: inherit;
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.3;
  outline: none;
  box-sizing: border-box;
  transition: background-color .14s ease, border-color .14s ease;
}

.cb-inline-title-inp:focus {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.crs-trow-title.is-placeholder,
.crs-drawer-title.is-placeholder {
  color: var(--muted);
  font-weight: 500;
}

.cb-inline-mod-left {
  flex: 1 1 auto;
  gap: 4px;
}

.cb-inline-mod-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cb-inline-mod-prefix {
  color: var(--accent);
  white-space: nowrap;
  flex: none;
}

.cb-inline-mod-title-inp {
  flex: 1 1 auto;
  min-width: 0;
  height: 26px;
  padding: 1px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--surface) 76%, transparent);
  color: var(--ink);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  outline: none;
  box-sizing: border-box;
  transition: background-color .14s ease, border-color .14s ease;
}

.cb-inline-mod-title-inp:focus {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.cb-inline-mod-sub-inp {
  width: 100%;
  min-width: 0;
  height: 24px;
  padding: 1px 8px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  color: var(--ink-2);
  font-family: inherit;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  transition: background-color .14s ease, border-color .14s ease;
}

.cb-inline-mod-sub-inp:focus {
  background: var(--surface);
  border-color: color-mix(in srgb, var(--accent) 45%, transparent);
}

.btn.primary.sm.cb-inline-save-btn {
  color: #ffffff;
}

.cb-inline-save-btn svg {
  color: #ffffff;
  stroke: #ffffff;
}

.cb-topic-row-wrap.is-editing .cb-topic-drag-grip {
  opacity: .28;
  pointer-events: none;
  cursor: default;
}

.cb-topic-row-wrap {
  position: relative;
  display: grid;
  gap: 6px;
  min-width: 0;
  transition: transform .16s ease, opacity .16s ease;
}

.cb-topic-row-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cb-topic-row-line .crs-trow {
  flex: 1 1 auto;
  min-width: 0;
}

.cb-topic-drag-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 36px;
  border-radius: 8px;
  color: var(--muted);
  cursor: grab;
  flex: none;
  touch-action: none;
  opacity: .4;
  transition: background-color .14s ease, color .14s ease, opacity .14s ease;
}

.cb-topic-row-wrap:hover .cb-topic-drag-grip {
  opacity: .95;
}

.cb-topic-drag-grip:hover {
  background: var(--surface-2);
  color: var(--ink);
  opacity: 1;
}

.cb-topic-drag-grip:active {
  cursor: grabbing;
}

.cb-topic-act-btn,
.btn.sm.cb-topic-act-btn {
  min-width: 30px;
  width: 30px;
  min-height: 30px;
  height: 30px;
  padding: 0;
  border-radius: 7px;
  border-color: transparent;
  background: transparent;
  color: var(--muted);
  justify-content: center;
}

.cb-topic-act-btn:hover,
.btn.sm.cb-topic-act-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
  border-color: transparent;
}

.cb-topic-act-btn svg {
  width: 14px;
  height: 14px;
  flex: none;
  display: block;
}

.cb-pptx-btn:hover {
  color: var(--accent) !important;
  background: var(--accent-soft) !important;
  border-color: transparent !important;
}

.cb-pptx-head-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.cb-pptx-head-btn svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.cb-pptx-btn.is-busy,
.cb-pptx-head-btn.is-busy {
  opacity: .55;
  cursor: progress;
}

.cb-pdf-head-btn:hover:not(:disabled) {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 32%, var(--line));
}

.cb-topic-row-wrap.is-topic-shifting {
  transition: transform .18s cubic-bezier(.22, 1, .36, 1), opacity .14s ease;
}

.cb-topic-row-wrap.is-topic-dragging {
  opacity: .38;
}

.cb-topic-row-wrap.is-topic-placeholder .crs-trow {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 62%, var(--line));
  background: color-mix(in srgb, var(--accent) 9%, transparent);
  box-shadow: none;
}

.cb-topic-row-wrap.is-topic-placeholder .crs-trow > *,
.cb-topic-row-wrap.is-topic-placeholder .cb-topic-drag-grip,
.cb-topic-row-wrap.is-topic-placeholder .cb-topic-acts {
  opacity: 0;
  pointer-events: none;
}

.cb-topic-row-wrap.is-topic-dragging .crs-trow {
  border-style: dashed;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.cb-topic-row-wrap.is-drop-before::before {
  content: "";
  position: absolute;
  left: 28px;
  right: 0;
  top: -4px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent);
  pointer-events: none;
  z-index: 4;
}

.cb-topic-row-wrap.is-drop-after::after {
  content: "";
  position: absolute;
  left: 28px;
  right: 0;
  bottom: -4px;
  height: 3px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 45%, transparent);
  pointer-events: none;
  z-index: 4;
}

.crs-mod.is-drop-mod-end .crs-mod-head {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 22%, transparent);
}

.cb-topic-drag-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  padding: 0;
  pointer-events: none;
  will-change: transform;
  background: transparent;
}

.cb-topic-drag-ghost.is-settling {
  transition: transform .16s cubic-bezier(.22, 1, .36, 1);
}

.cb-topic-drag-ghost .crs-trow {
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 14px 32px rgba(15, 23, 42, .18), 0 0 0 1.5px var(--accent);
}

.cb-topic-drag-ghost .cb-topic-acts {
  opacity: .35;
}

:root[data-theme="dark"] .cb-topic-drag-ghost .crs-trow {
  box-shadow: 0 16px 36px rgba(0, 0, 0, .55), 0 0 0 1.5px var(--accent);
}

/* Синие «будущие» карточки добавления модуля и темы прямо на месте в программе */
.crs-mod-head.cb-ghost-mod {
  border: 1.5px dashed color-mix(in srgb, var(--accent) 46%, var(--line));
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .14s ease;
}

.crs-mod-head.cb-ghost-mod:hover,
.crs-mod-head.cb-ghost-mod:focus-visible {
  border-style: solid;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 16%, transparent);
  transform: translateY(-1px);
  outline: none;
}

.crs-trow.cb-ghost-topic {
  padding: 7.5px 12px;
  border: 1.5px dashed color-mix(in srgb, var(--accent) 42%, var(--line));
  background: color-mix(in srgb, var(--accent) 5.5%, var(--surface));
  cursor: pointer;
  transition: border-color .16s ease, background-color .16s ease, box-shadow .16s ease, transform .14s ease;
}

.crs-trow.cb-ghost-topic:hover,
.crs-trow.cb-ghost-topic:focus-visible {
  border-style: solid;
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  box-shadow: 0 3px 12px color-mix(in srgb, var(--accent) 14%, transparent);
  transform: translateY(-1px);
  outline: none;
}

.cb-ghost-title {
  color: var(--accent) !important;
}

.cb-ghost-sub {
  color: color-mix(in srgb, var(--accent) 76%, var(--muted));
}

.cb-ghost-plus-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  flex: none;
  box-shadow: 0 2px 6px color-mix(in srgb, var(--accent) 28%, transparent);
  transition: transform .16s ease, box-shadow .16s ease, background-color .16s ease;
}

.cb-ghost-plus-btn svg,
.crs-mod-right .cb-ghost-plus-btn svg,
.crs-trow-right .cb-ghost-plus-btn svg {
  width: 15px;
  height: 15px;
  color: #ffffff;
  stroke: #ffffff;
  stroke-width: 2.6;
  display: block;
}

.cb-ghost-plus-btn.is-mod {
  width: 32px;
  height: 32px;
}

.crs-mod-head.cb-ghost-mod:hover .cb-ghost-plus-btn,
.crs-trow.cb-ghost-topic:hover .cb-ghost-plus-btn {
  transform: scale(1.08);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 38%, transparent);
}

@keyframes cbGhostMaterialize {
  0% {
    background: color-mix(in srgb, var(--accent) 18%, var(--surface));
    border-color: var(--accent);
    transform: scale(0.985);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
  }
  100% {
    transform: scale(1);
    box-shadow: none;
  }
}

.crs-mod.is-just-created .crs-mod-head,
.crs-trow.is-just-created {
  animation: cbGhostMaterialize .65s cubic-bezier(.22, 1, .36, 1);
}

:root[data-theme="dark"] .crs-mod-head.cb-ghost-mod {
  background: color-mix(in srgb, var(--accent) 13%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 52%, var(--line));
}

:root[data-theme="dark"] .crs-trow.cb-ghost-topic {
  background: color-mix(in srgb, var(--accent) 9%, var(--surface));
  border-color: color-mix(in srgb, var(--accent) 46%, var(--line));
}

:root[data-theme="dark"] .cb-ghost-code {
  background: color-mix(in srgb, var(--accent) 20%, var(--surface)) !important;
}

.cb-create-passport {
  display: grid;
  gap: 12px;
}

.cb-topic-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  padding: 20px 22px 84px;
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
}

.cb-topic-title-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.cb-topic-code-inp {
  width: 78px;
  flex: none;
  text-align: center;
  font-weight: 700;
}

.cb-topic-title-inp {
  flex: 1 1 240px;
  min-width: 0;
  font-weight: 600;
}

.cb-step-pill-add {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
  background: transparent;
  padding: 0 12px;
  gap: 5px;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease;
}

.cb-step-pill-add .cb-add-plus {
  display: inline-block;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  transition: transform .18s cubic-bezier(.22, 1, .36, 1);
}

.cb-step-pill-add.is-open {
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 12%, transparent));
  border-style: solid;
}

.cb-step-pill-add.is-open .cb-add-plus {
  transform: rotate(45deg);
}

.cb-step-pill-draft-slot {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-sm, 10px);
  border: 1.5px dashed var(--accent);
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 12%, transparent));
  color: var(--accent);
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  animation: cbSlotPopIn .18s cubic-bezier(.22, 1.24, .36, 1), cbSlotPulse 1.6s ease-in-out .18s infinite;
}

.cb-step-pill-draft-slot svg {
  width: 13px;
  height: 13px;
  flex: none;
}

@keyframes cbSlotPopIn {
  0% { opacity: 0; transform: scale(.82); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes cbSlotPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 26%, transparent);
    border-color: var(--accent);
  }
  50% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 0%, transparent);
    border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  }
}

.cb-step-pill-edit {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 34px;
  padding: 0 5px 0 4px;
  border-radius: var(--r-sm, 10px);
  border: 1px solid var(--line-strong, var(--line));
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
  -webkit-user-select: none;
  transition: border-color .14s ease, background-color .14s ease, color .14s ease, box-shadow .14s ease, transform .14s ease, opacity .14s ease;
}

body.cb-is-reordering,
body.cb-is-reordering * {
  cursor: grabbing !important;
  user-select: none !important;
  -webkit-user-select: none !important;
}

.cb-step-pill-edit:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.cb-step-pill-edit:has(.cb-step-drag-grip:hover) {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 3px 10px rgba(15, 23, 42, .08);
}

.cb-step-pill-edit.is-drag-shifting {
  transition: transform .18s cubic-bezier(.22, 1, .36, 1), border-color .14s ease, background-color .14s ease;
}

.cb-step-pill-edit.is-cur {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink, #fff);
}

.cb-step-pill-edit.is-homework.is-cur {
  background: var(--notif, #F97316);
  border-color: var(--notif, #F97316);
  color: #fff;
}

.cb-step-pill-edit.is-code.is-cur {
  background: var(--pro, #7C3AED);
  border-color: var(--pro, #7C3AED);
  color: #fff;
}

.cb-step-pill-edit.is-drag-placeholder,
.cb-step-pill-edit.is-cur.is-drag-placeholder,
.cb-step-pill-edit.is-homework.is-cur.is-drag-placeholder,
.cb-step-pill-edit.is-code.is-cur.is-drag-placeholder {
  border-style: dashed;
  border-color: color-mix(in srgb, var(--accent) 65%, var(--line));
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 12%, transparent));
  box-shadow: none;
}

.cb-step-pill-edit.is-drag-placeholder > *,
.cb-step-pill-edit.is-cur.is-drag-placeholder .cb-step-drag-grip,
.cb-step-pill-edit.is-cur.is-drag-placeholder .cb-step-mini-btn {
  opacity: 0;
  pointer-events: none;
}

.cb-step-drag-ghost {
  position: fixed;
  z-index: 1000;
  margin: 0;
  pointer-events: none;
  will-change: transform;
  box-shadow: 0 12px 28px rgba(15, 23, 42, .22), 0 3px 8px rgba(15, 23, 42, .12);
  border-color: var(--accent);
  transition: box-shadow .16s ease;
}

.cb-step-drag-ghost.is-settling {
  transition: transform .16s cubic-bezier(.22, 1, .36, 1), box-shadow .16s ease;
  box-shadow: 0 2px 6px rgba(15, 23, 42, .10);
}

:root[data-theme="dark"] .cb-step-drag-ghost {
  box-shadow: 0 14px 32px rgba(0, 0, 0, .55), 0 0 0 1px color-mix(in srgb, var(--accent) 55%, transparent);
}

.cb-step-pill-edit.is-dragging {
  opacity: .5;
}

.cb-step-pill-edit.is-drop-left {
  box-shadow: -3px 0 0 0 var(--accent);
}

.cb-step-pill-edit.is-drop-right {
  box-shadow: 3px 0 0 0 var(--accent);
}

.cb-step-drag-grip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 24px;
  border-radius: 6px;
  color: var(--muted);
  cursor: grab;
  opacity: .8;
  flex: none;
  touch-action: none;
  transition: background-color .14s ease, color .14s ease, opacity .14s ease;
}

.cb-step-drag-grip:hover {
  background: var(--surface-2);
  color: var(--ink);
  opacity: 1;
}

.cb-step-drag-grip:active {
  cursor: grabbing;
}

.cb-step-pill-edit.is-cur .cb-step-drag-grip {
  color: currentColor;
  opacity: .88;
}

.cb-step-pill-edit.is-cur .cb-step-drag-grip:hover {
  background: rgba(255, 255, 255, .22);
  color: #fff;
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .cb-step-pill-edit.is-drag-shifting,
  .cb-step-drag-ghost.is-settling,
  .cb-topic-row-wrap.is-topic-shifting,
  .cb-topic-drag-ghost.is-settling {
    transition-duration: .01ms;
  }
}

.cb-step-pill-main {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 5px 0 2px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: inherit;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.cb-step-pill-main svg {
  width: 14px;
  height: 14px;
  flex: none;
}

.cb-step-mini-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  flex: none;
  transition: background-color .12s ease, color .12s ease;
}

.cb-step-mini-btn:hover {
  background: var(--surface-2);
  color: var(--ink);
}

.cb-step-mini-btn.is-on {
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
  color: var(--accent);
}

.cb-step-mini-btn.is-del:hover {
  background: var(--bad-soft, color-mix(in srgb, var(--bad) 14%, transparent));
  color: var(--bad);
}

.cb-step-pill-edit.is-cur .cb-step-mini-btn {
  color: rgba(255, 255, 255, .86);
}

.cb-step-pill-edit.is-cur .cb-step-mini-btn:hover {
  background: rgba(255, 255, 255, .18);
  color: #fff;
}

.cb-step-pill-edit.is-cur .cb-step-mini-btn.is-on {
  background: rgba(255, 255, 255, .28);
  color: #fff;
}

.cb-step-add-bar,
.cb-step-kind-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  animation: cbBarReveal .2s cubic-bezier(.22, 1, .36, 1);
}

.cb-step-add-bar .cb-pick-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  animation: cbChipPop .18s cubic-bezier(.22, 1.24, .36, 1) both;
}

.cb-step-add-bar .cb-pick-chip svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.cb-step-add-bar .cb-pick-chip:nth-of-type(1) { animation-delay: 0ms; }
.cb-step-add-bar .cb-pick-chip:nth-of-type(2) { animation-delay: 25ms; }
.cb-step-add-bar .cb-pick-chip:nth-of-type(3) { animation-delay: 50ms; }
.cb-step-add-bar .cb-pick-chip:nth-of-type(4) { animation-delay: 75ms; }
.cb-step-add-bar .cb-pick-chip:nth-of-type(5) { animation-delay: 100ms; }

@keyframes cbBarReveal {
  0% { opacity: 0; transform: translateY(-6px) scale(.985); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cbChipPop {
  0% { opacity: 0; transform: translateY(4px) scale(.92); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

.cb-step-pill-edit.is-just-added {
  animation: cbStepPopIn .42s cubic-bezier(.22, 1.24, .36, 1);
}

@keyframes cbStepPopIn {
  0% {
    opacity: 0;
    transform: scale(.72) translateY(5px);
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent);
  }
  55% {
    opacity: 1;
    transform: scale(1.07) translateY(-1px);
    box-shadow: 0 0 0 7px color-mix(in srgb, var(--accent) 20%, transparent);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
    box-shadow: 0 0 0 11px transparent;
  }
}

.cb-step-editor-card {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  min-width: 0;
}

.cb-step-editor-card.is-just-added {
  animation: cbCardSlideIn .28s cubic-bezier(.22, 1, .36, 1);
}

.cb-step-form-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding-top: 2px;
}

.cb-save-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
}

.cb-save-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--confirm, #16A34A);
  flex: none;
  transition: background-color .15s ease;
}

.cb-save-status.is-saving .cb-save-dot {
  background: var(--warn, #F97316);
  animation: cbSavePulse 1s ease-in-out infinite;
}

.cb-save-status.is-err {
  color: var(--bad, #DC2626);
}

.cb-save-status.is-err .cb-save-dot {
  background: var(--bad, #DC2626);
}

@keyframes cbSavePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.82); }
}

@keyframes cbCardSlideIn {
  0% {
    opacity: .45;
    transform: translateY(10px) scale(.992);
    border-color: var(--accent);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .cb-step-pill-draft-slot,
  .cb-step-add-bar,
  .cb-step-kind-bar,
  .cb-step-add-bar .cb-pick-chip,
  .cb-step-pill-edit.is-just-added,
  .cb-step-editor-card.is-just-added {
    animation: none !important;
  }
}

.cb-md-toolbar-wrap {
  display: grid;
  gap: 6px;
}

.cb-md-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 5px 7px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.cb-md-group {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
}

.cb-md-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  font: inherit;
  font-size: 13.5px;
  line-height: 1;
  cursor: pointer;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}

.cb-md-btn:hover {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}

.cb-md-btn.is-on {
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
  color: var(--accent);
}

.cb-md-btn svg {
  width: 14px;
  height: 14px;
}

.cb-md-h-lbl {
  font-weight: 800;
  font-size: 13px;
}

.cb-md-h-btn {
  min-width: 28px;
  width: auto;
  padding: 0 6px;
}

.cb-md-letter-bar {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-weight: 800;
  font-size: 12.5px;
  line-height: 1;
  padding-bottom: 2px;
  border-bottom: 2.5px solid #2563eb;
}

.cb-md-bg-btn .cb-md-hl-bar {
  display: inline-flex;
  align-items: center;
  padding-bottom: 2px;
  border-bottom: 2.5px solid #eab308;
  line-height: 1;
}

.cb-md-src-btn {
  width: auto;
  padding: 0 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .02em;
}

.cb-md-btn[data-cb-tip],
.cb-md-block-btn[data-cb-tip],
.cb-md-swatch[data-cb-tip],
.cb-tbl-btn[data-cb-tip],
.cb-step-mini-btn[data-cb-tip],
.cb-code-ide-btn[data-cb-tip],
.cb-tc-vis-btn[data-cb-tip],
.cb-tc-icon-btn[data-cb-tip] {
  position: relative;
}

.cb-md-btn[data-cb-tip]::after,
.cb-md-block-btn[data-cb-tip]::after,
.cb-md-swatch[data-cb-tip]::after,
.cb-tbl-btn[data-cb-tip]::after,
.cb-step-mini-btn[data-cb-tip]::after,
.cb-code-ide-btn[data-cb-tip]::after,
.cb-tc-vis-btn[data-cb-tip]::after,
.cb-tc-icon-btn[data-cb-tip]::after {
  content: attr(data-cb-tip);
  position: absolute;
  bottom: calc(100% + 7px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  padding: 4px 8px;
  border-radius: 7px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  background: #18181b;
  color: #f8fafc;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .2);
  transition: opacity .1s ease, transform .1s ease;
}

.cb-md-btn[data-cb-tip]::before,
.cb-md-block-btn[data-cb-tip]::before,
.cb-md-swatch[data-cb-tip]::before,
.cb-tbl-btn[data-cb-tip]::before,
.cb-step-mini-btn[data-cb-tip]::before,
.cb-code-ide-btn[data-cb-tip]::before,
.cb-tc-vis-btn[data-cb-tip]::before,
.cb-tc-icon-btn[data-cb-tip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%) translateY(3px);
  opacity: 0;
  pointer-events: none;
  z-index: 60;
  border: 5px solid transparent;
  border-top-color: #18181b;
  transition: opacity .1s ease, transform .1s ease;
}

.cb-md-btn[data-cb-tip]:hover::after,
.cb-md-btn[data-cb-tip]:hover::before,
.cb-md-btn[data-cb-tip]:focus-visible::after,
.cb-md-btn[data-cb-tip]:focus-visible::before,
.cb-md-block-btn[data-cb-tip]:hover::after,
.cb-md-block-btn[data-cb-tip]:hover::before,
.cb-md-block-btn[data-cb-tip]:focus-visible::after,
.cb-md-block-btn[data-cb-tip]:focus-visible::before,
.cb-md-swatch[data-cb-tip]:hover::after,
.cb-md-swatch[data-cb-tip]:hover::before,
.cb-md-swatch[data-cb-tip]:focus-visible::after,
.cb-md-swatch[data-cb-tip]:focus-visible::before,
.cb-tbl-btn[data-cb-tip]:hover::after,
.cb-tbl-btn[data-cb-tip]:hover::before,
.cb-step-mini-btn[data-cb-tip]:hover::after,
.cb-step-mini-btn[data-cb-tip]:hover::before,
.cb-code-ide-btn[data-cb-tip]:hover::after,
.cb-code-ide-btn[data-cb-tip]:hover::before,
.cb-code-ide-btn[data-cb-tip]:focus-visible::after,
.cb-code-ide-btn[data-cb-tip]:focus-visible::before,
.cb-tc-vis-btn[data-cb-tip]:hover::after,
.cb-tc-vis-btn[data-cb-tip]:hover::before,
.cb-tc-icon-btn[data-cb-tip]:hover::after,
.cb-tc-icon-btn[data-cb-tip]:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.cb-md-btn.is-b[data-cb-tip]::after,
.cb-md-btn.is-i[data-cb-tip]::after {
  left: 0;
  transform: translateY(3px);
}

.cb-md-btn.is-b[data-cb-tip]:hover::after,
.cb-md-btn.is-b[data-cb-tip]:focus-visible::after,
.cb-md-btn.is-i[data-cb-tip]:hover::after,
.cb-md-btn.is-i[data-cb-tip]:focus-visible::after {
  transform: translateY(0);
}

.cb-md-block-btn:last-child[data-cb-tip]::after,
.cb-step-mini-btn[data-cb-tip]::after,
.cb-code-ide-acts > [data-cb-tip]:last-child::after,
.cb-tc-acts > [data-cb-tip]:last-child::after {
  left: auto;
  right: 0;
  transform: translateY(3px);
}

.cb-md-block-btn:last-child[data-cb-tip]:hover::after,
.cb-md-block-btn:last-child[data-cb-tip]:focus-visible::after,
.cb-step-mini-btn[data-cb-tip]:hover::after,
.cb-code-ide-acts > [data-cb-tip]:last-child:hover::after,
.cb-tc-acts > [data-cb-tip]:last-child:hover::after {
  transform: translateY(0);
}

:root[data-theme="dark"] .cb-md-btn[data-cb-tip]::after,
:root[data-theme="dark"] .cb-md-block-btn[data-cb-tip]::after,
:root[data-theme="dark"] .cb-md-swatch[data-cb-tip]::after,
:root[data-theme="dark"] .cb-tbl-btn[data-cb-tip]::after,
:root[data-theme="dark"] .cb-step-mini-btn[data-cb-tip]::after,
:root[data-theme="dark"] .cb-code-ide-btn[data-cb-tip]::after,
:root[data-theme="dark"] .cb-tc-vis-btn[data-cb-tip]::after,
:root[data-theme="dark"] .cb-tc-icon-btn[data-cb-tip]::after {
  background: #f1f5f9;
  color: #0f172a;
}

:root[data-theme="dark"] .cb-md-btn[data-cb-tip]::before,
:root[data-theme="dark"] .cb-md-block-btn[data-cb-tip]::before,
:root[data-theme="dark"] .cb-md-swatch[data-cb-tip]::before,
:root[data-theme="dark"] .cb-tbl-btn[data-cb-tip]::before,
:root[data-theme="dark"] .cb-step-mini-btn[data-cb-tip]::before,
:root[data-theme="dark"] .cb-code-ide-btn[data-cb-tip]::before,
:root[data-theme="dark"] .cb-tc-vis-btn[data-cb-tip]::before,
:root[data-theme="dark"] .cb-tc-icon-btn[data-cb-tip]::before {
  border-top-color: #f1f5f9;
}

.cb-md-sep {
  width: 1px;
  height: 18px;
  background: var(--line-strong, var(--line));
  margin: 0 3px;
  flex: none;
}

.cb-md-blocks {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
}

.cb-md-block-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.cb-md-block-btn svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.cb-md-block-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.cb-md-block-btn.is-on {
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
  border-color: var(--accent);
  color: var(--accent);
}

.cb-md-palette-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: fit-content;
  max-width: 100%;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.cb-md-palette-bar[hidden] {
  display: none;
}

.cb-md-swatch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  cursor: pointer;
  transition: transform .12s ease, border-color .12s ease;
}

.cb-md-swatch:hover {
  border-color: var(--accent);
  transform: scale(1.08);
}

.cb-md-heading-bar {
  gap: 5px;
}

.cb-md-h-opt,
.cb-md-fold-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 26px;
  padding: 0 9px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}

.cb-md-h-opt.is-lvl-1 { font-size: 14px; }
.cb-md-h-opt.is-lvl-2 { font-size: 13px; }
.cb-md-h-opt.is-lvl-3 { font-size: 12.5px; }
.cb-md-h-opt.is-lvl-4 { font-size: 12px; }
.cb-md-h-opt.is-lvl-5 { font-size: 11.5px; }
.cb-md-h-opt.is-lvl-6 { font-size: 11px; }

.cb-md-h-opt:hover,
.cb-md-fold-act:hover {
  border-color: var(--accent);
}

.cb-md-h-opt.is-on {
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 16%, transparent));
  border-color: var(--accent);
  color: var(--accent);
}

.cb-md-dot {
  width: 16px;
  height: 16px;
  border-radius: 999px;
  flex: none;
}

.cb-md-swatch.is-c-red .cb-md-dot { background: #dc2626; }
.cb-md-swatch.is-c-orange .cb-md-dot { background: #ea580c; }
.cb-md-swatch.is-c-green .cb-md-dot { background: #16a34a; }
.cb-md-swatch.is-c-blue .cb-md-dot { background: #2563eb; }
.cb-md-swatch.is-c-violet .cb-md-dot { background: #7c3aed; }
.cb-md-swatch.is-c-muted .cb-md-dot { background: #64748b; }

.cb-md-swatch.is-bg-yellow .cb-md-dot { background: #facc15; }
.cb-md-swatch.is-bg-green .cb-md-dot { background: #4ade80; }
.cb-md-swatch.is-bg-blue .cb-md-dot { background: #60a5fa; }
.cb-md-swatch.is-bg-pink .cb-md-dot { background: #f472b6; }
.cb-md-swatch.is-bg-violet .cb-md-dot { background: #a78bfa; }

.cb-notch-field {
  margin: 0;
  padding: 0 11px 5px;
  min-width: 0;
  min-inline-size: 0;
  max-width: 100%;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: var(--r-sm, 11px);
  background: var(--surface);
  transition: border-color .14s ease, box-shadow .14s ease;
}

.cb-notch-field:hover {
  border-color: color-mix(in srgb, var(--ink) 28%, var(--line-strong, var(--line)));
}

.cb-notch-field:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, color-mix(in srgb, var(--accent) 16%, transparent));
}

.cb-notch-field > legend {
  margin: 0 0 0 2px;
  padding: 0 4px;
  max-width: calc(100% - 6px);
  font-size: 11.5px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-notch-field:focus-within > legend {
  color: var(--accent);
}

.cb-notch-field > legend > label {
  cursor: pointer;
}

.cb-notch-input {
  width: 100%;
  min-width: 0;
  height: 24px;
  min-height: 24px;
  padding: 1px 0 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.25;
  box-sizing: border-box;
}

.cb-notch-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cb-notch-date {
  flex: 1 1 auto;
  cursor: pointer;
  color-scheme: light;
}

.cb-notch-date::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: .72;
  transition: opacity .14s ease;
}

.cb-notch-date::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

:root[data-theme="dark"] .cb-notch-date {
  color-scheme: dark;
}

.cb-date-clear-btn {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}

.cb-date-clear-btn:hover {
  background: var(--bg-soft, rgba(15, 23, 42, .06));
  color: var(--ink);
}

.cb-date-clear-btn.is-hidden {
  display: none;
}

.cb-notch-textarea {
  width: 100%;
  min-width: 0;
  min-height: 168px;
  padding: 4px 0 2px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 13.5px;
  line-height: 1.55;
  resize: vertical;
  box-sizing: border-box;
}

.cb-notch-textarea.is-compact {
  min-height: 64px;
}

.cb-md-live {
  position: relative;
  width: 100%;
  min-width: 0;
  min-height: 82px;
  padding: 3px 0 2px 20px;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.55;
  box-sizing: border-box;
  white-space: pre-wrap;
  word-break: break-word;
}

.cb-md-line {
  position: relative;
  min-height: 1.55em;
  line-height: 1.55;
  margin: 0;
}

.cb-md-tok {
  display: none;
}

.cb-md-line.is-active-line .cb-md-tok,
.cb-md-live.is-inline.is-active-line .cb-md-tok {
  display: inline;
  color: var(--muted);
  font-weight: 500;
  opacity: .82;
}

.cb-md-line.is-h1 {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.28;
  padding-top: 5px;
}

.cb-md-line.is-h2 {
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  padding-top: 4px;
}

.cb-md-line.is-h3 {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.32;
  padding-top: 3px;
}

.cb-md-line.is-h4 {
  font-size: 15.5px;
  font-weight: 700;
  line-height: 1.35;
  padding-top: 2px;
}

.cb-md-line.is-h5 {
  font-size: 14.5px;
  font-weight: 700;
  line-height: 1.38;
  padding-top: 2px;
}

.cb-md-line.is-h6 {
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--ink-2);
  padding-top: 2px;
}

.cb-md-fold-btn {
  position: absolute;
  left: -20px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  opacity: .68;
  transition: opacity .12s ease, background-color .12s ease, color .12s ease, transform .14s ease;
  user-select: none;
}

.cb-md-fold-btn:hover {
  opacity: 1;
  background: var(--surface-2);
  color: var(--ink);
}

.cb-md-line.is-folded > .cb-md-fold-btn svg {
  transform: rotate(-90deg);
}

.cb-md-line.is-folded > .cb-md-fold-btn {
  opacity: 1;
  color: var(--accent);
}

.cb-md-line.is-folded::after {
  content: "•••";
  display: inline-flex;
  align-items: center;
  margin-left: 7px;
  padding: 0 5px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .06em;
  line-height: 1.5;
  vertical-align: middle;
}

.cb-md-live > .is-folded-hidden {
  display: none !important;
}

.cb-md-line.is-quote {
  padding: 4px 10px;
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
  color: var(--ink-2);
}

.cb-md-line.is-ul {
  padding-left: 18px;
}

.cb-md-line.is-ul:not(.is-active-line)::before {
  content: "";
  position: absolute;
  left: 5px;
  top: .66em;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  pointer-events: none;
}

.cb-md-line.is-ul.is-active-line {
  padding-left: 0;
}

.cb-md-line.is-ol .cb-md-ol-num {
  color: var(--muted);
  font-weight: 600;
}

.cb-live-code-wrap {
  margin: 8px 0;
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 10px;
  background: var(--surface-2);
  overflow: hidden;
  user-select: none;
}

.cb-live-code-wrap:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
}

.cb-code-lang-sel {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  border-radius: 6px;
  padding: 2px 8px;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 11.5px;
  font-weight: 700;
  line-height: 1.4;
  cursor: pointer;
}

.cb-code-lang-sel:focus {
  outline: none;
  border-color: var(--accent);
}

.cb-code-head-acts {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.cb-live-code-stage {
  position: relative;
  display: grid;
  min-height: 44px;
  background: var(--surface-2);
}

.cb-live-code-hl,
.cb-live-code-ta {
  grid-area: 1 / 1;
  margin: 0;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.58;
  letter-spacing: 0;
  tab-size: 2;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  box-sizing: border-box;
  width: 100%;
  min-width: 0;
}

.cb-live-code-hl {
  pointer-events: none;
  color: var(--ink);
  overflow: hidden;
}

.cb-live-code-hl code {
  display: block;
  font-family: inherit;
  font-size: inherit;
  font-weight: inherit;
  line-height: inherit;
  letter-spacing: inherit;
  white-space: inherit;
  word-break: inherit;
  overflow-wrap: inherit;
  background: transparent;
  padding: 0;
  border: 0;
}

.cb-live-code-ta {
  resize: none;
  overflow: hidden;
  outline: none;
  color: transparent;
  -webkit-text-fill-color: transparent;
  caret-color: var(--ink);
  user-select: text;
}

.cb-live-code-ta::placeholder {
  color: var(--muted);
  -webkit-text-fill-color: var(--muted);
  opacity: .75;
}

.cb-live-code-ta::selection {
  background: color-mix(in srgb, var(--accent) 26%, transparent);
}

.cb-md-live .cb-md-seg.is-code {
  font-family: var(--font-mono);
  font-size: .9em;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid color-mix(in srgb, var(--line) 85%, transparent);
  color: var(--ink);
}

.cb-md-live .cb-md-seg.is-code > code {
  background: transparent;
  border: 0;
  padding: 0;
  border-radius: 0;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

:root[data-theme="dark"] .cb-md-live .cb-md-seg.is-code {
  background: color-mix(in srgb, var(--surface-2) 85%, #000);
  border-color: var(--line-strong, var(--line));
}

:root[data-theme="dark"] .cb-md-line.is-active-line .cb-md-tok,
:root[data-theme="dark"] .cb-md-live.is-inline.is-active-line .cb-md-tok {
  color: var(--muted);
}

.cb-md-live.is-compact {
  min-height: 44px;
}

.cb-md-live[data-empty="1"]::before {
  content: attr(data-placeholder);
  position: absolute;
  left: 20px;
  top: 3px;
  color: var(--muted);
  pointer-events: none;
}

.cb-md-live > :first-child {
  margin-top: 0;
}

.cb-md-live > :last-child {
  margin-bottom: 0;
}

.cb-md-live p.crs-p {
  color: var(--ink);
  max-width: none;
  line-height: 1.55;
}

.cb-md-live p + p,
.cb-md-live p + .cb-live-tbl-wrap,
.cb-md-live .cb-live-tbl-wrap + p,
.cb-md-live ul + p,
.cb-md-live p + ul {
  margin-top: 8px;
}

.cb-md-live.is-inline {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 10px;
  border: 1px solid var(--line-strong, var(--line));
  background: var(--surface);
  font-size: 14px;
  line-height: 1.45;
}

.cb-md-live.is-inline[data-empty="1"]::before {
  left: 11px;
  top: 7px;
}

.cb-md-live.is-inline:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, color-mix(in srgb, var(--accent) 16%, transparent));
}

.cb-live-tbl-wrap {
  box-sizing: border-box;
  max-width: 100%;
  margin: 6px 0;
  padding: 6px 8px 8px;
  border-radius: 10px;
  border: 1px solid var(--line-strong, var(--line));
  background: var(--surface-2);
}

.cb-tbl-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.cb-tbl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
}

.cb-tbl-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.cb-tbl-btn.is-on {
  border-color: var(--accent);
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 14%, transparent));
  color: var(--accent);
}

.cb-img-bar-sep {
  width: 1px;
  height: 14px;
  background: var(--line-strong, var(--line));
  margin: 0 2px;
  flex: none;
}

.cb-img-align-btn {
  width: 24px;
  padding: 0;
}

.cb-tbl-btn.is-del {
  margin-left: auto;
  color: var(--muted);
}

.cb-tbl-btn.is-del:hover {
  border-color: var(--bad);
  color: var(--bad);
}

.cb-live-tbl-wrap .qtbl th:focus,
.cb-live-tbl-wrap .qtbl td:focus {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.cb-md-live.is-img-drop-over {
  outline: 2px dashed var(--accent);
  outline-offset: 4px;
  background: color-mix(in srgb, var(--accent-soft, rgba(37, 99, 235, .08)) 45%, transparent);
  border-radius: 8px;
}

.cb-live-img-wrap {
  box-sizing: border-box;
  max-width: 100%;
  width: fit-content;
  margin: 8px auto 8px 0;
  padding: 6px 8px 8px;
  border-radius: 10px;
  border: 1px solid var(--line-strong, var(--line));
  background: var(--surface-2);
  user-select: none;
  justify-self: start;
  align-self: flex-start;
}

.cb-live-img-wrap.is-align-left {
  margin-left: 0;
  margin-right: auto;
  justify-self: start;
  align-self: flex-start;
}

.cb-live-img-wrap.is-align-center {
  margin-left: auto;
  margin-right: auto;
  justify-self: center;
  align-self: center;
}

.cb-live-img-wrap.is-align-right {
  margin-left: auto;
  margin-right: 0;
  justify-self: end;
  align-self: flex-end;
}

.cb-live-img-wrap.is-resizing {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, color-mix(in srgb, var(--accent) 16%, transparent));
}

.cb-img-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
}

.cb-img-size-lbl {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  padding-right: 4px;
  font-variant-numeric: tabular-nums;
}

.cb-live-img-stage {
  position: relative;
  display: inline-block;
  max-width: 100%;
  line-height: 0;
}

.cb-live-img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.cb-live-img-stage[style*="width"] .cb-live-img {
  width: 100%;
}

.cb-img-resize-handle {
  position: absolute;
  z-index: 2;
  opacity: .72;
  transition: opacity .12s ease, transform .12s ease, background-color .12s ease;
}

.cb-live-img-stage:hover .cb-img-resize-handle,
.cb-live-img-wrap.is-resizing .cb-img-resize-handle {
  opacity: 1;
}

.cb-img-resize-handle.is-left {
  top: 50%;
  left: -5px;
  transform: translateY(-50%);
  width: 8px;
  height: 36px;
  max-height: 60%;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
  cursor: ew-resize;
  display: none;
}

.cb-live-img-wrap.is-align-center .cb-img-resize-handle.is-left,
.cb-live-img-wrap.is-align-right .cb-img-resize-handle.is-left {
  display: block;
}

.cb-live-img-wrap.is-align-right .cb-img-resize-handle.is-right,
.cb-live-img-wrap.is-align-right .cb-img-resize-handle.is-corner {
  display: none;
}

.cb-img-resize-handle.is-right {
  top: 50%;
  right: -5px;
  transform: translateY(-50%);
  width: 8px;
  height: 36px;
  max-height: 60%;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
  cursor: ew-resize;
}

.cb-img-resize-handle.is-corner {
  right: -5px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, .25);
  cursor: nwse-resize;
}

.cb-live-file-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  max-width: min(600px, 100%);
  margin: 7px 0;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-strong, var(--line));
  background: var(--surface-2);
  user-select: none;
}

.cb-file-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1 1 auto;
  gap: 1px;
}

.cb-file-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-file-name:hover {
  color: var(--accent);
  text-decoration: underline;
}

.cb-file-size {
  font-size: 11px;
  color: var(--muted);
}

.cb-file-acts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

.cb-file-acts .cb-tbl-btn {
  gap: 4px;
  text-decoration: none;
}

.cb-opt-section {
  display: grid;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.cb-opt-video {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
}

.cb-opt-video .cb-notch-field {
  flex: 1 1 auto;
}

.cb-opt-sec-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.cb-opt-sec-title svg {
  width: 14px;
  height: 14px;
  color: var(--muted);
}

.cb-bullets-list {
  display: grid;
  gap: 6px;
}

.cb-bullet-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: var(--confirm, #16A34A);
  flex: none;
}

.cb-callout-editor {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
  background: var(--accent-soft, color-mix(in srgb, var(--accent) 10%, transparent));
}

.cb-callout-editor.is-warn {
  border-color: color-mix(in srgb, var(--warn, #F97316) 35%, var(--line));
  background: var(--warn-soft, color-mix(in srgb, var(--warn, #F97316) 10%, transparent));
}

.cb-callout-head-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.crs-step-pill.is-homework.is-cur {
  background: var(--notif, #F97316);
  border-color: var(--notif, #F97316);
  color: #fff;
}

.crs-step-pill.is-code.is-cur {
  background: var(--pro, #7C3AED);
  border-color: var(--pro, #7C3AED);
  color: #fff;
}

/* Квадратные плитки шагов в просмотре «Глазами ученика» */
.cb-topic-studio .crs-step-strip {
  gap: 8px;
  padding: 6px 6px 8px 3px;
}

.cb-topic-studio .crs-step-pill:not(.cb-step-pill-add) {
  width: 40px;
  min-width: 40px;
  height: 40px;
  padding: 0;
  justify-content: center;
  gap: 0;
  border-radius: 10px;
  border-width: 1.5px;
  position: relative;
  cursor: pointer;
  transition: border-color .14s ease, background-color .14s ease, color .14s ease, box-shadow .14s ease, transform .12s ease;
}

.cb-topic-studio .crs-step-pill:not(.cb-step-pill-add) > svg {
  width: 16px;
  height: 16px;
}

.cb-topic-studio .crs-step-pill:not(.cb-step-pill-add):hover {
  transform: translateY(-1px);
}

.cb-topic-studio .crs-step-pill.is-cur:not(.cb-step-pill-add) {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

.cb-topic-studio .crs-step-pill.is-homework.is-cur {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--notif, #F97316) 24%, transparent);
}

.cb-topic-studio .crs-step-pill.is-code.is-cur {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pro, #7C3AED) 24%, transparent);
}

.cb-topic-studio .crs-step-pill.is-done {
  background: var(--good-soft);
  border-color: var(--good);
  color: var(--good);
}

.cb-topic-studio .crs-step-pill.is-done:hover {
  border-color: var(--good);
  background: color-mix(in srgb, var(--good) 18%, var(--surface));
  color: var(--good);
}

.cb-topic-studio .crs-step-pill.is-cur.is-done,
.cb-topic-studio .crs-step-pill.is-homework.is-cur.is-done,
.cb-topic-studio .crs-step-pill.is-code.is-cur.is-done {
  background: var(--good);
  border-color: var(--good);
  color: #fff;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 24%, transparent);
}

.cb-step-done-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background: var(--good);
  color: #fff;
  border: 2px solid var(--surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.cb-step-done-badge svg {
  width: 9px;
  height: 9px;
  stroke-width: 3;
}

.cb-topic-studio .crs-step-pill.is-cur.is-done .cb-step-done-badge {
  background: #fff;
  color: var(--good);
  border-color: var(--good);
}

@media (max-width: 959px) {
  .cb-topic-studio {
    padding: 12px 12px calc(92px + env(safe-area-inset-bottom, 0px));
  }
  .cb-mod-head-row {
    flex-direction: row;
    align-items: center;
  }
  .cb-topic-row-line {
    gap: 4px;
  }
  .cb-topic-drag-grip {
    width: 18px;
  }
  .cb-topic-inline-fields {
    grid-template-columns: 68px minmax(0, 1fr);
  }
}

/* Шаг «Код»: IDE-редактор кода, панель языка и тест-кейсы */
.cb-code-lang-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.cb-code-env-pill {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.cb-code-env-pill.is-auto {
  border-color: color-mix(in srgb, var(--confirm, #16A34A) 36%, var(--line));
  background: color-mix(in srgb, var(--confirm, #16A34A) 11%, transparent);
  color: var(--confirm, #16A34A);
}

.cb-code-ide {
  border: 1px solid var(--line-strong, var(--line));
  border-radius: 12px;
  background: var(--surface);
  overflow: visible;
  transition: border-color .14s ease, box-shadow .14s ease;
  min-width: 0;
}

.cb-code-ide:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft, color-mix(in srgb, var(--accent) 16%, transparent));
}

.cb-code-ide-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  border-radius: 11px 11px 0 0;
  background: var(--surface-2);
}

.cb-code-ide-title {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  min-width: 0;
}

.cb-code-lang-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--muted);
  flex: none;
}

.cb-code-lang-dot.is-python { background: #3b82f6; }
.cb-code-lang-dot.is-sql { background: #f59e0b; }
.cb-code-lang-dot.is-javascript { background: #eab308; }
.cb-code-lang-dot.is-cpp { background: #8b5cf6; }

.cb-code-file {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.cb-code-lbl {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
}

.cb-code-lines-cnt {
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.cb-code-ide-acts {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}

.cb-code-ide-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 26px;
  padding: 0 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color .12s ease, background-color .12s ease, color .12s ease;
}

.cb-code-ide-btn svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.cb-code-ide-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
}

.cb-code-ide-btn:disabled {
  opacity: .55;
  cursor: default;
}

.cb-code-ide-btn.cb-code-run-btn {
  border-color: color-mix(in srgb, var(--confirm, #16A34A) 40%, var(--line));
  background: color-mix(in srgb, var(--confirm, #16A34A) 11%, var(--surface));
  color: var(--confirm, #16A34A);
}

.cb-code-ide-btn.cb-code-run-btn:hover:not(:disabled) {
  border-color: var(--confirm, #16A34A);
  background: color-mix(in srgb, var(--confirm, #16A34A) 18%, var(--surface));
}

.cb-code-ide-btn.is-muted {
  color: var(--muted);
  padding: 0 6px;
}

.cb-code-ide-btn.is-muted:hover:not(:disabled) {
  border-color: var(--bad);
  color: var(--bad);
}

.cb-code-ide-body {
  display: flex;
  align-items: stretch;
  border-radius: 0 0 11px 11px;
  overflow: hidden;
  background: var(--surface);
  min-width: 0;
}

.cb-code-gutter {
  flex: none;
  width: 42px;
  padding: 10px 8px 10px 4px;
  border-right: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
  line-height: 21px;
  text-align: right;
  white-space: pre;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  box-sizing: border-box;
}

.cb-code-ta {
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
  min-height: 118px;
  padding: 10px 12px;
  border: 0;
  outline: none;
  resize: none;
  background: transparent;
  color: var(--ink);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
  line-height: 21px;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
  box-sizing: border-box;
}

.cb-code-ta::placeholder {
  color: var(--muted);
  white-space: pre-wrap;
}

.cb-tests-box {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  min-width: 0;
}

.cb-tests-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.cb-tests-title-wrap {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cb-tests-summary {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.cb-tests-head-acts {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-code-run-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 600;
}

.cb-code-run-banner > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cb-code-run-banner.is-ok {
  border-color: color-mix(in srgb, var(--confirm, #16A34A) 45%, var(--line));
  background: color-mix(in srgb, var(--confirm, #16A34A) 10%, var(--surface));
  color: var(--confirm, #16A34A);
}

.cb-code-run-banner.is-bad,
.cb-code-run-banner.is-err {
  border-color: color-mix(in srgb, var(--bad, #FF2B4D) 45%, var(--line));
  background: color-mix(in srgb, var(--bad, #FF2B4D) 10%, var(--surface));
  color: var(--bad, #FF2B4D);
}

.cb-tc-list {
  display: grid;
  gap: 8px;
}

.cb-tc-card {
  display: grid;
  gap: 8px;
  padding: 10px;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border-color .14s ease, background-color .14s ease;
  min-width: 0;
}

.cb-tc-card.is-hidden {
  border-style: dashed;
}

.cb-tc-card.is-pass {
  border-color: color-mix(in srgb, var(--confirm, #16A34A) 55%, var(--line));
}

.cb-tc-card.is-fail {
  border-color: color-mix(in srgb, var(--bad, #FF2B4D) 55%, var(--line));
}

.cb-tc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cb-tc-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.cb-tc-num {
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}

.cb-tc-res-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.cb-tc-res-pill.is-ok {
  background: color-mix(in srgb, var(--confirm, #16A34A) 14%, transparent);
  color: var(--confirm, #16A34A);
}

.cb-tc-res-pill.is-bad {
  background: color-mix(in srgb, var(--bad, #FF2B4D) 12%, transparent);
  color: var(--bad, #FF2B4D);
}

.cb-tc-acts {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.cb-tc-vis-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.cb-tc-vis-btn svg {
  width: 12px;
  height: 12px;
  flex: none;
}

.cb-tc-vis-btn:hover {
  border-color: var(--accent);
  color: var(--ink);
}

.cb-tc-vis-btn.is-on {
  border-color: var(--pro, #7C3AED);
  background: color-mix(in srgb, var(--pro, #7C3AED) 12%, transparent);
  color: var(--pro, #7C3AED);
}

.cb-tc-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
}

.cb-tc-icon-btn svg {
  width: 12px;
  height: 12px;
}

.cb-tc-icon-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--ink);
}

.cb-tc-icon-btn.is-del:hover:not(:disabled) {
  border-color: var(--bad);
  color: var(--bad);
}

.cb-tc-icon-btn:disabled {
  opacity: .45;
  cursor: default;
}

.cb-tc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.cb-tc-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.cb-tc-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.cb-tc-area {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid var(--line-strong, var(--line));
  background: var(--surface-2);
  color: var(--ink);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12.5px;
  line-height: 1.45;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
  transition: border-color .12s ease, background-color .12s ease;
}

.cb-tc-area:focus {
  border-color: var(--accent);
  background: var(--surface);
}

.cb-tc-diff {
  padding: 6px 9px;
  border-radius: 8px;
  background: color-mix(in srgb, var(--bad, #FF2B4D) 9%, transparent);
  color: var(--bad, #FF2B4D);
  font-size: 12px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.cb-tc-diff code {
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 12px;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--surface);
  color: var(--ink);
}

:root[data-theme="dark"] .cb-code-ide {
  background: #0d1016;
}

:root[data-theme="dark"] .cb-code-ide-head,
:root[data-theme="dark"] .cb-code-gutter {
  background: #161a23;
}

:root[data-theme="dark"] .cb-code-ide-body {
  background: #0d1016;
}

:root[data-theme="dark"] .cb-tc-area {
  background: #12151d;
}

:root[data-theme="dark"] .cb-tc-area:focus {
  background: #0d1016;
}

:root[data-theme="dark"] .crs-trow.is-inline-editing,
:root[data-theme="dark"] .crs-trow.is-inline-editing:hover,
:root[data-theme="dark"] .crs-mod-head.is-inline-editing,
:root[data-theme="dark"] .crs-mod-head.is-inline-editing:hover {
  background: color-mix(in srgb, var(--accent) 16%, var(--surface));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}

:root[data-theme="dark"] .cb-inline-title-inp,
:root[data-theme="dark"] .cb-inline-mod-title-inp,
:root[data-theme="dark"] .cb-inline-mod-sub-inp {
  background: color-mix(in srgb, var(--surface) 58%, transparent);
}

:root[data-theme="dark"] .cb-inline-title-inp:focus,
:root[data-theme="dark"] .cb-inline-mod-title-inp:focus,
:root[data-theme="dark"] .cb-inline-mod-sub-inp:focus {
  background: var(--surface);
}

/* ==========================================================================
   СДО СВФУ: плотный выпадающий пикер с анимацией сдвига, хлебные крошки и строки
   ========================================================================== */

.cb-filter-stack {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.cb-sdo-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  flex-wrap: wrap;
}

.cb-sdo-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 auto;
}

.cb-sdo-picker-wrap {
  position: relative;
  display: inline-flex;
  max-width: 100%;
}

.cb-sdo-picker-wrap.is-full {
  width: 100%;
}

.cb-sdo-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 36px;
  max-width: 100%;
  padding: 0 11px 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.cb-sdo-picker-wrap.is-full .cb-sdo-trigger {
  width: 100%;
  border-radius: 11px;
  height: 38px;
}

.cb-sdo-trigger:hover {
  border-color: var(--line-strong, var(--line));
  background: var(--surface-2);
}

.cb-sdo-trigger.has-selection,
.cb-sdo-trigger[aria-expanded="true"] {
  border-color: var(--accent);
}

.cb-sdo-trig-txt {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}

.cb-sdo-trig-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-sdo-trig-sub {
  color: var(--muted);
  font-weight: 500;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-sdo-trig-chev {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  flex: none;
  transition: transform .18s cubic-bezier(.22, 1, .36, 1);
}

.cb-sdo-trigger[aria-expanded="true"] .cb-sdo-trig-chev {
  transform: rotate(180deg);
  color: var(--accent);
}

.cb-sdo-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  width: min(440px, calc(100vw - 32px));
  padding: 6px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--line-strong, var(--line));
  box-shadow: 0 14px 40px rgba(15, 23, 42, .2);
  z-index: 45;
  overflow: hidden;
  box-sizing: border-box;
  animation: cb-sdo-pop-open .15s cubic-bezier(.22, 1, .36, 1) both;
}

.cb-sdo-picker-wrap.is-full .cb-sdo-popover {
  width: min(100%, 480px);
}

.is-filter-drawer .sheet-body .cb-sdo-picker-wrap {
  display: grid;
  width: 100%;
}

.is-filter-drawer .sheet-body .cb-sdo-popover {
  position: relative;
  top: auto;
  left: auto;
  width: 100%;
  margin-top: 6px;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

@keyframes cb-sdo-pop-open {
  from { opacity: 0; transform: translateY(-4px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

@keyframes cb-sdo-slide-fwd {
  from { opacity: 0; transform: translateX(24px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes cb-sdo-slide-back {
  from { opacity: 0; transform: translateX(-22px); }
  to { opacity: 1; transform: translateX(0); }
}

.cb-sdo-pop-view {
  display: grid;
  gap: 2px;
}

.cb-sdo-pop-view.is-slide-fwd {
  animation: cb-sdo-slide-fwd .2s cubic-bezier(.22, 1, .36, 1) both;
}

.cb-sdo-pop-view.is-slide-back {
  animation: cb-sdo-slide-back .18s cubic-bezier(.22, 1, .36, 1) both;
}

.cb-sdo-pop-title {
  padding: 3px 10px 2px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.cb-sdo-pop-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 2px 6px 3px;
}

.cb-sdo-pop-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  padding: 3px 6px 3px 2px;
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
}

.cb-sdo-pop-back span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cb-sdo-pop-back:hover {
  background: var(--surface-2);
}

.cb-sdo-pop-ctx {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  flex: none;
}

.cb-sdo-pop-list {
  display: grid;
  gap: 1px;
  max-height: 360px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.cb-sdo-pop-opt,
.cb-sdo-pop-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 30px;
  padding: 5.5px 10px;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  transition: background-color .13s ease, color .13s ease;
}

.cb-sdo-pop-opt:hover,
.cb-sdo-pop-footer:hover {
  background: var(--surface-2);
}

.cb-sdo-pop-opt.is-active,
.cb-sdo-pop-footer.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.cb-sdo-pop-opt.is-active .cb-sdo-pop-name {
  font-weight: 600;
}

.cb-sdo-pop-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1 1 auto;
}

.cb-sdo-pop-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.cb-sdo-pop-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  flex: none;
}

.cb-sdo-pop-right {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  flex: none;
}

.cb-sdo-pop-opt.is-active .cb-sdo-pop-right,
.cb-sdo-pop-footer.is-active .cb-sdo-pop-right {
  color: var(--accent);
}

.cb-sdo-pop-sep {
  height: 1px;
  background: var(--line);
  margin: 3px 6px;
}

.cb-sdo-pop-sublabel {
  padding: 4px 10px 2px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

.cb-sdo-pop-course-ico {
  width: 16px;
  height: 16px;
  display: inline-grid;
  place-items: center;
  color: var(--accent);
  flex: none;
}

.cb-sdo-pop-course-ico svg {
  width: 14px;
  height: 14px;
}

.cb-sdo-crumbs-wrap {
  position: relative;
  min-width: 0;
  max-width: 100%;
}

.cb-sdo-crumbs {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 2px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  line-height: 1.3;
  box-sizing: border-box;
}

.cb-sdo-crumb-item {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
  white-space: nowrap;
  min-width: 0;
}

.cb-sdo-crumb-item[hidden] {
  display: none !important;
}

.cb-sdo-crumb-item.is-tail {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
}

.cb-sdo-crumbs.is-measuring .cb-sdo-crumb-item.is-tail {
  flex: 0 0 auto;
  overflow: visible;
}

.cb-sdo-crumb-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
}

.cb-sdo-crumb-home:hover {
  background: var(--surface-2);
  color: var(--accent);
}

.cb-sdo-crumb-sep {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  color: var(--muted);
  opacity: 0.7;
}

.cb-sdo-crumb-link {
  padding: 2px 5px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
}

.cb-sdo-crumb-link:hover {
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.cb-sdo-crumb-cur {
  font-weight: 600;
  color: var(--ink);
  padding: 2px 4px;
  white-space: nowrap;
}

.cb-sdo-crumb-item.is-tail .cb-sdo-crumb-cur,
.cb-sdo-crumb-item.is-tail .cb-sdo-crumb-link {
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.cb-sdo-crumb-dots {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 20px;
  min-width: 24px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}

.cb-sdo-crumb-dots:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}

.cb-sdo-crumb-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  min-width: 200px;
  max-width: min(320px, 90vw);
  padding: 6px;
  border-radius: 10px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
}

.cb-sdo-crumb-pop[hidden] {
  display: none !important;
}

.cb-sdo-crumb-pop-item {
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cb-sdo-crumb-pop-item:hover {
  background: color-mix(in srgb, var(--accent) 10%, var(--surface-2));
  color: var(--accent);
}

.cb-sdo-courses {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface);
}

.cb-sdo-row {
  position: relative;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: background-color .14s ease;
}

.cb-sdo-row:nth-child(even) {
  background: color-mix(in srgb, var(--surface-2) 65%, var(--surface));
}

.cb-sdo-row:last-child {
  border-bottom: 0;
}

.cb-sdo-row:hover {
  background: color-mix(in srgb, var(--accent) 5%, var(--surface));
}

.cb-sdo-row-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
}

.cb-sdo-row-left {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  flex: 1 1 auto;
}

.cb-sdo-course-ico {
  width: 28px;
  height: 28px;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--cb-tone, var(--accent)) 12%, transparent);
  color: var(--cb-tone, var(--accent));
  margin-top: 1px;
}

.cb-sdo-row-text {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.cb-sdo-row-titleline {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.cb-sdo-course-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: #164e87;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.cb-sdo-course-link:hover {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cb-sdo-row-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-sdo-path-inline {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 440px;
}

.cb-sdo-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.cb-sdo-info-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color .14s ease, color .14s ease, background-color .14s ease;
}

.cb-sdo-info-btn:hover,
.cb-sdo-info-btn.is-on {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.cb-sdo-row-info {
  padding: 0 14px 12px 53px;
  display: grid;
  gap: 6px;
}

.cb-sdo-info-desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
}

.cb-sdo-info-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12px;
  color: var(--muted);
}

.cb-sdo-info-cat-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.cb-sdo-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px dashed var(--line);
  background: var(--surface);
}

:root[data-theme="dark"] .cb-sdo-popover {
  background: rgba(20, 23, 29, 0.96);
  border-color: rgba(255, 255, 255, 0.14);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.52);
}

:root[data-theme="dark"] .cb-sdo-pop-opt:hover,
:root[data-theme="dark"] .cb-sdo-pop-footer:hover {
  background: rgba(255, 255, 255, 0.06);
}

:root[data-theme="dark"] .cb-sdo-pop-opt.is-active,
:root[data-theme="dark"] .cb-sdo-pop-footer.is-active {
  background: rgba(255, 255, 255, 0.09);
  color: #f4f7fb;
}

:root[data-theme="dark"] .cb-sdo-pop-opt.is-active .cb-sdo-pop-right,
:root[data-theme="dark"] .cb-sdo-pop-footer.is-active .cb-sdo-pop-right {
  color: #f4f7fb;
}

:root[data-theme="dark"] .cb-sdo-pop-badge {
  background: #222630;
  border-color: rgba(255, 255, 255, 0.12);
  color: #9ba5b7;
}

:root[data-theme="dark"] .cb-sdo-pop-sep {
  background: rgba(255, 255, 255, 0.1);
}

:root[data-theme="dark"] .cb-sdo-course-link {
  color: #7cc0ff;
}

:root[data-theme="dark"] .cb-sdo-row:nth-child(even) {
  background: rgba(255, 255, 255, 0.03);
}

:root[data-theme="dark"] .cb-sdo-row:hover {
  background: rgba(59, 130, 246, 0.09);
}

@media (max-width: 720px) {
  .cb-ws-top {
    gap: 8px;
  }
  .cb-ws-top .btn.sm {
    padding: 0 10px;
  }
  .cb-hero {
    padding: 14px;
    gap: 10px;
    border-radius: 16px;
  }
  .cb-hero-heading {
    flex: 1 1 160px;
  }
  .cb-ws-meta-strip {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .cb-ws-invite {
    display: grid;
    gap: 8px;
    width: 100%;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    box-sizing: border-box;
  }
  .cb-ws-invite-code {
    justify-content: space-between;
    width: 100%;
  }
  .cb-ws-invite-acts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }
  .cb-ws-invite-acts .btn.sm {
    width: 100%;
    justify-content: center;
    background: var(--surface);
    border-color: var(--line);
  }
  .cb-tabs {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.85fr);
  }
  .cb-tab-btn {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cb-syllabus-card,
  .cb-syllabus-card.pad-lg {
    padding: 12px;
    gap: 10px;
    border-radius: 16px;
  }
  .cb-syllabus-card .crs-mod-list {
    margin-left: 4px;
    padding-left: 8px;
    gap: 8px;
  }

  /* Единая 2-строчная карточка модуля */
  .cb-mod-head-row {
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    overflow: hidden;
  }
  .cb-mod-head-row .crs-mod-head {
    flex: 1 1 100%;
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 11px 12px 10px;
    align-items: flex-start;
  }
  .cb-mod-head-row .cb-mod-acts {
    flex: 0 0 100%;
    width: 100%;
    height: auto;
    margin-left: 0;
    padding: 5px 8px;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
    border-radius: 0;
    background: color-mix(in srgb, var(--surface) 60%, var(--surface-2));
    display: flex;
    gap: 4px;
  }
  .cb-mod-acts .cb-topic-act-btn,
  .cb-mod-acts .btn.sm.cb-topic-act-btn {
    flex: 1 1 0;
    width: auto;
    height: 32px;
    justify-content: center;
  }
  .cb-ghost-mod-wrap > .cb-mod-head-row {
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .cb-ghost-mod-wrap .crs-mod-head.cb-ghost-mod {
    border: 1.5px dashed color-mix(in srgb, var(--accent) 46%, var(--line));
    border-radius: 12px;
    background: color-mix(in srgb, var(--accent) 8%, var(--surface));
    padding: 11px 12px;
  }
  .cb-ghost-acts-spacer,
  .cb-topic-acts.cb-ghost-acts-spacer {
    display: none;
  }
  .crs-mod.is-hidden-student > .cb-mod-head-row {
    border-style: dashed;
    border-color: color-mix(in srgb, var(--warn, #d97706) 40%, var(--line));
    background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
  }
  .crs-mod.is-hidden-student > .cb-mod-head-row .crs-mod-head {
    border: 0;
    background: transparent;
  }
  .cb-mod-head-row:has(.is-inline-editing) {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  }
  .crs-mod-head.is-inline-editing {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }

  /* Единая 2-строчная карточка темы */
  .cb-topic-row-line {
    flex-wrap: wrap;
    align-items: center;
    gap: 0;
    border-radius: 11px;
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
  }
  .cb-topic-row-line .cb-topic-drag-grip {
    flex: 0 0 24px;
    width: 24px;
    height: auto;
    align-self: stretch;
    padding-left: 4px;
    border-radius: 0;
  }
  .cb-topic-row-line .crs-trow {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 10px 10px 10px 4px;
    min-height: 44px;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }
  .cb-topic-row-line > .crs-trow:first-child {
    padding-left: 12px;
  }
  .cb-topic-row-line .cb-topic-acts {
    flex: 0 0 100%;
    width: 100%;
    height: auto;
    margin-left: 0;
    padding: 5px 8px;
    border: 0;
    border-top: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
    border-radius: 0;
    background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
    display: flex;
    gap: 4px;
  }
  .cb-topic-acts .cb-topic-act-btn,
  .cb-topic-acts .btn.sm.cb-topic-act-btn {
    flex: 1 1 0;
    width: auto;
    height: 32px;
    justify-content: center;
  }
  .cb-ghost-topic-wrap .cb-topic-row-line {
    border: 0;
    background: transparent;
    overflow: visible;
  }
  .cb-ghost-topic-wrap .cb-ghost-spacer {
    display: none;
  }
  .cb-ghost-topic-wrap .crs-trow.cb-ghost-topic {
    flex: 1 1 100%;
    border: 1.5px dashed color-mix(in srgb, var(--accent) 42%, var(--line));
    border-radius: 11px;
    background: color-mix(in srgb, var(--accent) 5.5%, var(--surface));
    padding: 9.5px 12px;
  }
  .cb-topic-row-wrap.is-hidden-student .cb-topic-row-line,
  .crs-mod.is-hidden-student .crs-mod-list .cb-topic-row-wrap:not(.cb-ghost-topic-wrap) .cb-topic-row-line {
    border-style: dashed;
    border-color: color-mix(in srgb, var(--warn, #d97706) 38%, var(--line));
    background: color-mix(in srgb, var(--surface-2) 55%, var(--surface));
  }
  .cb-topic-row-wrap.is-hidden-student .cb-topic-row-line .crs-trow,
  .crs-mod.is-hidden-student .crs-mod-list .cb-topic-row-wrap:not(.cb-ghost-topic-wrap) .cb-topic-row-line .crs-trow {
    border: 0;
    background: transparent;
  }
  .cb-topic-row-wrap.is-editing .cb-topic-row-line {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 11%, var(--surface));
  }
  .cb-topic-row-line .crs-trow.is-inline-editing {
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
  }
  .cb-syllabus-card .crs-trow-title,
  .cb-syllabus-card .crs-mod-title {
    overflow-wrap: anywhere;
  }
  .cb-syllabus-card .crs-trow.is-inline-editing {
    grid-template-columns: minmax(0, 1fr);
  }
  .crs-trow.is-inline-editing .crs-trow-right,
  .crs-mod-head.is-inline-editing .crs-mod-right {
    display: none;
  }

  .cb-sdo-popover {
    width: min(440px, calc(100vw - 24px));
  }
  .cb-sdo-row-main {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 10px 12px;
  }
  .cb-sdo-row-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .cb-sdo-row-info {
    padding: 0 12px 10px;
  }
  .cb-sdo-path-inline {
    max-width: 100%;
    white-space: normal;
  }
}

@media (max-width: 640px) {
  .cb-tc-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cb-code-gutter {
    width: 34px;
    padding: 10px 6px 10px 2px;
  }
  .cb-code-ta {
    padding: 10px;
  }
  .cb-mat-form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .cb-mat-drop {
    flex-direction: column;
    align-items: stretch;
  }
}

/* Компактный блок материалов и загрузка любых файлов до 5 ГБ */
.cb-mat-panel {
  gap: 10px;
  padding: 14px 16px;
}

.cb-mat-head-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.cb-mat-form {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.cb-mat-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, .9fr);
  gap: 8px;
}

.cb-mat-form .cb-field {
  gap: 3px;
}

.cb-mat-form .cb-label {
  font-size: 11.5px;
}

.cb-mat-form .ta-input {
  height: 34px;
  padding: 0 10px;
  font-size: 13.5px;
  background: var(--surface);
}

.cb-mat-form .ta-textarea {
  min-height: 54px;
  padding: 7px 10px;
  font-size: 13px;
  background: var(--surface);
}

.cb-mat-drop {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px dashed var(--line-strong);
  background: var(--surface);
  transition: border-color .14s ease, background-color .14s ease;
}

.cb-mat-drop.is-drop-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cb-mat-drop-info {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  min-width: 0;
}

.cb-mat-drop-info svg {
  width: 14px;
  height: 14px;
  color: var(--accent);
  flex: none;
}

.cb-mat-pick-btn {
  flex: none;
  cursor: pointer;
}

.cb-mat-upload-prog {
  display: grid;
  gap: 5px;
  padding: 7px 10px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.cb-mat-upload-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.cb-mat-upload-left,
.cb-mat-upload-right {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.cb-mat-upload-right {
  flex: none;
}

.cb-mat-upload-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.cb-mat-upload-pill {
  display: inline-flex;
  align-items: center;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.cb-mat-upload-pill:empty {
  display: none;
}

.cb-mat-upload-ctl {
  height: 22px;
  padding: 0 8px;
  font-size: 11.5px;
  border-radius: 6px;
}

.cb-mat-upload-stats {
  font-size: 11.5px;
  line-height: 1.2;
}

.cb-mat-upload-stats:empty {
  display: none;
}

.cb-mat-upload-track {
  height: 5px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.cb-mat-upload-track > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width .15s ease;
}

.cb-mat-upload-track.is-paused > span {
  background: var(--muted);
}

.cb-mat-file-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cb-mat-file-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
}

.cb-mat-file-chip svg {
  width: 13px;
  height: 13px;
  color: var(--accent);
  flex: none;
}

.cb-mat-file-name {
  font-weight: 600;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 240px;
}

.cb-mat-file-del {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.cb-mat-file-del:hover {
  color: var(--bad, #e11d48);
  background: var(--bad-soft, rgba(225, 29, 72, .10));
}

.cb-mat-list {
  display: grid;
  gap: 6px;
}

.cb-mat-row {
  display: grid;
  gap: 4px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.cb-mat-row-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.cb-mat-row-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 8px;
  min-width: 0;
}

.cb-mat-row-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.cb-mat-row-body {
  font-size: 13px;
  color: var(--ink-2);
  display: grid;
  gap: 4px;
}

.cb-mat-row-body .crs-p {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
}

/* Поле «Любой файл до 5 ГБ» и единый переключатель авто/ручной проверки в ДЗ */
.cb-hw-drop {
  width: 100%;
  box-sizing: border-box;
}

.cb-hw-submit.cb-hw-drop {
  border-color: var(--line-strong);
  background: var(--surface-2);
  transition: border-color .14s ease, background-color .14s ease;
}

.cb-hw-submit.cb-hw-drop.is-drop-over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.cb-hw-submit .cb-hw-submit-bar {
  width: 100%;
  justify-content: space-between;
}

.cb-hw-check-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
}

.cb-hw-check-btn {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease, box-shadow .15s ease;
}

.cb-hw-check-btn:hover {
  border-color: var(--accent);
}

.cb-hw-check-btn.is-auto {
  border-color: rgba(37, 99, 235, .42);
  background: rgba(37, 99, 235, .06);
}

.cb-hw-check-switch {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--line-strong, #cbd5e1);
  flex: none;
  transition: background-color .16s ease;
}

.cb-hw-check-switch > span {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, .22);
  transition: transform .16s ease;
}

.cb-hw-check-btn.is-auto .cb-hw-check-switch {
  background: var(--accent, #2563eb);
}

.cb-hw-check-btn.is-auto .cb-hw-check-switch > span {
  transform: translateX(16px);
}

.cb-hw-check-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.cb-hw-check-copy b {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
}

.cb-mini-chip.is-auto {
  background: rgba(37, 99, 235, .10);
  color: var(--accent, #1d4ed8);
  border-color: rgba(37, 99, 235, .24);
}

.cb-mini-chip.is-manual {
  background: var(--accent-soft, #fff3eb);
  color: var(--accent-text, #c2410c);
}

:root[data-theme="dark"] .cb-hw-check-btn.is-auto {
  background: rgba(59, 130, 246, .14);
  border-color: rgba(96, 165, 250, .42);
}

@media (max-width: 600px) {
  .cb-hw-drop,
  .cb-hw-submit .cb-hw-submit-bar {
    flex-direction: column;
    align-items: stretch;
  }
  .cb-hw-drop .cb-mat-pick-btn,
  .cb-hw-drop .cb-hw-attach-btn {
    width: 100%;
    justify-content: center;
  }
}
