/* #ADG: Стили сценариев заявок изолированы от общего каркаса портала. */
/* Service Desk */

.ticket-kcs-body {
    display: grid;
    gap: 20px;
}

.ticket-kcs-section {
    display: grid;
    gap: 8px;
}

.ticket-kcs-section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ticket-kcs-section-heading h3,
.ticket-kcs-capture h3 {
    margin: 0;
    font-size: 15px;
}

.ticket-kcs-section-heading span {
    color: var(--muted-text);
    font-size: 12px;
}

.ticket-kcs-item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    padding: 10px;
    border: 1px solid var(--line-color);
    border-radius: 6px;
    background: var(--panel-bg);
}

.ticket-kcs-item.is-used {
    border-left: 3px solid var(--success-color, #2f7d32);
}

.ticket-kcs-item a {
    display: grid;
    min-width: 0;
    gap: 3px;
    color: inherit;
    text-decoration: none;
}

.ticket-kcs-item a:hover strong { text-decoration: underline; }
.ticket-kcs-item small { color: var(--muted-text); }

.ticket-kcs-capture {
    display: grid;
    gap: 8px;
    padding: 12px;
    border-radius: 6px;
    background: var(--soft-bg, #f5f8f4);
}

.ticket-kcs-capture p,
.ticket-kcs-capture small { margin: 0; color: var(--muted-text); }
.ticket-workspace,
.ticket-project-management,
.ticket-details-grid {
    display: grid;
    gap: 12px;
    align-items: start;
}

.ticket-workspace {
    grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
}

.ticket-project-management {
    grid-template-columns: minmax(260px, .8fr) minmax(360px, 1.2fr);
}

.ticket-details-grid {
    grid-template-columns: minmax(0, 1fr) minmax(230px, 280px);
}

.ticket-summary-card {
    align-self: start;
    position: sticky;
    top: 52px;
    padding: 14px 16px;
}

.ticket-summary-card h2 {
    margin: 0 0 11px;
    color: var(--color-ink);
    font-size: .9rem;
}

.ticket-summary-card dl {
    display: grid;
    gap: 0;
    margin: 0;
}

.ticket-summary-card dl > div {
    display: grid;
    gap: 3px;
    padding: 9px 0;
    border-top: 1px solid var(--color-line);
}

.ticket-summary-card dt {
    color: var(--color-muted);
    font-size: .68rem;
    line-height: 1.2;
}

.ticket-summary-card dd {
    min-width: 0;
    margin: 0;
    overflow-wrap: anywhere;
    color: var(--color-ink);
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.35;
}

.ticket-summary-card dd.is-empty {
    color: #a33a2c;
}

.ticket-summary-card a {
    color: var(--color-brand-dark);
    text-decoration: none;
}

.ticket-summary-card a:hover,
.ticket-summary-card a:focus-visible {
    text-decoration: underline;
}

/* Сводка входит в закреплённую шапку: основное содержимое и обсуждение ниже
   используют всю ширину рабочей области. */
.ticket-detail-heading > .ticket-summary-top {
    grid-column: 1 / -1;
    position: static;
    display: block;
    align-items: stretch;
    width: 100%;
    padding: 0;
    border: 0;
    border-top: 1px solid var(--color-line);
    border-radius: 0;
    background: var(--color-surface);
    box-shadow: none;
}

.ticket-detail-heading > .ticket-summary-top dl {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0;
    min-width: 0;
}

.ticket-detail-heading > .ticket-summary-top dl > div {
    align-content: start;
    flex: 1 1 0;
    min-width: 110px;
    padding: 6px 12px;
    border-top: 0;
    border-left: 1px solid var(--color-line);
}

.ticket-detail-heading > .ticket-summary-top dl > div:first-child {
    border-left: 0;
}
.ticket-detail-heading > .ticket-summary-top dl > div:first-child,
.ticket-detail-heading > .ticket-summary-top dl > div:nth-child(2),
.ticket-detail-heading > .ticket-summary-top dl > div:last-child {
    flex: 0 1 155px;
    padding-right: 6px;
}
.ticket-action-rail.ticket-attachments-rail.has-attachments {
    color: #237b43;
    background: #e8f5eb;
    border-color: #84bc94;
}
html[data-theme="dark"] .ticket-action-rail.ticket-attachments-rail.has-attachments {
    color: #9adead;
    background: #203c2d;
    border-color: #527f60;
}

/* #ADG: редакторы не сжимаются до ширины обычного текста; поля переносятся
   целиком без обрезания выпадающего списка исполнителей. */
.ticket-detail-heading > .ticket-summary-top dl > .ticket-summary-status {
    min-width: 170px;
}

.ticket-detail-heading > .ticket-summary-top dl > .ticket-summary-status:has(.estimate-decision) {
    min-width: 220px;
}

.ticket-detail-heading > .ticket-summary-top dl > .ticket-summary-assignees {
    flex-grow: 1.5;
    min-width: 220px;
}

.ticket-summary-status .ticket-quick-status {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.ticket-detail-heading > .ticket-summary-top dt {
    font-size: .62rem;
}

.ticket-detail-heading > .ticket-summary-top dd {
    overflow: hidden;
    font-size: .7rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-detail-heading > .ticket-summary-top .ticket-summary-editable {
    padding: 4px 8px;
}

/* #ADG: эти ячейки содержат и редакторы, и обычный текст при доступе только
   на чтение. При видимом overflow запрет переноса выводил название на соседнее
   поле; разрешаем перенос, сохраняя видимость фокуса и элементов редактора. */
.ticket-detail-heading > .ticket-summary-top .ticket-summary-editable dd {
    overflow: visible;
    white-space: normal;
}

.ticket-summary-assignees .ticket-assignee-chip {
    min-width: 0;
    white-space: normal;
}

.ticket-summary-assignees .ticket-assignee-chip > span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.ticket-summary-assignees .ticket-assignee-chip > button {
    flex-shrink: 0;
}

.ticket-summary-editable select,
.ticket-summary-editable .searchable-choice-field,
.ticket-summary-editable .original-development-picker {
    width: 100%;
    min-width: 0;
}

.content .ticket-summary-editable select,
.content .ticket-summary-editable input {
    height: 27px;
    min-height: 27px;
    padding: 3px 6px;
    border: 1px solid transparent;
    border-radius: 3px;
    background: transparent;
    font-size: .7rem;
    font-weight: 600;
}

.content .ticket-summary-editable select:hover,
.content .ticket-summary-editable select:focus,
.content .ticket-summary-editable input:hover,
.content .ticket-summary-editable input:focus {
    border-color: var(--color-line-strong);
    background: var(--color-surface, #fff);
}

.ticket-return-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 12px;
    color: var(--color-brand-dark);
    font-size: .82rem;
    font-weight: 700;
    text-decoration: none;
}

.ticket-return-link:hover,
.ticket-return-link:focus-visible {
    color: var(--color-brand);
    text-decoration: underline;
}

.ticket-project-tree {
    padding: 8px;
}

.ticket-project-row {
    width: 100%;
    min-height: 36px;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 0;
    border-radius: 4px;
    background: transparent;
    color: var(--ink, #172316);
    font: inherit;
    font-size: .84rem;
    text-align: left;
    cursor: pointer;
}

.ticket-project-row:hover,
.ticket-project-row.is-selected {
    background: #edf6eb;
    color: #215b23;
}

.ticket-project-row small {
    margin-left: auto;
    color: #71806e;
    font-size: .76rem;
}

.ticket-filter-bar,
.inline-action {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e9de;
}

.ticket-filter-bar input {
    flex: 1 1 240px;
}

.ticket-filter-bar select,
.inline-action select {
    min-width: 150px;
}

.ticket-table-head,
.ticket-table-row {
    display: grid;
    grid-template-columns: minmax(260px, 2fr) minmax(150px, 1fr) 140px 150px 150px;
    gap: 0;
}

.ticket-table-head {
    padding: 9px 12px;
    color: #63715f;
    border-bottom: 1px solid #dce5d8;
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.ticket-table-row {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid #e6ece3;
}

.ticket-table-row:hover {
    background: #f8f9fd;
}

.ticket-table-row > span {
    min-height: 58px;
    padding: 9px 12px;
    border-right: 1px solid #edf1ea;
    font-size: .86rem;
}

.ticket-table-row strong,
.ticket-title {
    display: block;
}

.ticket-title {
    margin-top: 2px;
    color: #263426;
    font-weight: 600;
}

.ticket-table-row small {
    display: block;
    margin-top: 3px;
    color: #758273;
    font-size: .72rem;
}

.ticket-status,
.ticket-watchers span {
    display: inline-block;
    border: 1px solid #cfe2c9;
    border-radius: 12px;
    padding: 3px 8px;
    background: #f0f8ed;
    color: #245c27;
    font-size: .75rem;
    font-weight: 600;
}

.status-waitingforuser { background: #fff8e9; border-color: #f1d78e; color: #805a00; }
.status-resolved,
.status-closed { background: #f3f4f3; border-color: #d8dfd7; color: #596457; }

.ticket-content-panel,
.ticket-side-panel,
.ticket-project-editor {
    padding: 16px;
}

.ticket-description {
    position: relative;
    line-height: 1.65;
}

/* Длинное описание сокращается визуально, но остаётся HTML: выделение, ссылки,
   списки и переносы сохраняются. Размер совпадает со значениями в сводке. */
.ticket-description > .ticket-content-preview {
    display: block;
    max-height: 3.9em;
    overflow: hidden;
    color: var(--color-ink);
    font-size: .7rem;
    line-height: 1.3;
}

.ticket-description > .ticket-content-preview > :first-child { margin-top: 0; }
.ticket-description > .ticket-content-preview > :last-child { margin-bottom: 0; }
.ticket-description > .ticket-content-preview p,
.ticket-description > .ticket-content-preview ul,
.ticket-description > .ticket-content-preview ol { margin-block: 0 .3em; }
/* #ADG: действие описания занимает собственную строку слева, не перекрывая
   HTML и не наследуя малозаметное абсолютное троеточие комментариев. */
.ticket-description > .ticket-description-toggle {
    display: inline-flex;
    margin-top: 6px;
    max-width: 100%;
    white-space: normal;
    text-align: left;
}
.ticket-description > .ticket-description-toggle:focus-visible {
    outline: 2px solid var(--color-brand);
    outline-offset: 2px;
}
.ticket-content-toggle,
.ticket-content-collapse {
    border: 0;
    background: transparent;
    color: var(--color-brand);
    cursor: pointer;
    font: inherit;
    font-weight: 700;
}
.ticket-content-toggle {
    position: absolute;
    right: 0;
    bottom: 0;
    min-width: 28px;
    padding: 0 5px 3px;
    border-radius: 5px;
    background: #fff;
    font-size: 1.15rem;
    line-height: 1;
}
.ticket-content-toggle:hover,
.ticket-content-toggle:focus-visible { background: #eeeafd; outline: none; }
.ticket-content-collapse { display: block; margin-top: 5px; padding: 2px 0; font-size: .75rem; }

/* #ADG Заголовок переписки объединяет действия импорта с лентой без лишней панели. */
.ticket-discussion-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ticket-discussion-heading h2 {
    margin: 0;
}

.ticket-comment-sort {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    color: #68766b;
    font-size: 0.82rem;
    font-weight: 500;
    white-space: nowrap;
}

.ticket-comment-sort select {
    min-height: 32px;
    padding: 4px 28px 4px 8px;
}

.ticket-comments {
    align-items: stretch;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.ticket-comment {
    align-self: flex-start;
    box-sizing: border-box;
    position: relative;
    width: fit-content;
    max-width: min(78%, 920px);
    padding: 10px 12px 11px;
    border: 1px solid #e1ddf0;
    border-left: 3px solid #7669be;
    border-radius: 5px 12px 12px 12px;
    background: #f9f8fd;
    color: #29253c;
}

/* #ADG Метаданные сообщения собраны в одну офисную строку. Дата прижимается
   вправо, но на узком экране переносится целиком и не перекрывает автора. */
.ticket-comment-meta {
    align-items: center;
    display: flex;
    gap: 7px;
    min-width: 0;
}

.ticket-comment-meta > strong {
    color: #302a4a;
    font-size: .82rem;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-comment-avatar {
    align-items: center;
    background: #ebe8f8;
    border: 1px solid #d7d1ee;
    border-radius: 6px;
    color: #5b4ba1;
    display: inline-flex;
    flex: 0 0 26px;
    font-size: .66rem;
    font-weight: 600;
    height: 26px;
    justify-content: center;
    letter-spacing: .02em;
}

.ticket-comment-meta time {
    color: #817b91;
    display: inline;
    flex: 0 0 auto;
    font-size: .7rem;
    font-variant-numeric: tabular-nums;
    margin: 0 0 0 auto;
    white-space: nowrap;
}

.ticket-comment-body {
    line-height: 1.5;
    margin: 7px 0 0 33px;
}

/* #ADG: цитата остаётся различимой и в сохранённом сообщении, где служебные
   атрибуты редактора удаляются серверной очисткой HTML. */
.ticket-comment-body blockquote,
.ticket-comment-editor-surface blockquote {
    border-left: 3px solid #a99bcf;
    color: #5f5874;
    margin: 6px 0;
    padding: 4px 10px;
    white-space: pre-wrap;
}

.ticket-comment-body blockquote p,
.ticket-comment-editor-surface blockquote p { margin: 3px 0 0; }

.ticket-comment-body-preview { white-space: pre-wrap; }
.ticket-comment:not(.ticket-system-comment) > .ticket-content-toggle {
    margin-left: 28px;
    vertical-align: bottom;
}
.ticket-comment:not(.ticket-system-comment) > .ticket-content-collapse { margin-left: 33px; }

.ticket-comment-body > :first-child {
    margin-top: 0;
}

.ticket-comment-body > :last-child {
    margin-bottom: 0;
}

/* #ADG: восстановление Blazor-соединения выполняется полностью в фоне. */
#components-reconnect-modal {
    display: none !important;
}

/* #ADG: внутренние заметки визуально отличаются от клиентской переписки,
   чтобы сотрудник не отправил закрытую информацию в обычный комментарий по ошибке. */
.ticket-internal-comment {
    border-left-color: #c58a20;
    background: #fff9eb;
}

.ticket-internal-comment-label {
    display: inline-flex;
    margin-left: 8px;
    padding: 2px 6px;
    border-radius: 999px;
    background: #f4e2b9;
    color: #714b08;
    font-size: .7rem;
    font-weight: 700;
}

/* #ADG Внешняя разметка Planfix не должна расширять карточку заявки за границы рабочей области. */
.ticket-content-panel,
.ticket-description,
.ticket-comment {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
}

/* #ADG: входной HTML может содержать inline white-space:nowrap. Принудительный перенос
   текстовых блоков сохраняет композер и кнопку отправки внутри карточки. */
#ticket-description-content :where(p, div, span, pre, code),
.ticket-comment-body :where(p, div, span, pre, code) {
    max-width: 100%;
    white-space: pre-wrap !important;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.ticket-description img,
.ticket-comment img {
    display: block;
    width: auto !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 680px;
    margin: 8px 0;
    object-fit: contain;
}

/* #ADG: комментарии текущего пользователя выравниваются как исходящие сообщения чата. */
.ticket-comment-own {
    align-self: flex-end;
    border-color: #d8d2ed #6557af #d8d2ed #d8d2ed;
    border-left-width: 1px;
    border-right-width: 3px;
    border-radius: 12px 4px 12px 12px;
    background: #f2f0fa;
}

.ticket-comment-own.ticket-internal-comment {
    border-color: #dfc182 #c58a20 #dfc182 #dfc182;
    background: #fff9eb;
}

.ticket-comment-own .ticket-comment-meta {
    padding-right: 64px;
}

.ticket-comment:has(.ticket-comment-action-analytics) .ticket-comment-meta {
    padding-right: 36px;
}

.ticket-comment-own:has(.ticket-comment-action-analytics) .ticket-comment-meta {
    padding-right: 94px;
}

.ticket-comment-actions {
    align-items: center;
    background: rgba(255, 255, 255, .94);
    border: 1px solid #ddd8ef;
    border-radius: 7px;
    box-shadow: 0 3px 10px rgba(48, 36, 95, .1);
    display: inline-flex;
    gap: 2px;
    opacity: 0;
    padding: 2px;
    pointer-events: none;
    position: absolute;
    right: 8px;
    top: 7px;
    transform: translateY(-2px);
    transition: opacity .14s ease, transform .14s ease;
    visibility: hidden;
    z-index: 2;
}

/* #ADG: действия не утяжеляют переписку, но остаются доступны с клавиатуры
   и на устройствах без наведения. */
.ticket-comment:hover .ticket-comment-actions,
.ticket-comment:focus-within .ticket-comment-actions {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
    visibility: visible;
}

.ticket-comment-action {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 5px;
    color: #625a78;
    cursor: pointer;
    display: inline-flex;
    height: 26px;
    justify-content: center;
    min-height: 26px;
    padding: 0;
    width: 26px;
}

.ticket-comment-action:hover,
.ticket-comment-action:focus-visible {
    background: #eeeafd;
    color: #49389a;
    outline: none;
}

.ticket-comment-action:focus-visible {
    box-shadow: 0 0 0 2px rgba(78, 59, 166, .2);
}

.ticket-comment-action-danger:hover,
.ticket-comment-action-danger:focus-visible {
    background: #fff0f0;
    color: #a33a3a;
}

@media (hover: none), (pointer: coarse) {
    .ticket-comment-actions {
        /* #ADG: на сенсорном экране действия видны постоянно и не закрывают дату сообщения. */
        position: static;
        margin: 4px 0 0 auto;
        width: max-content;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        visibility: visible;
    }
}

.ticket-comment-editing-banner {
    align-items: center;
    background: #eef7ec;
    border: 1px solid #cfe0ca;
    border-radius: 5px;
    color: var(--color-brand-dark);
    display: flex;
    font-size: .78rem;
    justify-content: space-between;
    margin-bottom: 8px;
    padding: 6px 9px;
}

.ticket-comment-editing-banner button {
    background: transparent;
    border: 0;
    color: var(--color-brand-dark);
    cursor: pointer;
    text-decoration: underline;
}

@media (max-width: 700px) {
    .ticket-comment {
        max-width: 92%;
    }
}

/* #ADG: вместо неясного значка битой картинки показываем читаемое состояние ошибки. */
.ticket-description img.ticket-inline-image-unavailable,
.ticket-comment img.ticket-inline-image-unavailable {
    box-sizing: border-box;
    width: min(100%, 620px) !important;
    min-height: 52px;
    padding: 14px 16px;
    border: 1px dashed #c8a34f;
    border-radius: 5px;
    background: #fff9e8;
    color: #755817;
    font-size: 0.86rem;
    object-fit: none;
}

.ticket-description table,
.ticket-comment table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
}

/* #ADG Табличная аналитика заявок: компактная офисная таблица без вложенных карточек. */
.ticket-analytics-panel { margin-top: 16px; }
.ticket-analytics-group + .ticket-analytics-group { border-top: 1px solid var(--border-color, #dfe5db); margin-top: 14px; padding-top: 14px; }
.ticket-analytics-group-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.ticket-analytics-group-heading h3 { margin: 0; font-size: 14px; }
.ticket-analytics-group-link { display: grid; width: 100%; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px 10px; border: 1px solid transparent; border-radius: 5px; background: transparent; color: #273128; cursor: pointer; font: inherit; text-align: left; transition: background-color .16s ease, border-color .16s ease, color .16s ease; }
.ticket-analytics-group-link:hover, .ticket-analytics-group-link:focus-visible { border-color: #c9dfc4; background: #f4faf2; color: #246321; outline: 0; }
.ticket-analytics-group-link strong { display: block; font-size: 14px; }
.ticket-analytics-group-link small { display: block; margin-top: 3px; color: #758273; font-size: 12px; }
.ticket-analytics-group-link .oi { color: #5f745c; font-size: 12px; }
.ticket-analytics-table-wrap { overflow-x: auto; }
.ticket-analytics-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ticket-analytics-table th, .ticket-analytics-table td { padding: 8px 10px; border: 1px solid #e1e7dd; text-align: left; vertical-align: top; }
.ticket-analytics-table th { background: #f5f8f3; font-size: 11px; color: #68708a; text-transform: uppercase; }
.modal-panel-analytics {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 100%;
    height: 100%;
    max-height: 100%;
    min-width: min(420px, 100%);
    min-height: min(320px, 100%);
    overflow: hidden;
    resize: both;
}
.ticket-analytics-viewer-position { display:flex; align-items:center; justify-content:center; width:100%; height:100%; max-width:100%; max-height:100%; }
.modal-heading-actions { display: flex; align-items: center; gap: 10px; }
.modal-heading-note { margin: 4px 0 0; color: #758273; font-size: 13px; }
.modal-panel-analytics > .modal-heading { flex: 0 0 auto; }
.ticket-analytics-viewer-heading { cursor: move; touch-action: none; user-select: none; }
.modal-panel-analytics.is-dragging, .modal-panel-analytics.is-dragging .ticket-analytics-viewer-heading { cursor: grabbing; }
.ticket-analytics-viewer-heading button { cursor: pointer; }
.ticket-analytics-viewer-heading .ticket-analytics-maximize {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    width: 28px;
    height: 28px;
    min-height: 28px;
    padding: 0;
}
.ticket-analytics-maximize:hover:not(:disabled) {
    background: var(--color-surface-muted);
    border-color: var(--color-brand-line);
    color: var(--color-brand-dark);
}
.ticket-analytics-viewer-heading { flex-wrap: wrap; gap: 8px; }
.ticket-analytics-viewer-heading > div { min-width: 0; max-width: 100%; }
.ticket-analytics-viewer-heading h2 { overflow-wrap: anywhere; }
.ticket-analytics-viewer-heading .modal-heading-actions { flex-wrap: wrap; margin-left: auto; }
/* #ADG У окна аналитики только одна вертикальная прокрутка. Страница под модальным
   окном и таблица больше не создают собственные конкурирующие полосы прокрутки. */
body:has(.ticket-analytics-viewer-backdrop) { overflow: hidden; }
/* #ADG: полноэкранный просмотр должен находиться выше общего backdrop боковой
   панели заявки (1200), иначе видимые кнопки просмотра фактически перекрываются
   невидимым слоем drawer и клик закрывает аналитику вместо открытия редактора. */
.modal-backdrop-panel.ticket-analytics-viewer-backdrop {
    /* Окно таблицы живёт внутри правой рабочей поверхности карточки и не
       перекрывает изменяемый по ширине список заявок слева. */
    inset: 0;
    padding: 8px;
    overflow: hidden;
    pointer-events: auto;
    z-index: 1250;
}
.modal-backdrop-panel.ticket-analytics-editor-backdrop { z-index: 1300; }
@media (max-width: 900px) {
    .modal-backdrop-panel.ticket-analytics-viewer-backdrop { inset:8px; padding:0; }
    .modal-panel-analytics { min-width:min(320px, 100%); min-height:min(280px, 100%); }
}
.ticket-analytics-modal-body {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 12px;
}
.ticket-analytics-table-wrap-large {
    max-height: none;
    overflow-y: hidden;
    border: 1px solid #dfe5db;
    border-radius: 5px;
}
.ticket-analytics-table-wrap-large .ticket-analytics-table { width: 100%; min-width: 100%; table-layout: auto; }
.ticket-analytics-table-wrap-large .ticket-analytics-table th,
.ticket-analytics-table-wrap-large .ticket-analytics-table td { min-width: 125px; max-width: 340px; padding: 5px 7px; overflow-wrap: anywhere; }
.ticket-analytics-modal-body .ticket-analytics-table tbody { font-size: 12px; line-height: 1.2; }
.ticket-analytics-modal-body .ticket-analytics-table th { padding-top: 5px; padding-bottom: 5px; font-size: 10px; line-height: 1.15; }
.ticket-analytics-table-wrap-large .ticket-analytics-table :is(th,td).ticket-analytics-comment-cell {
    width: auto;
    min-width: 280px;
    max-width: none;
}
.ticket-analytics-table-wrap-large .ticket-analytics-table :is(th,td).ticket-analytics-sized-cell {
    box-sizing: border-box; width: var(--analytics-column-width); min-width: var(--analytics-column-width); max-width: var(--analytics-column-width);
}
.content .ticket-analytics-table .ticket-analytics-sized-cell :is(.ticket-analytics-inline-editor,.searchable-choice-field) { min-width: 0; }
.ticket-analytics-cell-preview {
    display: block;
    overflow-wrap: anywhere;
}
.ticket-analytics-inline-editor { box-sizing:border-box; min-height:28px; min-width:100px; padding:3px 26px 3px 7px; width:100%; }
.ticket-analytics-inline-textarea { min-width:240px; line-height:1.4; height:calc(4.2em + 8px); min-height:calc(4.2em + 8px); overflow-y:auto; padding-right:7px; resize:vertical; }
.ticket-analytics-inline-choice { padding:0; }
.ticket-analytics-inline-choice .searchable-choice-field { min-width:180px; }
.ticket-analytics-inline-choice .searchable-choice-field input { min-height:28px; width:100%; }
.ticket-analytics-inline-time-range { grid-template-columns:max-content 12px max-content; gap:4px; min-width:190px; width:max-content; }
.ticket-analytics-inline-time-range .five-minute-time-input select { min-height:28px; }
/* #ADG Текст аналитики является рабочими данными, поэтому таблица показывает его
   полностью и увеличивает высоту строки вместо визуального обрезания. */
.ticket-analytics-comment-cell .ticket-analytics-cell-preview {
    display: block;
    overflow: visible;
    white-space: pre-wrap;
    line-height: 1.25;
}
.ticket-analytics-table-wrap-large .ticket-analytics-table th.ticket-analytics-actions-cell,
.ticket-analytics-table-wrap-large .ticket-analytics-table td.ticket-analytics-actions-cell { min-width: 92px; width: 92px; max-width: 92px; padding:5px 6px; }
.ticket-analytics-actions-cell { white-space: nowrap; }
.ticket-analytics-row-actions { display:flex; align-items:center; justify-content:flex-start; gap:4px; }
.ticket-analytics-row-actions .ticket-analytics-action-button { width:24px; min-width:24px; height:24px; min-height:24px; padding:0; border-radius:4px; font-size:11px; }
.ticket-analytics-action-button:hover { border-color:var(--color-brand-line); background:var(--color-brand-soft); color:var(--color-brand-dark); }
.ticket-analytics-action-confirm { background:#f1efff; border-color:#cfc8f2; color:var(--color-brand); }
.ticket-analytics-action-danger:hover { border-color:#efc3c3; background:#fff2f2; color:#a32828; }
/* #ADG Итог времени отделён от прокручиваемой таблицы и всегда остаётся читаемым. */
.ticket-analytics-duration-summary {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 8px 18px;
    min-height: 42px;
    margin-top: 10px;
    padding: 8px 12px;
    border: 1px solid #d5e2d1;
    border-radius: 5px;
    background: #f6faf4;
    color: #344332;
    font-size: 13px;
}
.ticket-analytics-duration-title { margin-right: auto; color: #68708a; font-size: 11px; font-weight: 700; text-transform: uppercase; }
.ticket-analytics-duration-item { display: inline-flex; align-items: baseline; gap: 7px; color: #6b7868; }
.ticket-analytics-duration-item strong { color: #245f22; font-size: 15px; }
/* ADG, ООО «Ай-Технолоджис Групп»: в аналитике заявки сначала выбирают тип,
   поэтому панель не разрастается пустыми секциями всех доступных аналитик. */
.ticket-analytics-toolbar { display:flex; align-items:flex-start; justify-content:space-between; gap:12px; padding:0 0 12px; margin-bottom:12px; border-bottom:1px solid #dfe5db; }
.ticket-analytics-toolbar strong { display:block; font-size:14px; color:#273128; }
.ticket-analytics-toolbar p { margin:4px 0 0; color:#71806f; font-size:12px; line-height:1.4; }
.ticket-analytics-type-picker { display:grid; grid-template-columns:minmax(0, 1fr) 72px; align-items:end; gap:8px; padding:10px; margin:0 0 14px; border:1px solid #dfe5db; border-radius:5px; background:#f8f9fd; }
.ticket-analytics-type-picker label { display:grid; min-width:0; gap:5px; margin:0; color:#52634f; font-size:12px; font-weight:600; }
.ticket-analytics-type-picker select { width:100%; min-width:0; min-height:34px; }
.ticket-analytics-type-picker .secondary-button { width:72px; min-width:72px; margin:0; white-space:nowrap; }
.analytics-type-form { grid-template-columns:minmax(0, 1fr); gap:14px; }
.analytics-checkbox-row { display:grid; grid-template-columns:minmax(0, 1fr) 48px; align-items:center; min-height:38px; margin:0; padding:0 10px; border:1px solid #dfe5db; border-radius:5px; color:#273128; font-size:13px; font-weight:600; }
.analytics-field-editor { display:grid; grid-column:1 / -1; gap:8px; border:1px solid #dfe5db; border-radius:5px; padding:12px; }
.analytics-field-editor > .panel-heading { min-height:30px; }
.analytics-type-modal { width: min(1560px, calc(100vw - 32px)); max-width: calc(100vw - 32px); }
.analytics-type-modal .analytics-field-editor { overflow-x: auto; }
.analytics-type-modal .analytics-field-row {
    display:grid;
    grid-template-areas: "field-name field-type field-source field-default field-requirement field-delete";
    grid-template-columns:minmax(160px, 1fr) 150px minmax(160px, 1fr) minmax(220px, 1.2fr) 432px 32px;
    min-width: 1240px;
    gap:8px;
    align-items:center;
    padding:8px 0;
    border-top:1px solid #edf1ea;
}
.analytics-field-row > :nth-child(1) { grid-area:field-name; }
.analytics-field-row > :nth-child(2) { grid-area:field-type; }
.analytics-field-row > :nth-child(3) { grid-area:field-source; }
.analytics-field-row > :nth-child(4) { grid-area:field-default; }
.analytics-field-row > :nth-child(5) { grid-area:field-requirement; }
.analytics-field-row > :nth-child(6) { grid-area:field-delete; }
.analytics-type-modal .analytics-field-requirement .analytics-checkbox-row {
    display:flex; flex:0 0 144px; min-width:144px; height:38px; min-height:38px;
    align-items:center; justify-content:space-between; gap:6px; padding:0 6px;
    margin:0; font-size:12px; font-weight:400; white-space:nowrap; box-sizing:border-box;
}
.analytics-type-modal .analytics-field-requirement .analytics-checkbox-row > input[type="checkbox"] {
    flex:0 0 42px; width:42px; min-width:42px; height:24px; min-height:24px; margin:0;
}
.analytics-field-requirement { position:relative; display:flex; align-items:center; gap:8px; min-width:205px; }
.analytics-project-overrides { flex:0 0 auto; }
.analytics-project-overrides summary { color:var(--color-brand); cursor:pointer; font-size:12px; white-space:nowrap; }
.analytics-project-overrides[open] { z-index:30; }
.analytics-project-overrides > small { display:block; margin:5px 0; color:var(--color-muted); line-height:1.25; }
.analytics-project-overrides[open] > small,
.analytics-project-overrides[open] > .analytics-project-overrides-list { position:absolute; right:0; width:300px; box-sizing:border-box; background:var(--color-surface); }
.analytics-project-overrides[open] > small { top:42px; z-index:31; margin:0; padding:9px 10px 5px; border:1px solid var(--color-brand-line); border-bottom:0; border-radius:7px 7px 0 0; }
.analytics-project-overrides[open] > .analytics-project-overrides-list { top:73px; z-index:31; border-radius:0 0 7px 7px; box-shadow:0 12px 28px rgba(44,34,92,.16); }
.analytics-project-overrides-list { display:grid; gap:2px; max-height:220px; overflow:auto; padding:5px; border:1px solid var(--color-brand-line); border-radius:7px; background:var(--color-surface); }
.analytics-project-override-option { align-items:center; background:transparent; border:0; border-radius:5px; color:var(--color-ink); display:flex; font-size:12px; font-weight:400; gap:10px; justify-content:space-between; line-height:1.25; min-height:32px; padding:6px 9px; text-align:left; width:100%; }
.analytics-project-override-option:hover { background:var(--color-surface-muted); }
.analytics-project-override-option.is-selected { background:var(--color-brand-soft); color:var(--color-brand-dark); font-weight:600; }
.analytics-project-override-option .oi { color:var(--color-brand); flex:0 0 auto; font-size:10px; }
.analytics-field-default { display:grid; gap:4px; min-width:0; }
.analytics-default-dynamic { display:flex; align-items:center; gap:6px; min-height:20px; font-size:12px; color:var(--muted-text); }
.analytics-default-dynamic > input[type="checkbox"] { flex:0 0 16px; display:block; width:16px; height:16px; min-height:0; margin:0; padding:0; accent-color:#1e07aa; }
.analytics-default-time-range { display:flex; align-items:center; gap:4px; }
.analytics-default-time-range input { min-width:0; width:100%; }
.analytics-system-classifier-note { display:flex; align-items:center; min-height:38px; padding:0 12px; border:1px solid #dfe5db; border-radius:5px; color:#687365; background:#f7f9f5; font-size:13px; }
.analytics-field-row:first-of-type { border-top: 0; }
.analytics-field-default { min-height:38px; }
.analytics-field-requirement { min-height:38px; justify-self:end; }
@media (max-width: 800px) {
    .analytics-field-row { display:grid; grid-template-areas:none; grid-template-columns:1fr; }
    .analytics-field-row > :nth-child(n) { grid-area:auto; }
    .analytics-field-requirement { justify-self:stretch; }
}

.ticket-comment-meta time {
    display: inline;
    margin: 0 0 0 auto;
    color: #758273;
    font-size: .7rem;
}

.ticket-comment-meta .ticket-internal-comment-label {
    margin-left: 0;
}

.ticket-comment-form {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

/* #ADG Нижний композер оставляет ленту свободной и раскрывается только во время подготовки ответа. */
.ticket-content-panel {
    display: flex;
    flex-direction: column;
    min-height: calc(100vh - 190px);
}

.ticket-comment-composer {
    position: sticky;
    bottom: 0;
    z-index: 4;
    margin: auto -1px -1px;
    padding: 10px;
    border: 1px solid var(--color-line);
    border-radius: 6px 6px 0 0;
    background: #fff;
    box-shadow: 0 -8px 18px rgba(38, 61, 35, .06);
}

.ticket-notification-recipients {
    min-height: 46px;
    margin-bottom: 8px;
    padding: 8px 10px;
    border: 1px solid #e2def5;
    border-radius: 8px;
    background: #faf9ff;
}

.ticket-recipient-line,
.ticket-recipient-choices,
.ticket-recipient-add {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.ticket-recipient-line { min-height: 30px; }
.ticket-recipient-caption {
    flex: 0 0 auto;
    color: #77708f;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.ticket-recipient-choices { flex: 1 1 320px; min-width: 0; }
.ticket-recipient-choice-wrap { position: relative; display: inline-flex; align-items: center; }

/* #ADG: удаление дополнительного получателя входит в общий контур чипа,
   чтобы крестик не выглядел случайным символом за его границей. */
.ticket-recipient-choice-wrap:has(.ticket-notification-remove) {
    overflow: hidden;
    border: 1px solid #d4e4d1;
    border-radius: 14px;
    background: #f6fbf5;
}

.ticket-recipient-choice-wrap:has(.ticket-notification-remove):has(.ticket-notification-chip.is-selected) {
    border-color: #6550d8;
    background: #ece9ff;
    box-shadow: inset 0 0 0 1px rgba(30, 7, 170, .12);
}

.ticket-recipient-choice-wrap:has(.ticket-notification-remove) .ticket-notification-chip {
    border: 0;
    border-radius: 13px 0 0 13px;
    box-shadow: none;
}
.ticket-recipient-add {
    flex: 0 0 auto;
    margin-left: auto;
    margin-right: 24px;
    padding-left: 8px;
    border-left: 1px solid #e2def5;
    position: relative;
}
.ticket-analytics-table-type-select {
    display: grid;
    grid-template-columns: auto minmax(220px, 420px);
    align-items: center;
    justify-content: start;
    gap: 10px;
    margin-bottom: 12px;
    color: #68708a;
    font-size: 12px;
    font-weight: 600;
}
.ticket-analytics-table-type-select select { min-height: 34px; }
.ticket-analytics-empty-table {
    display: grid;
    min-height: 300px;
    place-items: center;
    align-content: center;
    gap: 8px;
    border: 1px dashed #d8d2ed;
    border-radius: 7px;
    background: #faf9ff;
    color: #756d8d;
    text-align: center;
}
.ticket-analytics-empty-table > .oi { color: #6550d8; font-size: 30px; }
.ticket-analytics-empty-table strong { color: #352d57; font-size: 15px; }
.ticket-analytics-empty-table p { margin: 0; font-size: 12px; }
.ticket-analytics-type-picker-empty { max-width: 620px; margin: 0 0 12px; }
.ticket-analytics-add-row {
    align-items: center;
    align-self: flex-start;
    display: inline-flex;
    gap: 7px;
    margin-top: 12px;
    padding: 5px 2px;
    border: 0;
    background: transparent;
    color: var(--color-brand);
    cursor: pointer;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
}
.ticket-analytics-add-row:hover { color: var(--color-brand-dark); text-decoration: underline; }
.ticket-analytics-inline-row td { background: #faf9ff; }
.ticket-analytics-inline-row input,
.ticket-analytics-inline-row select,
.ticket-analytics-inline-row textarea {
    box-sizing: border-box;
    min-width: 110px;
    width: 100%;
}
.ticket-analytics-inline-row textarea { min-width: 240px; resize: vertical; }
/* #ADG: текстовая ячейка начинается с трёх строк и растёт вместе с введённым
   содержимым, не заставляя пустую строку аналитики занимать лишнюю высоту. */
.ticket-analytics-autogrow-textarea {
    field-sizing: content;
    min-height: calc(3lh + 14px);
    overflow-y: hidden;
    resize: vertical;
}
.ticket-analytics-inline-row .ticket-analytics-actions-cell { white-space: normal; }
/* #ADG: два единых поля периода занимают ширину значения HH:mm и не наезжают друг на друга. */
.ticket-analytics-inline-row .analytics-time-range-input {
    grid-template-columns: max-content 12px max-content;
    gap: 4px;
    min-width: 0;
    width: max-content;
}
.ticket-analytics-inline-row .five-minute-time-input {
    width: max-content;
}
.content .ticket-analytics-inline-row .five-minute-time-input select:not([multiple]) {
    min-width: 82px;
    padding: 0 21px 0 6px;
    width: 82px;
    background-position: right 4px center, right 18px center, right center;
    background-size: 10px 10px, 1px 100%, 19px 100%;
}
.content .ticket-analytics-inline-row .five-minute-time-input-duration select:not([multiple]) {
    min-width: 156px;
    width: 156px;
}

/* #ADG: добавление и редактирование аналитики используют одну геометрию контролов. */
.content .ticket-analytics-table tbody td { vertical-align: top; padding-top: 6px; padding-bottom: 6px; }
/* #ADG: приглушение обозначает неактивную строку, но не отключает редактирование. */
.content .ticket-analytics-table tbody tr { --analytics-row-surface: color-mix(in srgb, var(--color-surface) 92%, var(--color-ink) 8%); }
.content .ticket-analytics-table tbody tr:focus-within,
.content .ticket-analytics-table tbody tr.is-editing,
.content .ticket-analytics-table tbody tr.ticket-analytics-inline-row { --analytics-row-surface: var(--color-surface); }
.content .ticket-analytics-table tbody tr > td { background-color: var(--analytics-row-surface); }
.content .ticket-analytics-table tbody tr :is(input, select:not([multiple]), textarea) { background-color: var(--analytics-row-surface); }
.content .ticket-analytics-table :is(input, select:not([multiple]), textarea) {
    box-sizing: border-box; width: 100%; min-width: 0;
    border: 1px solid var(--color-line); border-radius: 4px;
    background-color: var(--color-surface); color: var(--color-ink);
    font-family: inherit; font-size: .76rem; line-height: 1.4;
}
.content .ticket-analytics-table :is(input, select:not([multiple])) { height: 30px; min-height: 30px; padding: 4px 7px; }
.content .ticket-analytics-table select:not([multiple]) { padding-right: 24px; }
.content .ticket-analytics-table .ticket-analytics-inline-choice { padding: 0; min-height: 0; min-width: 0; }
.content .ticket-analytics-table .searchable-choice-field { width: 100%; min-width: 0; align-items: start; gap: 4px; }
.content .ticket-analytics-table .searchable-choice-field-control { flex: 1; min-width: 0; }
.content .ticket-analytics-table .searchable-choice-field-create { width: 30px; min-width: 30px; height: 30px; min-height: 30px; margin: 0; padding: 0; }
.content .ticket-analytics-table .ticket-analytics-inline-textarea { padding: 3px 7px; height: calc(4.2em + 8px); min-height: calc(4.2em + 8px); field-sizing: fixed; overflow-y: auto; resize: vertical; }
.content .ticket-analytics-table .analytics-time-range-input { display: grid; grid-template-columns: 82px 12px 156px; align-items: center; gap: 4px; width: max-content; min-width: 0; }
.content .ticket-analytics-table .five-minute-time-input { width: 100%; min-width: 0; }
.content .ticket-analytics-table .five-minute-time-input select:not([multiple]) { width: 100%; min-width: 0; height: 30px; padding: 4px 21px 4px 6px; }

.ticket-recipient-picker-trigger {
    position: relative;
    display: grid;
    width: 31px;
    min-width: 31px;
    height: 31px;
    padding: 0;
    place-items: center;
    border: 1px solid #d8d2ef;
    border-radius: 50%;
    background: #fff;
    color: #594aa5;
    cursor: pointer;
}
.ticket-recipient-picker-trigger:hover,
.ticket-recipient-picker-trigger.is-active { border-color: #7564cf; background: #eeeaff; color: #1e07aa; }
.ticket-recipient-picker-plus {
    position: absolute;
    right: -2px;
    bottom: -2px;
    display: grid;
    width: 13px;
    height: 13px;
    place-items: center;
    border: 2px solid #faf9ff;
    border-radius: 50%;
    background: #1e07aa;
    color: #fff;
    font: 700 9px/1 sans-serif;
}
.ticket-recipient-picker {
    position: absolute;
    right: 0;
    bottom: calc(100% + 9px);
    z-index: 40;
    width: min(310px, calc(100vw - 36px));
    overflow: hidden;
    border: 1px solid #ddd8ec;
    border-radius: 9px;
    background: #fff;
    box-shadow: 0 14px 34px rgba(39, 29, 86, .2);
}
.ticket-recipient-picker-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 7px;
    color: #30265d;
    font-size: .78rem;
}
.ticket-recipient-picker-heading button {
    width: 24px;
    height: 24px;
    padding: 0;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #756d8c;
    cursor: pointer;
    font-size: 1.15rem;
}
.ticket-recipient-picker-search {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 0 10px 8px;
    padding: 0 9px;
    border: 1px solid #ded9ef;
    border-radius: 6px;
    color: #766d96;
}
.ticket-recipient-picker-search input {
    width: 100%;
    min-height: 32px;
    padding: 0;
    border: 0;
    outline: 0;
    background: transparent;
    font-size: .75rem;
}
.ticket-recipient-picker-list { max-height: 300px; overflow-y: auto; padding: 0 6px 7px; }
.ticket-recipient-picker-section > span {
    display: block;
    padding: 6px 7px 3px;
    color: #817a94;
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
}
.ticket-recipient-picker-item {
    display: grid;
    width: 100%;
    grid-template-columns: 25px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 8px;
    padding: 6px 7px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #302a49;
    cursor: pointer;
    text-align: left;
}
.ticket-recipient-picker-item:hover { background: #f1eeff; }
.ticket-recipient-picker-item > span:nth-child(2) { min-width: 0; }
.ticket-recipient-picker-item strong,
.ticket-recipient-picker-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-recipient-picker-item strong { font-size: .75rem; }
.ticket-recipient-picker-item small { margin-top: 1px; color: #817a91; font-size: .64rem; }
.ticket-recipient-picker-item > .oi { color: #7564cf; font-size: .68rem; }
.ticket-recipient-picker-item .ticket-notification-avatar.contact { background: #8d70bb; }
.ticket-recipient-picker-empty { margin: 0; padding: 20px 10px; color: #817a91; font-size: .72rem; text-align: center; }

.ticket-notification-chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-height: 29px;
    max-width: 250px;
    padding: 3px 9px 3px 4px;
    border: 1px solid #ddd8f2;
    border-radius: 15px;
    background: #fff;
    color: #443b68;
    font-size: .75rem;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease, color .12s ease, box-shadow .12s ease;
}

.ticket-notification-chip:hover { border-color: #9b8fe0; background: #f4f1ff; }
.ticket-notification-chip.is-selected { border-color: #6550d8; background: #ece9ff; color: #21135f; box-shadow: inset 0 0 0 1px rgba(30, 7, 170, .12); }
.ticket-notification-chip:focus-visible { outline: 0; box-shadow: 0 0 0 2px rgba(101, 80, 216, .25); }
.ticket-notification-chip.is-selected:focus-visible { box-shadow: inset 0 0 0 1px rgba(30, 7, 170, .12), 0 0 0 2px rgba(101, 80, 216, .25); }
.ticket-notification-chip.contact .ticket-notification-avatar { background: #8d70bb; }
.ticket-notification-chip:disabled { opacity: .48; cursor: not-allowed; }
.ticket-recipient-check { color: #1e07aa; font-size: .58rem; }

.ticket-notification-chip > span:not(.ticket-notification-avatar) {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-notification-chip small {
    color: #71806e;
    font-size: .65rem;
    white-space: nowrap;
}

.ticket-notification-avatar {
    display: inline-grid;
    flex: 0 0 18px;
    width: 20px;
    min-width: 20px;
    max-width: 20px;
    height: 20px;
    min-height: 20px;
    max-height: 20px;
    place-items: center;
    line-height: 1;
    font-family: inherit;
    font-stretch: normal;
    border-radius: 50%;
    background: #6550d8;
    color: #fff;
    font-size: .66rem;
    font-weight: 700;
}

.ticket-recipient-select {
    min-width: 160px;
    min-height: 30px;
    padding: 4px 28px 4px 9px;
    border: 1px solid #ddd8f2;
    border-radius: 6px;
    background: #fff;
    color: #52614f;
    font-size: .75rem;
}

@media (max-width: 680px) {
    .ticket-recipient-line { align-items: flex-start; }
    .ticket-recipient-choices { flex: 1 1 100%; }
    .ticket-recipient-add { flex: 1 1 100%; margin-left: 0; padding: 8px 0 0; border-top: 1px solid #e2def5; border-left: 0; }
}

.ticket-comment-compose-row {
    display: flex;
    align-items: flex-end;
    gap: 7px;
}

.ticket-comment-composer .ticket-comment-editor {
    flex: 1;
    min-width: 0;
    position: relative;
}

.ticket-comment-composer .ticket-comment-editor-surface {
    min-height: 34px;
    max-height: 44vh;
    padding: 8px 10px;
    resize: vertical;
    overflow: auto;
    border: 1px solid #dfe7dc;
    border-radius: 4px;
    background: #fff;
    transition: min-height .16s ease, border-color .16s ease, box-shadow .16s ease;
}

.ticket-comment-composer .ticket-comment-editor-surface:empty::before {
    content: attr(data-placeholder);
    color: #889486;
    pointer-events: none;
}

.ticket-comment-composer:is(:focus-within, .is-expanded) .ticket-comment-editor-surface {
    min-height: 126px;
    border-color: #80af79;
    box-shadow: 0 0 0 2px rgba(62, 128, 53, .1);
}

.ticket-comment-toolbar {
    display: none;
    margin-top: 7px;
}

.ticket-comment-composer:is(:focus-within, .is-expanded) .ticket-comment-toolbar {
    display: flex;
}

.ticket-composer-file-icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    padding: 0;
}

.ticket-composer-file-icon .visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.ticket-comment-submit {
    flex: 0 0 auto;
    min-height: 34px;
}

.ticket-comment-visibility-button {
    align-items: center;
    align-self: flex-end;
    display: inline-flex;
    flex: 0 0 auto;
    gap: 5px;
    min-height: 34px;
    padding: 5px 9px;
    border: 1px solid #d6e0d4;
    border-radius: 4px;
    background: #f8f9fd;
    color: #52614f;
    cursor: pointer;
    font-size: .75rem;
    font-weight: 600;
    line-height: 1;
}

.ticket-comment-visibility-button:hover {
    border-color: #9fbc99;
    background: #eef6ec;
    color: #285f28;
}

.ticket-comment-visibility-button.active {
    border-color: #c18a2c;
    background: #fff4dc;
    color: #714a08;
    box-shadow: inset 0 0 0 1px rgba(193, 138, 44, .12);
}

.ticket-notification-recipients .ticket-comment-visibility-button {
    align-self: center;
    min-height: 30px;
    padding: 4px 9px;
    border-color: #d8d2ef;
    border-radius: 6px;
    background: #fff;
}

.ticket-mention-suggestions { position: absolute; z-index: 20; left: var(--mention-left, 0); top: var(--mention-top, 100%); width: var(--mention-width, min(320px, 100%)); max-height: 240px; overflow-y: auto; display: grid; gap: 2px; padding: 4px; background: #fff; border: 1px solid #cbd7c7; border-radius: 8px; box-shadow: 0 8px 18px rgba(28, 52, 31, .14); }
.ticket-mention-suggestions button { padding: 7px 10px; border: 0; background: transparent; color: #244b2a; text-align: left; cursor: pointer; border-radius: 5px; }
.ticket-mention-suggestions button:hover, .ticket-mention-suggestions button:focus-visible { background: #edf5ec; outline: 0; }

.ticket-comment-editor-surface.internal {
    border-color: #d3ad69;
    background: #fffdf7;
}

/* #ADG Системные изменения оформляются как нейтральные записи временной шкалы, а не как сообщения сотрудников. */
.ticket-system-comment {
    align-self: center;
    width: min(100%, 560px);
    padding: 6px 10px;
    border: 1px solid #dbe5d8;
    border-left: 1px solid #dbe5d8;
    border-radius: 5px;
    background: #fff;
    text-align: center;
    color: #50614e;
    font-size: .76rem;
}

.ticket-system-comment-label {
    display: block;
    margin-bottom: 2px;
    color: #758273;
    font-size: .64rem;
    font-weight: 700;
    letter-spacing: .03em;
    text-transform: uppercase;
}

.ticket-notification-remove {
    display: inline-grid;
    flex: 0 0 26px;
    width: 26px;
    height: 25px;
    margin: 0;
    padding: 0 1px 1px 0;
    border: 0;
    border-left: 1px solid #b9d4b6;
    border-radius: 0;
    background: rgba(255, 255, 255, .46);
    color: #526b50;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1;
    place-items: center;
    cursor: pointer;
    transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}

.ticket-notification-remove:hover,
.ticket-notification-remove:focus-visible {
    outline: 0;
    background: #f7e7e5;
    color: #9a3027;
    box-shadow: inset 0 0 0 1px rgba(154, 48, 39, .18);
}

.ticket-system-comment-author {
    display: inline;
    margin: 0;
    color: #344633;
    font-size: .78rem;
    font-weight: 600;
}

.ticket-system-comment time {
    display: inline;
    margin: 0 0 0 auto;
}

.ticket-system-comment-meta {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: center;
}

.ticket-system-comment .ticket-comment-body {
    margin-left: 0;
    margin-top: 5px;
}

/* #ADG Системное событие в свёрнутом виде является одной строкой временной
   шкалы; многословная история раскрывается только по запросу пользователя. */
.ticket-system-comment:not(.is-expanded) {
    align-items: center;
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    gap: 7px;
    text-align: left;
}
.ticket-system-comment:not(.is-expanded) .ticket-system-comment-label {
    display: inline;
    margin: 0;
    white-space: nowrap;
}
.ticket-system-comment:not(.is-expanded) .ticket-system-comment-meta {
    display: contents;
}
.ticket-system-comment:not(.is-expanded) .ticket-system-comment-meta time { grid-column: 2; grid-row: 1; }
.ticket-system-comment:not(.is-expanded) .ticket-system-comment-author { display: none; }
.ticket-system-comment:not(.is-expanded) .ticket-comment-body-preview {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ticket-system-comment:not(.is-expanded) > .ticket-content-toggle {
    grid-column: 4;
    grid-row: 1;
}

/* #ADG Компактный композер заявки: текстовая область и инструменты находятся в одной рабочей панели. */
.ticket-comment-composer {
    border: 1px solid var(--color-line);
    border-radius: 6px;
    overflow: visible;
    background: #fff;
}

.ticket-comment-editor {
    display: flex;
    flex-direction: column;
    margin: 0;
}

.ticket-comment-editor .ticket-comment-toolbar {
    order: 2;
    min-height: 38px;
    padding: 4px 7px;
    border-top: 1px solid var(--color-line);
    border-bottom: 0;
    background: #fbfcfa;
}

.ticket-comment-toolbar {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    min-width: 0;
}

/* #ADG: в спокойном состоянии композер занимает одну офисную строку.
   Получатели, вложения и форматирование открываются вместе после перехода
   в поле комментария, поэтому лента заявки получает максимум высоты. */
.ticket-comment-composer:not(:focus-within):not(.is-expanded) .ticket-notification-recipients,
.ticket-comment-composer:not(:focus-within):not(.is-expanded) .ticket-composer-file-button,
.ticket-comment-composer:not(:focus-within):not(.is-expanded) .ticket-comment-toolbar {
    display: none;
}

.ticket-comment-toolbar button,
.ticket-composer-file-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    height: 28px;
    padding: 2px 7px;
    border: 1px solid transparent;
    border-radius: 4px;
    color: #536252;
    background: transparent;
    cursor: pointer;
    font-size: .76rem;
    line-height: 1;
    margin: 0;
    white-space: nowrap;
}

.ticket-comment-toolbar button:nth-child(1),
.ticket-comment-toolbar button:nth-child(2),
.ticket-comment-toolbar button:nth-child(3) { width: auto; min-width: 28px; padding: 2px 7px; font-size: .76rem; }
.ticket-comment-toolbar button:nth-child(4) { font-size: 1.15rem; }
.ticket-comment-toolbar button.editor-icon-button {
    font-size: .8rem;
    min-width: 30px;
    padding: 0;
    width: 30px;
}
.ticket-comment-toolbar button:hover,
.ticket-composer-file-button:hover { border-color: #b9d4b6; background: #eef7ec; color: #246222; transform: none; }
.ticket-comment-toolbar-spacer { flex: 1; }
.ticket-composer-file-button { position: relative; gap: 4px; }
.ticket-comment-editor-surface { min-height: 112px; padding: 11px 12px; border: 0; outline: 0; }
.ticket-comment-submit-row { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.uploading-note { display: inline-flex; align-items: center; gap: 5px; color: var(--color-muted); font-size: .78rem; }

@media (max-width: 760px) {
    .ticket-comment-visibility-button {
        justify-content: center;
        min-width: 34px;
        padding-left: 7px;
        padding-right: 7px;
    }

    .ticket-comment-visibility-label {
        display: none;
    }
}

.ticket-attachments { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--color-line); }
.ticket-attachments-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.ticket-attachments-heading h3 { margin: 0; font-size: .9rem; }
.ticket-attachment-list { display: grid; gap: 6px; margin-top: 9px; }
.ticket-attachment-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid #e1e8de; border-radius: 5px; background: #fbfdfb; }
.ticket-attachment-item a { display: grid; gap: 2px; min-width: 0; color: var(--color-ink); text-decoration: none; }
.ticket-attachment-item a:hover strong { color: var(--color-brand); text-decoration: underline; }
.ticket-attachment-item small { color: var(--color-muted); font-size: .73rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-attachment-actions { align-items: center; display: flex; flex: 0 0 auto; gap: 8px; margin-left: auto; }
.ticket-attachment-actions > button { align-items: center; box-sizing: border-box; display: inline-flex; font-size: .78rem; height: var(--office-control-height-compact); justify-content: center; line-height: 1; min-height: var(--office-control-height-compact); padding: 0 8px; width: 110px; }
.danger-button-compact { padding: 5px 9px; font-size: .76rem; }
.ticket-attachment-indicator {
    flex-shrink: 0;
    align-self: center;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 2px 6px;
    border: 1px solid #c8dcc4;
    border-radius: 10px;
    background: #f2f8f0;
    color: #286a25;
    font-size: .72rem;
    font-weight: 400;
    line-height: 1.2;
    vertical-align: middle;
}
.ticket-preview-modal { display: grid; gap: 10px; }
.ticket-preview-image { display: block; max-width: 100%; max-height: calc(100vh - 170px); margin: 0 auto; object-fit: contain; }
.ticket-preview-pdf { width: 100%; height: min(72vh, 760px); border: 1px solid var(--color-line); }

.ticket-detail-heading {
    /* #ADG: заголовок закрепляется внутри правой прокручиваемой области, а не относительно окна,
       поэтому навигация по заявкам слева и общая шапка портала сохраняют собственную геометрию. */
    position: sticky;
    top: 0;
    z-index: 18;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, max-content);
    align-items: center;
    flex: 0 0 auto;
    gap: 10px;
    min-height: 42px;
    margin: 0 0 10px;
    padding: 3px 0 7px;
    border-bottom: 1px solid var(--color-line);
    background: var(--color-surface);
    box-shadow: 0 5px 10px rgba(38, 61, 35, .04);
}

/* #ADG: номер и название образуют один блок, поэтому не
   расходятся по независимым колонкам при изменении ширины рабочей области. */
.ticket-detail-heading-main {
    align-items: center;
    display: flex;
    gap: 6px;
    min-width: 0;
}

.ticket-detail-heading .ticket-return-link {
    align-items: center;
    border: 1px solid transparent;
    border-radius: 3px;
    color: var(--color-brand-dark);
    display: inline-flex;
    height: 26px;
    justify-content: center;
    margin: 0;
    align-self: center;
    flex: 0 0 26px;
    width: 26px;
}

.ticket-detail-heading .ticket-return-link:hover,
.ticket-detail-heading .ticket-return-link:focus-visible {
    background: var(--color-brand-soft);
    border-color: var(--color-brand-line);
    text-decoration: none;
}

.ticket-detail-heading .service-desk-eyebrow {
    line-height: 1.25;
    margin: 0;
    white-space: nowrap;
}

.ticket-detail-heading h1 {
    margin: 0;
    min-width: 0;
    overflow: hidden;
    font-size: 1rem;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* #ADG: номер и тема заявки используют одну типографику и общий контейнер.
   Разделитель сохраняет смысловую структуру, не разбивая шапку на три визуальных элемента. */
.ticket-detail-heading h1.ticket-context-title {
    align-items: center;
    display: flex;
    font-size: 1.05rem;
    font-weight: 400;
    gap: 6px;
    line-height: 1.25;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-context-title > span {
    display: block;
    line-height: inherit;
}

.ticket-context-title .ticket-context-separator {
    color: var(--color-muted);
    flex: 0 0 auto;
    font-weight: 400;
    margin: 0;
}

.ticket-context-title .ticket-context-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-detail-heading p {
    align-items: baseline;
    display: flex;
    gap: 5px;
    line-height: 1.25;
    margin: 0;
    min-width: 0;
    overflow: hidden;
    color: var(--color-muted);
    font-size: .76rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-detail-heading p span:first-child {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* #ADG: метаданные и быстрая смена статуса занимают одну компактную строку;
   длинное название проекта сокращается раньше, чем начинает сжимать контрол. */
.ticket-detail-heading-meta {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    min-width: 0;
}

.ticket-detail-heading-meta > p {
    flex: 1 1 auto;
    justify-content: flex-end;
}

.ticket-project-path-wrap {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    min-width: 0;
}

.ticket-original-link {
    flex: 0 0 auto;
    white-space: nowrap;
}

.ticket-project-path {
    flex-wrap: nowrap;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
}

.ticket-project-path > * {
    flex: 0 0 auto;
}

.ticket-project-path a {
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ticket-created-at {
    color: var(--color-muted);
    flex: 0 0 auto;
    font-size: .76rem;
    white-space: nowrap;
}

.ticket-quick-status {
    --ticket-quick-status-bg: #f2f8f0;
    --ticket-quick-status-text: #286a25;
    align-items: center;
    background: var(--ticket-quick-status-bg);
    border: 1px solid color-mix(in srgb, var(--ticket-quick-status-text) 28%, white);
    border-radius: 4px;
    color: var(--ticket-quick-status-text);
    display: inline-flex;
    flex: 0 0 auto;
    height: 28px;
    max-width: 220px;
    min-width: 142px;
    overflow: hidden;
    position: relative;
}

.ticket-quick-status-dot {
    background: currentColor;
    border-radius: 50%;
    flex: 0 0 7px;
    height: 7px;
    margin-left: 9px;
    width: 7px;
}

.content .ticket-quick-status-select {
    background-color: transparent;
    border: 0;
    color: inherit;
    cursor: pointer;
    flex: 1 1 auto;
    font-family: var(--font-office-table);
    font-size: .75rem;
    font-weight: 600;
    height: 26px;
    min-width: 0;
    outline: 0;
    padding-bottom: 0;
    padding-left: 7px;
    padding-top: 0;
    text-overflow: ellipsis;
}

.content .ticket-quick-status-select:focus-visible {
    box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--ticket-quick-status-text) 45%, white);
}

.ticket-quick-status.is-saving .ticket-quick-status-select {
    padding-right: 32px;
}

.ticket-quick-status-spinner {
    position: absolute;
    right: 9px;
}

/* #ADG: на узком экране метаданные переносятся отдельно, не перекрывая название заявки. */
@media (max-width: 760px) {
    .ticket-detail-heading {
        grid-template-columns: minmax(0, 1fr);
        gap: 6px 8px;
    }

    .ticket-detail-heading p {
        padding-left: 0;
    }

    .ticket-detail-heading-meta {
        justify-content: flex-start;
        padding-left: 36px;
    }

    .ticket-detail-heading-meta > p {
        justify-content: flex-start;
    }

    /* #ADG: ссылка на исходную заявку остаётся в шапке, но не выталкивает
       длинный путь проекта за край узкого экрана. */
    .ticket-project-path-wrap {
        display: grid;
        grid-template-columns: minmax(0, 1fr);
        justify-items: end;
    }

    .ticket-project-path {
        width: 100%;
    }

    .ticket-quick-status {
        max-width: min(220px, 48vw);
    }

    .ticket-detail-heading > .ticket-summary-top {
        overflow-x: auto;
    }

    .ticket-detail-heading > .ticket-summary-top dl {
        min-width: max-content;
        flex-wrap: nowrap;
    }
}

.ticket-comment-editor .editor-toolbar {
    position: static !important;
    box-shadow: none;
}

.ticket-comment-editor-surface {
    min-height: 112px;
}

.ticket-side-panel h2,
.ticket-project-editor h2 {
    margin: 0 0 12px;
    font-size: 1rem;
}

.ticket-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
    margin: 0;
    font-size: .86rem;
}

.ticket-meta dt { color: #71806e; }
.ticket-meta dd { margin: 0; font-weight: 600; }
.ticket-watchers { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.project-member-list { display: grid; gap: 5px; margin-bottom: 10px; }
.project-member-list div { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #e7ede4; font-size: .86rem; }
.project-member-list small { color: #71806e; }
.compact-check { font-size: .8rem; white-space: nowrap; }

@media (max-width: 900px) {
    .ticket-workspace,
    .ticket-project-management,
    .ticket-details-grid { grid-template-columns: 1fr; }
    .ticket-table-head { display: none; }
    .ticket-table-row { grid-template-columns: minmax(0, 1fr) 1fr; }
    .ticket-table-row > span { min-height: auto; }
    .ticket-summary-card { position: static; }
}

.ticket-copy-dialog {
    width: min(680px, calc(100vw - 32px));
}

.ticket-copy-title-field {
    display: grid;
    gap: 7px;
    min-width: 0;
    width: 100%;
}

.ticket-copy-title-field > span {
    color: var(--color-ink-soft);
    font-size: .78rem;
    font-weight: 700;
}

.ticket-copy-title-field > input {
    box-sizing: border-box;
    min-height: 44px;
    padding: 10px 12px;
    width: 100%;
}
/* #ADG: top-layer dialog не ограничивается шириной и overflow комментария. */
#ticket-description-content img,
.ticket-comment-body img { cursor: zoom-in; }
.ticket-image-viewer[open] {
    display: flex;
    flex-direction: column;
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100dvh;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 12px;
    box-sizing: border-box;
    border: 0;
    background: #111827;
    color: #f5f3ff;
}
.ticket-image-viewer::backdrop { background: #111827; }
.ticket-image-viewer-toolbar { display: flex; justify-content: flex-end; gap: 8px; padding-bottom: 10px; }
.ticket-image-viewer-toolbar button {
    background: #38305b;
    color: #f5f3ff;
    border: 1px solid #8174b5;
    border-radius: 5px;
    padding: 7px 12px;
    cursor: pointer;
}
.ticket-image-viewer-stage { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; }
.ticket-image-viewer-stage img { max-width: 100%; max-height: 100%; object-fit: contain; min-height: 0; }
.ticket-image-viewer-stage.is-actual-size { display: block; }
.ticket-image-viewer-stage.is-actual-size img { max-width: none; max-height: none; }

/* #ADG: файл остаётся обычной компактной ссылкой и в редакторе, и в опубликованном тексте. */
.ticket-comment-body a[href^="/files/"]:not(:has(img)),
#ticket-description-content a[href^="/files/"]:not(:has(img)),
[data-attachment-card] > a {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    max-width: 100%;
    box-sizing: border-box;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: var(--color-brand, #5943ba);
    font-size: inherit;
    font-weight: 400;
    text-decoration: underline;
    text-underline-offset: 2px;
    overflow-wrap: anywhere;
    vertical-align: middle;
}
/* #ADG: шрифтовая скрепка не наследует смещение Open Iconic относительно счётчика. */
.ticket-attachment-indicator > .oi { top: 0; display: block; line-height: 1; }

.ticket-context-title .ticket-context-number { flex: 0 0 auto; }

.has-pending-editor-upload .ticket-comment-submit { pointer-events: none; opacity: .65; }
.has-pending-editor-upload .ticket-comment-submit:not(:has(.button-spinner)) { font-size: 0; }
.has-pending-editor-upload .ticket-comment-submit:not(:has(.button-spinner))::after {
    content: "";
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    animation: comment-upload-spin .8s linear infinite;
}
@keyframes comment-upload-spin { to { transform: rotate(360deg); } }
.ticket-comment-body a[href^="/files/"]:not(:has(img))::before,
#ticket-description-content a[href^="/files/"]:not(:has(img))::before,
[data-attachment-card] > a::before { content: none; }
[data-attachment-card] { display: inline-flex; align-items: center; max-width: 100%; gap: .25rem; margin: .2rem 0; }
[data-attachment-card] > a { min-width: 0; }
[data-attachment-remove] { flex-shrink: 0; border: 0; border-radius: 3px; color: var(--color-muted); background: transparent; cursor: pointer; padding: 0 .2rem; font-size: 1rem; line-height: 1.2; }
[data-attachment-remove]:focus-visible { outline: 2px solid #7054d8; }
