/*
   Страница работы /p/project/{slug} (шаблон types/project/show): шапка с
   заголовком, описанием, фактами и кнопками, блок «команда ИИ-агентов» и
   паспорт проекта. Префикс pj-.

   Палитра та же, что у sbj-* в content-pages.css, но токены свои: тот файл
   на странице работы не подключён. Rubik подключён в @push('meta') шаблона.
*/

:root {
    --pj-primary: #673ab7;
    --pj-primary-dark: #4b2b86;
    --pj-primary-soft: #f2edfb;
    --pj-primary-glow: rgba(103, 58, 183, .16);
    --pj-green: #7cb92b;
    --pj-ink: #1b1725;
    --pj-body: #2f2a40;
    --pj-muted: #6b6880;
    --pj-line: #e8e5f0;
    --pj-radius: 20px;
    --pj-shadow: 0 1px 2px rgba(27, 23, 37, .04), 0 14px 36px -14px rgba(75, 43, 134, .22);
    --pj-font-display: 'Rubik', var(--bs-font-sans-serif, sans-serif);
}

/* ---------- Общее ---------- */

.pj-card {
    position: relative;
    margin-bottom: 20px;
    background: #fff;
    border: 1px solid var(--pj-line);
    border-radius: var(--pj-radius);
    box-shadow: var(--pj-shadow);
}

.pj-eyebrow {
    display: inline-block;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--pj-primary);
}

.pj-chip {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px;
    border-radius: 999px;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1;
    color: var(--pj-primary);
    background: var(--pj-primary-soft);
    text-decoration: none;
    white-space: nowrap;
    transition: background-color .15s ease, color .15s ease;
}

.pj-chip:hover,
.pj-chip:focus-visible {
    color: #fff;
    background: var(--pj-primary);
}

/* ---------- Шапка ---------- */

.pj-hero {
    overflow: hidden;
    padding: 30px 34px 30px;
    isolation: isolate;
}

/* Фирменная полоса: фиолетовый переходит в зелёный горошины */
.pj-hero::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--pj-primary) 0%, #9a7bd6 55%, var(--pj-green) 100%);
}

/* Мягкое свечение в правом верхнем углу */
.pj-hero::after {
    content: "";
    position: absolute;
    top: -220px;
    right: -160px;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: radial-gradient(closest-side, var(--pj-primary-glow), rgba(103, 58, 183, 0) 72%);
    z-index: -1;
    pointer-events: none;
}

.pj-hero__top {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
}

.pj-hero__kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--pj-muted);
}

.pj-hero__kicker i {
    font-size: 11px;
    color: var(--pj-green);
}

.pj-hero__title {
    margin: 18px 0 12px;
    font-family: var(--pj-font-display);
    font-size: clamp(1.45rem, 1.05rem + 1.4vw, 2.05rem);
    font-weight: 500;
    line-height: 1.22;
    letter-spacing: -.015em;
    color: var(--pj-ink);
    text-transform: none;
}

.pj-hero__lead {
    margin: 0;
    max-width: 72ch;
    font-size: 1.03rem;
    line-height: 1.7;
    color: var(--pj-body);
}

.pj-facts {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin: 24px 0 0;
    padding: 0;
    list-style: none;
}

.pj-facts__item {
    padding: 13px 15px;
    border: 1px solid var(--pj-line);
    border-radius: 14px;
    background: linear-gradient(180deg, #fff 0%, #faf8fd 100%);
}

.pj-facts__value {
    display: block;
    font-family: var(--pj-font-display);
    font-size: 1.4rem;
    font-weight: 500;
    line-height: 1.1;
    color: var(--pj-primary-dark);
    white-space: nowrap;
}

.pj-facts__value small {
    font-size: .8em;
}

.pj-facts__label {
    display: block;
    margin-top: 5px;
    font-size: 12.5px;
    line-height: 1.3;
    color: var(--pj-muted);
}

.pj-hero__trust {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 18px;
    /* Как и над плитками фактов — строка ложится ровно между ними и краем карточки */
    margin-top: 24px;
    font-size: 12.5px;
    color: var(--pj-muted);
}

.pj-hero__trust span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
}

.pj-hero__trust i {
    color: var(--pj-green);
    font-size: 12px;
}

/* ---------- Команда ИИ-агентов ---------- */

.pj-agents {
    overflow: hidden;
    padding: 30px 34px 28px;
    border: 0;
    color: #fff;
    background:
        radial-gradient(110% 90% at 100% 0%, rgba(140, 96, 222, .55) 0%, rgba(140, 96, 222, 0) 55%),
        radial-gradient(90% 80% at 0% 100%, rgba(40, 22, 84, .9) 0%, rgba(40, 22, 84, 0) 60%),
        #2b1a52;
    box-shadow: 0 1px 2px rgba(27, 23, 37, .08), 0 20px 44px -18px rgba(43, 26, 82, .6);
}

/* Тонкая сетка на фоне — намёк на «систему», не мешает тексту */
.pj-agents::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(80% 80% at 70% 20%, #000 20%, transparent 100%);
    mask-image: radial-gradient(80% 80% at 70% 20%, #000 20%, transparent 100%);
    pointer-events: none;
}

.pj-agents > * {
    position: relative;
}

.pj-agents__head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px 28px;
}

.pj-agents__eyebrow {
    color: #cdbcf2;
}

.pj-agents__title {
    margin: 8px 0 0;
    font-family: var(--pj-font-display);
    font-size: clamp(1.25rem, 1rem + .9vw, 1.6rem);
    font-weight: 500;
    line-height: 1.25;
    color: #fff;
}

.pj-agents__text {
    margin: 10px 0 0;
    max-width: 64ch;
    font-size: 14.5px;
    line-height: 1.6;
    color: rgba(255, 255, 255, .78);
}

.pj-agents__count {
    flex: 0 0 auto;
    padding: 10px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .16);
    text-align: center;
}

.pj-agents__count b {
    display: block;
    font-family: var(--pj-font-display);
    font-size: 1.6rem;
    font-weight: 500;
    line-height: 1;
    color: #fff;
}

.pj-agents__count span {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: #cdbcf2;
}

/* Схема конвейера: шесть узлов в ряд, между ними «бегущие» пунктирные связи */
.pj-flow {
    display: grid;
    /* Число узлов ставит партиал: у типов без списка литературы библиографа нет */
    grid-template-columns: repeat(var(--pj-flow-n, 6), minmax(0, 1fr));
    gap: 6px;
    margin: 28px 0 0;
    padding: 0;
    list-style: none;
}

.pj-flow__step {
    position: relative;
    padding: 0 4px;
    text-align: center;
}

.pj-flow__step + .pj-flow__step::before {
    content: "";
    position: absolute;
    top: 25px;
    left: calc(28px - 50%);
    right: calc(50% + 34px);
    height: 2px;
    background: repeating-linear-gradient(90deg, rgba(255, 255, 255, .55) 0 6px, transparent 6px 12px);
    background-size: 12px 2px;
    animation: pj-flow-x 1.1s linear infinite;
}

/* Стрелка на конце связи */
.pj-flow__step + .pj-flow__step::after {
    content: "";
    position: absolute;
    top: 26px;
    right: calc(50% + 33px);
    width: 7px;
    height: 7px;
    border-top: 2px solid rgba(255, 255, 255, .7);
    border-right: 2px solid rgba(255, 255, 255, .7);
    transform: translateY(-50%) rotate(45deg);
}

.pj-flow__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 19px;
    color: #fff;
    background: linear-gradient(160deg, rgba(255, 255, 255, .22) 0%, rgba(255, 255, 255, .06) 100%);
    border: 1px solid rgba(255, 255, 255, .28);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 10px 24px -10px rgba(0, 0, 0, .6);
}

.pj-flow__icon--accent {
    color: var(--pj-ink);
    background: linear-gradient(160deg, #d9f380 0%, #9cc440 100%);
    border-color: rgba(255, 255, 255, .5);
}

.pj-flow__badge {
    position: absolute;
    top: -7px;
    right: -12px;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    line-height: 1.2;
    color: var(--pj-ink);
    background: #d9f380;
    box-shadow: 0 2px 6px rgba(0, 0, 0, .25);
}

.pj-flow__num {
    display: block;
    margin-top: 12px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .1em;
    color: #b7a3e6;
}

.pj-flow__name {
    display: block;
    margin-top: 3px;
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.25;
    color: #fff;
}

.pj-flow__desc {
    display: block;
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.4;
    color: rgba(255, 255, 255, .7);
}

.pj-agents__notes {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px 18px;
    margin: 26px 0 0;
    padding: 18px 0 0;
    border-top: 1px solid rgba(255, 255, 255, .14);
}

.pj-agents__note {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 12.5px;
    line-height: 1.45;
    color: rgba(255, 255, 255, .8);
}

.pj-agents__note i {
    flex: 0 0 auto;
    margin-top: 2px;
    font-size: 12px;
    color: #c6e37a;
}

@keyframes pj-flow-x {
    to { background-position: 12px 0; }
}

@keyframes pj-flow-y {
    to { background-position: 0 12px; }
}

/* ---------- Паспорт проекта ---------- */

.pj-passport {
    padding: 26px 34px 8px;
}

.pj-passport__head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 6px 24px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--pj-line);
}

.pj-passport__title {
    margin: 4px 0 0;
    font-family: var(--pj-font-display);
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--pj-ink);
}

.pj-passport__hint {
    margin: 0;
    max-width: 44ch;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--pj-muted);
}

.pj-passport__grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 36px;
}

.pj-field {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    column-gap: 14px;
    padding: 18px 0;
    border-bottom: 1px solid var(--pj-line);
}

.pj-field--last {
    border-bottom: 0;
}

.pj-field__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 15px;
    color: var(--pj-primary);
    background: var(--pj-primary-soft);
}

.pj-field__label {
    margin: 0 0 5px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    line-height: 1.3;
    color: var(--pj-muted);
}

.pj-field__value {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.62;
    color: var(--pj-body);
}

.pj-tasks {
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: pj-task;
}

.pj-tasks li {
    position: relative;
    padding: 6px 0 6px 36px;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--pj-body);
    counter-increment: pj-task;
}

.pj-tasks li::before {
    content: counter(pj-task, decimal-leading-zero);
    position: absolute;
    left: 0;
    top: 7px;
    font-family: var(--pj-font-display);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--pj-primary);
}

.pj-roles {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 16px;
    margin-top: 4px;
}

.pj-role {
    padding: 12px 14px;
    border-radius: 12px;
    background: #faf8fd;
    border: 1px solid var(--pj-line);
}

.pj-role__name {
    display: block;
    margin-bottom: 3px;
    font-size: 13.5px;
    font-weight: 700;
    color: var(--pj-ink);
}

.pj-role__desc {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--pj-body);
}

/* Карточка «Скачать …» из компонента sample-downloads — в один стиль с остальными */
.pj-sample > .card {
    margin-bottom: 20px !important;
    border-color: var(--pj-line);
    border-radius: var(--pj-radius);
    box-shadow: var(--pj-shadow);
}

/* ---------- Страница владельца: вкладки паспорта и редактор разделов ---------- */

/* Точка статуса «в работе» мигает — видно, что процесс идёт */
.pj-hero__pulse {
    animation: pj-pulse 1.6s ease-in-out infinite;
}

@keyframes pj-pulse {
    50% { opacity: .35; }
}

.pj-tabs {
    padding: 22px 34px 24px;
}

.pj-tabs__head {
    padding-bottom: 14px;
}

.pj-tabs__title {
    margin: 4px 0 0;
    font-family: var(--pj-font-display);
    font-size: 1.3rem;
    font-weight: 500;
    line-height: 1.25;
    color: var(--pj-ink);
}

.pj-tabs__nav {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 4px 0 12px;
    border-bottom: 1px solid var(--pj-line);
}

.pj-tabs__link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    color: var(--pj-muted);
    background: transparent;
    border: 1px solid transparent;
    text-decoration: none;
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.pj-tabs__link i {
    font-size: 12px;
    color: var(--pj-primary);
    opacity: .75;
}

.pj-tabs__link:hover {
    color: var(--pj-primary);
    background: var(--pj-primary-soft);
}

.pj-tabs__link.active {
    color: #fff;
    background: var(--pj-primary);
    border-color: var(--pj-primary);
}

.pj-tabs__link.active i {
    color: #fff;
    opacity: 1;
}

.pj-tabs__content {
    padding-top: 18px;
}

/* Редактор разделов — Livewire-разметка не трогается, только вид */
.pj-editor {
    margin-bottom: 20px;
    counter-reset: pj-section;
}

.pj-editor h3.h3 {
    font-family: var(--pj-font-display);
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--pj-ink) !important;
}

.pj-editor h3.h3 + p {
    font-size: 13px;
    color: var(--pj-muted);
}

.pj-editor .card {
    border: 1px solid var(--pj-line);
    border-radius: var(--pj-radius);
    box-shadow: var(--pj-shadow);
}

/* Карточка раздела нумеруется — как в оглавлении работы */
.pj-editor .card.mb-3.p-0 {
    position: relative;
    counter-increment: pj-section;
}

.pj-editor .card.mb-3.p-0 > .card-body {
    padding: 18px 20px 18px 56px !important;
}

.pj-editor .card.mb-3.p-0::before {
    content: counter(pj-section, decimal-leading-zero);
    position: absolute;
    top: 26px;
    left: 20px;
    font-family: var(--pj-font-display);
    font-size: 12.5px;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--pj-primary);
}

.pj-editor .form-control {
    border-color: var(--pj-line);
    border-radius: 12px !important;
    font-size: 14.5px;
    color: var(--pj-body);
    box-shadow: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.pj-editor input.form-control {
    font-weight: 600;
    color: var(--pj-ink);
}

.pj-editor .form-control:focus {
    border-color: rgba(103, 58, 183, .5);
    box-shadow: 0 0 0 4px rgba(103, 58, 183, .1);
}

.pj-editor .btn.rounded {
    border-radius: 10px !important;
}

.pj-editor .btn-light-secondary,
.pj-editor .btn-light-danger {
    border: 1px solid transparent;
}

.pj-editor .btn-light-secondary:hover {
    color: var(--pj-primary);
    background: var(--pj-primary-soft);
}

/* Плашка «Сохранить» прилипает к низу — без острых углов, но и без тени поверх карточек */
.pj-editor .card.rounded-0 {
    border-radius: 14px 14px 0 0 !important;
    box-shadow: 0 -8px 24px -12px rgba(75, 43, 134, .25);
}

/* ---------- Паспорт в старых шаблонах типов ----------
   У каждого типа свой набор полей и своя разметка (card-body → row →
   иконка + h3.h5 + p.text-muted, списки list-group, роли колонками).
   Разметку не переписываем — оборачиваем в .pj-passport--legacy и
   перестилизуем: внутренние .card становятся прозрачными, поля получают
   вид pj-field. */

.pj-passport--legacy {
    padding-bottom: 8px;
}

.pj-passport--legacy > .card,
.pj-passport--legacy > .row > .col-12 > .card {
    margin: 0 !important;
    padding: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.pj-passport--legacy .card-body {
    padding: 18px 0 !important;
    border-bottom: 1px solid var(--pj-line);
}

.pj-passport--legacy > .card > .card-body:last-child {
    border-bottom: 0;
}

/* Вложенные card-body (сетки из нескольких полей в одном блоке) — без своих линий */
.pj-passport--legacy .card-body .card-body {
    padding: 0 !important;
    border-bottom: 0;
}

.pj-passport--legacy .row.align-items-center {
    align-items: flex-start !important;
}

.pj-passport--legacy .col-auto.text-end {
    padding-right: 0;
}

.pj-passport--legacy .col-auto > i.text-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 15px !important;
    background: var(--pj-primary-soft);
}

.pj-passport--legacy h3.h5,
.pj-passport--legacy h3.h6,
.pj-passport--legacy h4.h6 {
    margin: 0 0 5px;
    font-size: 11.5px !important;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    line-height: 1.3;
    color: var(--pj-muted);
}

.pj-passport--legacy p.text-muted,
.pj-passport--legacy p.card-text,
.pj-passport--legacy p.lh-base {
    margin: 0;
    font-size: 14.5px;
    line-height: 1.62;
    color: var(--pj-body) !important;
}

.pj-passport--legacy .list-group {
    margin-top: 2px;
}

.pj-passport--legacy .list-group-item {
    padding: 7px 0 !important;
    font-size: 14.5px;
    line-height: 1.55;
    color: var(--pj-body);
    background: transparent;
    border-color: var(--pj-line);
}

.pj-passport--legacy .list-group-item > .fa-check {
    margin-right: 6px;
    color: var(--pj-primary);
}

.pj-passport--legacy .list-group-item strong {
    color: var(--pj-ink);
}

/* Подзаголовки групп полей (бизнес-план: «Анализ рынка», «Экономика проекта») */
.pj-passport--legacy .card-header {
    padding: 22px 0 2px !important;
    border: 0;
    background: transparent !important;
}

.pj-passport--legacy .card-header h3 {
    margin: 0;
    font-family: var(--pj-font-display);
    font-size: 1.05rem !important;
    font-weight: 500;
    letter-spacing: 0;
    text-transform: none;
    color: var(--pj-ink);
}

.pj-passport--legacy .card-body.bg-light {
    background: transparent !important;
}

/* Роли, персонажи, декорации: в старой разметке подпись — узкая колонка
   слева (label.col-lg-2), описание справа. В колонке 640px подпись рвётся
   по слогам, поэтому каждая пара — карточкой, как pj-role. Без :has
   остаётся исходная двухколонная раскладка. */
.pj-passport--legacy label.col-lg-2,
.pj-passport--legacy label.col-lg-3 {
    font-size: 13.5px;
    color: var(--pj-ink);
}

.pj-passport--legacy .row:has(> label.col-lg-2),
.pj-passport--legacy .row:has(> label.col-lg-3) {
    display: block;
    margin: 0 0 10px;
    padding: 12px 14px;
    border-radius: 12px;
    background: #faf8fd;
    border: 1px solid var(--pj-line);
}

.pj-passport--legacy .row:has(> label.col-lg-2) > label,
.pj-passport--legacy .row:has(> label.col-lg-3) > label {
    display: block;
    width: 100%;
    max-width: 100%;
    margin-bottom: 3px;
    padding: 0;
    text-align: left !important;
    font-weight: 700;
}

.pj-passport--legacy .row:has(> label.col-lg-2) > label + div,
.pj-passport--legacy .row:has(> label.col-lg-3) > label + div {
    width: 100%;
    max-width: 100%;
    padding: 0;
}

.pj-passport--legacy .row:has(> label.col-lg-2) > label + div p,
.pj-passport--legacy .row:has(> label.col-lg-3) > label + div p {
    margin: 0;
    font-size: 13.5px;
    line-height: 1.5;
}

.pj-passport--legacy .text-sm {
    font-size: 14.5px;
}

/* ---------- Паспорт вкладками в старых шаблонах владельца ---------- */

.pj-tabs--legacy > .card-footer-holder,
.pj-tabs--legacy > .card.mb-4 {
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

/* Плитки фактов (тип, место, длительность) из card-footer */
.pj-tabs--legacy .card-footer {
    padding: 0 0 16px !important;
    margin-bottom: 4px;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--pj-line);
}

.pj-tabs--legacy .card-footer .fa-2x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    font-size: 15px;
    background: var(--pj-primary-soft);
}

.pj-tabs--legacy .card-footer p.text-muted {
    margin-bottom: 3px !important;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
}

.pj-tabs--legacy .card-footer p.h5 {
    font-size: 14.5px;
    font-weight: 600;
    color: var(--pj-ink) !important;
}

/* Поля в старой разметке (h5.card-title + p.lead) внутри карточки вкладок */
.pj-tabs--legacy .card-title {
    margin: 0 0 5px;
    font-size: 11.5px;
    font-weight: 700;
    letter-spacing: .07em;
    text-transform: uppercase;
    color: var(--pj-muted);
}

.pj-tabs--legacy .card-title i {
    margin-right: 4px;
}

.pj-tabs--legacy p.lead {
    font-size: 14.5px;
    line-height: 1.62;
    color: var(--pj-body);
    text-align: left;
}

.pj-tabs--legacy .nav-pills {
    display: flex;
    flex-wrap: wrap !important;
    gap: 6px;
    margin: 0 !important;
    padding: 4px 0 12px !important;
    overflow: visible !important;
    border-bottom: 1px solid var(--pj-line);
}

.pj-tabs--legacy .nav-pills .nav-link {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 8px 13px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    line-height: 1;
    color: var(--pj-muted);
    background: transparent;
    border: 1px solid transparent;
}

.pj-tabs--legacy .nav-pills .nav-link i {
    font-size: 12px;
    color: var(--pj-primary);
    opacity: .75;
}

.pj-tabs--legacy .nav-pills .nav-link:hover {
    color: var(--pj-primary);
    background: var(--pj-primary-soft);
}

.pj-tabs--legacy .nav-pills .nav-link.active {
    color: #fff;
    background: var(--pj-primary);
    border-color: var(--pj-primary);
}

.pj-tabs--legacy .nav-pills .nav-link.active i {
    color: #fff;
    opacity: 1;
}

/* Карточки — и та, что оборачивает tab-content, и те, что лежат внутри
   панелей вкладок, — становятся прозрачными: рамку даёт сама секция */
.pj-tabs--legacy .card {
    margin: 0 !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}

.pj-tabs--legacy .card-body {
    padding: 16px 0 0 !important;
    font-size: 14.5px;
    line-height: 1.62;
    color: var(--pj-body);
}

.pj-tabs--legacy .tab-content {
    font-size: 14.5px;
    line-height: 1.62;
    color: var(--pj-body);
}

.pj-tabs--legacy .tab-pane > .card > .card-body {
    padding-top: 18px !important;
}

.pj-tabs--legacy .list-group-item {
    padding: 7px 0;
    font-size: 14.5px;
    color: var(--pj-body);
    background: transparent;
    border-color: var(--pj-line);
}

.pj-tabs--legacy .list-group-item > .fa-check {
    margin-right: 6px;
    color: var(--pj-primary);
}

/* ---------- Адаптив ---------- */

@media (max-width: 1199.98px) {
    /* Конвейер на узкой колонке (до 1200px колонка уже ~600px, шесть узлов в
       ряд не читаются) — вертикальная лента */
    .pj-flow {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .pj-flow__step {
        display: grid;
        grid-template-columns: 52px minmax(0, 1fr);
        column-gap: 16px;
        align-items: start;
        padding: 0 0 22px;
        text-align: left;
    }

    .pj-flow__step:last-child {
        padding-bottom: 4px;
    }

    .pj-flow__step + .pj-flow__step::before {
        top: -22px;
        bottom: calc(100% - 4px);
        left: 25px;
        right: auto;
        width: 2px;
        height: auto;
        background: repeating-linear-gradient(180deg, rgba(255, 255, 255, .55) 0 6px, transparent 6px 12px);
        background-size: 2px 12px;
        animation-name: pj-flow-y;
    }

    .pj-flow__step + .pj-flow__step::after {
        top: -3px;
        left: 22.5px;
        right: auto;
        transform: rotate(135deg);
    }

    .pj-flow__body {
        padding-top: 4px;
    }

    /* Сверху над кружком приходит стрелка связи — метку уводим вниз */
    .pj-flow__badge {
        top: auto;
        bottom: -7px;
        right: -14px;
    }

    .pj-flow__num {
        display: inline;
        margin: 0 8px 0 0;
    }

    .pj-flow__name {
        display: inline;
        font-size: 14.5px;
    }

}

@media (max-width: 991.98px) {
    .pj-agents__notes {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 767.98px) {
    .pj-hero,
    .pj-agents,
    .pj-passport {
        padding-left: 20px;
        padding-right: 20px;
    }

    .pj-hero {
        padding-top: 24px;
        padding-bottom: 24px;
    }

    .pj-hero__lead {
        font-size: .98rem;
    }

    .pj-facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
    }

    .pj-agents__count {
        display: none;
    }

    .pj-passport__grid,
    .pj-roles {
        grid-template-columns: 1fr;
    }

    /* Короткие поля в один ряд (предмет, класс…) на телефоне идут столбиком */
    .pj-passport--legacy .row > .col-auto + .col-auto,
    .pj-passport--legacy .row > .col-12 + .col-12 {
        margin-top: 12px;
    }

    .pj-passport {
        padding-top: 22px;
    }

    .pj-tabs {
        padding-left: 20px;
        padding-right: 20px;
    }

    .pj-editor .card.mb-3.p-0 > .card-body {
        padding-left: 44px !important;
    }

    .pj-editor .card.mb-3.p-0::before {
        left: 14px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .pj-flow__step + .pj-flow__step::before,
    .pj-hero__pulse {
        animation: none;
    }
}
