/* Service Desk workspace */
.service-desk-workspace {
    min-width: 0;
    border: 1px solid var(--color-line);
    background: var(--color-surface);
}

.service-desk-workspace-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    padding: 18px 20px 16px;
    border-bottom: 1px solid var(--color-line);
}

.service-desk-workspace-head h1 {
    margin: 3px 0 0;
    font-size: 1.22rem;
    line-height: 1.25;
}

.service-desk-workspace-head p {
    margin: 5px 0 0;
    color: var(--color-muted);
    font-size: .84rem;
}

.ticket-details-grid-single {
    grid-template-columns: minmax(0, 1fr);
}

/* #ADG: Правая рабочая область уже является белой поверхностью карточки.
   Вложенная panel не должна создавать вторую подложку и съедать полезную ширину. */
.ticket-detail-main > .ticket-details-grid-single > .ticket-content-panel {
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 8px 10px 12px;
}

/* #ADG:
 * Боковые действия страниц располагаются единой вертикальной группой без промежутков.
 * Добавляя новое действие, достаточно назначить ему --rail-index: 2, 3 и далее:
 * кнопки не перекроют друг друга и не будут менять положение при наведении.
 * Разработано ООО «Ай-Технолоджис Групп». Автор: ADG.
 */
.ticket-load-more-sentinel {
    min-height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    color: var(--muted-text);
    font-size: 0.84rem;
}

.ticket-load-more-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid #dfe3f0;
    border-top-color: var(--brand-green);
    border-radius: 50%;
    animation: ticket-load-more-spin .7s linear infinite;
}

@keyframes ticket-load-more-spin {
    to { transform: rotate(360deg); }
}

.analytics-time-range-input {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 18px minmax(0, 1fr);
    align-items: center;
    gap: 6px;
}

.analytics-time-range-input > span { text-align: center; color: #68708a; }

.ticket-drawer {
    max-width: 460px;
}

.ticket-drawer .ticket-side-panel {
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.ticket-drawer-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin: 0;
}

.ticket-drawer-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    color: #5f6680;
    font-size: .78rem;
    font-weight: 700;
}

.ticket-drawer-form select,
.ticket-drawer-form input,
.ticket-drawer-form button,
.ticket-drawer .ticket-drawer-action select {
    width: 100%;
}

.ticket-description-edit-section {
    display: grid;
    gap: 6px;
}

.ticket-drawer-field-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    color: #5f6680;
    font-size: .78rem;
    font-weight: 700;
}

.ticket-drawer-field-heading button { width: auto; }
.ticket-drawer-description-preview { margin: 0; color: #7b8299; font-size: .78rem; font-weight: 400; }
.ticket-drawer .ticket-description-editor { min-height: 180px; max-height: 300px; overflow-y: auto; }

.ticket-drawer .ticket-meta {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3px;
}

.ticket-drawer .ticket-meta dt {
    margin-top: 10px;
}

.ticket-drawer .ticket-meta dd {
    padding-bottom: 8px;
    border-bottom: 1px solid #e3e6f0;
}

.ticket-drawer-form-actions {
    display: flex;
    padding-top: 12px;
    border-top: 1px solid #e3e6f0;
}

.ticket-drawer .ticket-drawer-save {
    min-height: 38px;
    width: 100%;
    justify-content: center;
}

.ticket-drawer-action {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    margin-top: 10px;
}

.service-desk-back-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    margin: 0 0 8px;
    color: var(--color-action);
    font-size: .82rem;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
}

.service-desk-back-link:hover,
.service-desk-back-link:focus-visible {
    color: var(--color-action-hover);
    text-decoration: underline;
}

.project-description-preview {
    display: block;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--color-line);
    background: #f8f9fd;
    color: var(--color-muted);
    cursor: text;
    font-size: .84rem;
    line-height: 1.5;
    overflow-wrap: anywhere;
    text-align: left;
}

.project-description-preview:hover,
.project-description-preview:focus-visible {
    border-color: var(--color-brand-line);
    box-shadow: none;
    transform: none;
}

.project-description-placeholder {
    color: var(--color-brand);
}

.project-description-editor .editor-toolbar {
    position: static !important;
    box-shadow: none;
}

.project-description-editor .article-rich-editor {
    min-height: 260px;
}

/* #ADG: длинное описание корневого проекта читается в той же высокой
   области, что и в параметрах проекта; прокрутка остаётся у панели целиком. */
.root-project-drawer .article-rich-editor {
    min-height: clamp(320px, 65dvh, 700px);
    height: auto;
    overflow-y: visible;
}

.project-description-preview > span {
    display: block;
    margin-bottom: 7px;
    color: #68708a;
    font-size: .7rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.project-description-preview :is(p, ul, ol, blockquote, pre, table) {
    margin: 0 0 8px;
}

.project-description-preview :is(ul, ol) {
    padding-left: 21px;
}

.project-description-preview :is(h1, h2, h3, h4, h5, h6) {
    margin: 12px 0 6px;
    color: var(--color-ink);
    font-size: 1rem;
}

.project-description-preview a {
    color: var(--color-brand);
    text-decoration: underline;
}

.project-description-preview table {
    width: 100%;
    border-collapse: collapse;
}

.project-description-preview :is(th, td) {
    padding: 5px 7px;
    border: 1px solid var(--color-line);
    vertical-align: top;
}

.service-desk-workspace-actions,
.service-desk-breadcrumbs {
    display: flex;
    align-items: center;
    gap: 7px;
}

.service-desk-workspace-actions {
    flex: 0 0 auto;
}

.service-desk-breadcrumbs {
    min-height: 18px;
    color: var(--color-muted);
    font-size: .76rem;
}

.service-desk-breadcrumbs a {
    color: var(--color-brand);
    text-decoration: none;
}

.service-desk-breadcrumbs a:hover {
    text-decoration: underline;
}

.service-desk-breadcrumb-separator {
    color: #9aa2b9;
}

.service-desk-projects-panel,
.service-desk-tickets-panel {
    margin: 0;
    border: 0;
    border-radius: 0;
}

.service-desk-table-heading {
    min-height: 43px;
}

.service-desk-table-heading-start {
    align-items: center;
    display: flex;
    gap: .5rem;
    min-width: 0;
}

.service-desk-project-heading-start {
    align-items: center;
    display: flex;
    gap: .55rem;
    min-width: 0;
}

.project-status-filter {
    background-color: #fff;
    border: 1px solid #cfdbca;
    border-radius: 5px;
    color: #354632;
    font-size: .76rem;
    height: 28px;
    min-width: 118px;
    padding: 0 27px 0 8px;
}

.project-status-filter:focus {
    border-color: var(--color-brand-bright);
    box-shadow: var(--focus-ring);
    outline: 0;
}

/* #ADG: Основной фильтр реестра находится в шапке рядом с режимом просмотра.
   Так таблица начинается сразу под заголовком и не теряет отдельную строку по высоте. */
.ticket-activity-filter {
    background-color: #fff;
    border: 1px solid #cfdbca;
    border-radius: 5px;
    color: #354632;
    font-size: .78rem;
    height: 30px;
    min-width: 126px;
    padding: 0 28px 0 9px;
}

.ticket-activity-filter:focus {
    border-color: var(--color-brand-bright);
    box-shadow: var(--focus-ring);
    outline: 0;
}

.ticket-view-switch {
    align-items: stretch;
    border: 1px solid #cfdbca;
    border-radius: 5px;
    display: inline-flex;
    overflow: hidden;
}

.ticket-view-switch button {
    align-items: center;
    background: #fff;
    border: 0;
    border-left: 1px solid #dfe7db;
    color: #52634f;
    display: inline-flex;
    font-size: .76rem;
    font-weight: 600;
    justify-content: center;
    min-height: 30px;
    min-width: 32px;
    padding: .28rem .45rem;
    position: relative;
    transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}

.ticket-view-switch button:first-child {
    border-left: 0;
}

.ticket-view-switch button:hover {
    background: #f1f7ee;
    color: #276a22;
}

.ticket-view-switch button.is-active {
    background: #e8f3e5;
    color: #276a22;
}

.ticket-view-switch .oi {
    font-size: .82rem;
}

/* ADG, ООО «Ай-Технолоджис Групп»: компактные действия таблицы оставляют рабочую
   поверхность свободной. Подсказка поясняет иконку без постоянных текстовых кнопок. */
.ticket-tool-button {
    align-items:center;
    background:#fff;
    border:1px solid #cfdbca;
    border-radius:5px;
    color:#3d6739;
    display:inline-flex;
    height:30px;
    justify-content:center;
    min-width:32px;
    padding:0;
    position:relative;
    transition:background-color .16s ease, border-color .16s ease, color .16s ease;
}
.ticket-tool-button:hover:not(:disabled), .ticket-tool-button:focus-visible {
    background:#e8f3e5;
    border-color:#76a871;
    color:#276a22;
    outline:none;
}
.ticket-tool-button:disabled { cursor:wait; opacity:.58; }
.ticket-tool-button .oi { font-size:.82rem; }
.ticket-tool-button[data-tooltip]::after,
.ticket-view-switch button[data-tooltip]::after {
    background:#273128;
    border-radius:4px;
    bottom:calc(100% + 7px);
    color:#fff;
    content:attr(data-tooltip);
    font-size:12px;
    font-weight:500;
    left:50%;
    line-height:1.25;
    opacity:0;
    padding:6px 8px;
    pointer-events:none;
    position:absolute;
    transform:translate(-50%, 3px);
    transition:opacity .14s ease, transform .14s ease;
    visibility:hidden;
    white-space:nowrap;
    z-index:25;
}
.ticket-tool-button[data-tooltip]:hover::after,
.ticket-tool-button[data-tooltip]:focus-visible::after,
.ticket-view-switch button[data-tooltip]:hover::after,
.ticket-view-switch button[data-tooltip]:focus-visible::after {
    opacity:1;
    transform:translate(-50%, 0);
    visibility:visible;
}

/* #ADG: Инструменты таблиц стоят у верхней и правой границ рабочей области.
   Подсказка над кнопкой попадала под sticky-шапку либо обрезалась справа, поэтому
   для этой панели раскрываем её вниз и выравниваем по правому краю кнопки. */
.service-desk-table-tools .ticket-tool-button[data-tooltip]::after {
    bottom:auto;
    left:auto;
    right:0;
    top:calc(100% + 7px);
    transform:translateY(-3px);
}

.service-desk-table-tools .ticket-tool-button[data-tooltip]:hover::after,
.service-desk-table-tools .ticket-tool-button[data-tooltip]:focus-visible::after {
    transform:translateY(0);
}

/* ADG, ООО «Ай-Технолоджис Групп»: создание заявки проходит последовательно,
   поэтому форма намеренно остается одноколоночной на любой ширине рабочей области. */
.ticket-create-form {
    grid-template-columns:minmax(0, 1fr);
    max-width:900px;
}
.ticket-create-form > label { grid-column:1; }
/* #ADG: панель создания заявки остаётся у редактора, а не перекрывает текст при прокрутке формы. */
.ticket-create-form .ticket-description-toolbar,
article.content .ticket-create-form .editor-field > .ticket-description-toolbar {
    position:static !important;
    top:auto !important;
    box-shadow:none;
    z-index:auto;
}
.ticket-create-date-fields,
.ticket-drawer-date-fields {
    display:grid;
    gap:12px;
    grid-template-columns:repeat(2, minmax(0, 1fr));
}
.ticket-create-date-fields > label,
.ticket-drawer-date-fields > label { display:grid; gap:6px; min-width:0; }
/* #ADG: боковая панель уже основной формы и не вмещает рядом два составных
   поля «дата + время». Вертикальная компоновка исключает их перекрытие. */
.ticket-drawer-date-fields { grid-template-columns:minmax(0, 1fr); }
.ticket-create-form textarea { min-height:230px; resize:vertical; }
.ticket-create-form .form-actions { grid-column:1; justify-content:flex-start; margin-top:4px; }

/* #ADG Модальная форма создания сохраняет рабочий контекст списка и прокручивает только содержимое диалога. */
body:has(.ticket-create-dialog-backdrop) { overflow:hidden; }

.ticket-create-dialog {
    display:flex;
    flex-direction:column;
    max-height:calc(100dvh - 32px);
    overflow:hidden;
    padding:0;
    width:min(980px, calc(100vw - 32px));
}
.ticket-create-dialog-heading {
    align-items:center;
    flex:0 0 auto;
    margin:0;
    padding:14px 18px;
}

.project-description-preview-readonly {
    color: var(--color-ink);
    cursor: default;
}

.project-description-preview-readonly:hover {
    border-color: var(--color-line);
}
.ticket-create-close-button {
    align-self:center;
    border-radius:6px;
    color:var(--color-muted);
    flex:0 0 26px !important;
    font-size:20px !important;
    font-weight:300 !important;
    height:26px !important;
    min-height:26px !important;
    width:26px !important;
}
.ticket-create-close-button > span {
    display:block;
    line-height:20px;
    transform:translateY(-1px);
}
.ticket-create-dialog-body {
    min-height:0;
    overscroll-behavior:contain;
    overflow-y:auto;
    padding:16px 18px 18px;
}
.ticket-create-dialog-content { min-width:0; }
.ticket-create-dialog-content .ticket-create-form {
    max-width:none;
    padding:0;
}
.ticket-create-dialog-content .notice-banner { margin-bottom:12px; }

/* #ADG Ошибка загрузки формы заявки остаётся рабочим состоянием с явным повтором, а не обрывом страницы. */
.ticket-create-load-error {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: .75rem;
    justify-content: space-between;
}

@media (max-width: 680px) {
    .ticket-create-dialog-backdrop { padding:8px; }
    .ticket-create-dialog {
        max-height:calc(100dvh - 16px);
        width:calc(100vw - 16px);
    }
    .ticket-create-dialog-heading { padding:12px 14px; }
    .ticket-create-dialog-body { padding:12px 14px 14px; }
    .ticket-create-date-fields,
    .ticket-drawer-date-fields { grid-template-columns:minmax(0, 1fr); }
}

.service-desk-project-table-head,
.service-desk-project-row {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) 112px 90px 110px;
}

.service-desk-project-table-head {
    border-bottom: 1px solid var(--color-line);
    background: #f4f6f2;
    color: #68708a;
    font-size: .68rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.service-desk-project-table-head span,
.service-desk-project-row > span {
    min-width: 0;
    padding: 10px 12px;
    border-right: 1px solid #e7ece4;
}

.service-desk-project-row > .service-desk-project-name {
    /* #ADG: это правило должно быть не слабее общего padding ячейки выше,
       иначе табуляция дочерних проектов визуально пропадает. Уменьшенный вертикальный
       отступ компенсирует увеличенную область кнопки и сохраняет компактность строки. */
    padding: 4px 12px 4px calc(12px + var(--project-depth, 0) * 1.1rem);
}

.service-desk-project-table-head span:last-child,
.service-desk-project-row > span:last-child {
    border-right: 0;
}

.service-desk-project-row {
    width: 100%;
    border: 0;
    border-bottom: 1px solid #e7ece4;
    background: transparent;
    color: inherit;
    text-align: left;
    font: inherit;
    cursor: pointer;
    transition: background-color .14s ease;
}

.service-desk-project-row:hover {
    background: var(--color-brand-soft);
}

.service-desk-project-row:focus-visible {
    position: relative;
    z-index: 1;
    outline: 2px solid var(--color-brand-bright);
    outline-offset: -2px;
}

.service-desk-project-name {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--color-ink);
}

.service-desk-project-name .oi {
    color: var(--color-brand);
    font-size: .92rem;
}

.service-desk-project-description {
    overflow: hidden;
    color: var(--color-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-settings-rail {
    --rail-index: 0;
    position: fixed;
    z-index: 20;
    /* #ADG: Все боковые действия используют общий шаг, равный высоте кнопки, и идут без промежутков. */
    top: calc(50% + var(--rail-index) * 42px);
    right: 0;
    /* #ADG: Узкий rail оставляет рабочую область таблицам, а название действия показывает собственная подсказка. */
    display: inline-grid;
    width: 42px;
    box-sizing: border-box;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
    height: 42px;
    padding: 0;
    border: 1px solid var(--color-brand-line);
    border-right: 0;
    border-radius: 7px 0 0 7px;
    background: var(--color-brand-soft);
    color: var(--color-brand);
    font: inherit;
    cursor: pointer;
    transform: translateY(-50%);
    transition: background-color .14s ease, border-color .14s ease, box-shadow .14s ease, color .14s ease;
}

.project-settings-rail > .oi {
    display: block;
    font-size: 1rem;
    line-height: 1;
}

.project-settings-rail::before {
    position: absolute;
    top: 50%;
    right: calc(100% + 5px);
    width: 0;
    height: 0;
    border-top: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 5px solid var(--color-brand-dark);
    content: "";
    opacity: 0;
    pointer-events: none;
    transform: translate(4px, -50%);
    transition: opacity .12s ease, transform .12s ease;
    visibility: hidden;
}

.project-settings-rail::after {
    position: absolute;
    top: 50%;
    right: calc(100% + 10px);
    max-width: 220px;
    padding: 6px 9px;
    border-radius: 4px;
    background: var(--color-brand-dark);
    box-shadow: 0 4px 12px rgba(30, 7, 170, .18);
    color: #fff;
    content: attr(data-tooltip);
    font-size: .75rem;
    font-weight: 500;
    line-height: 1.2;
    opacity: 0;
    pointer-events: none;
    transform: translate(4px, -50%);
    transition: opacity .12s ease, transform .12s ease;
    visibility: hidden;
    white-space: nowrap;
}

.project-settings-rail:hover::before,
.project-settings-rail:hover::after,
.project-settings-rail:focus-visible::before,
.project-settings-rail:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%);
    visibility: visible;
}

.project-settings-rail:hover:not(:disabled),
.project-settings-rail:focus-visible,
.project-settings-rail:active:not(:disabled) {
    background: #e8e5ff;
    border-color: var(--color-brand);
    box-shadow: -3px 3px 12px rgba(30, 7, 170, .16);
    transform: translateY(-50%);
}

.project-settings-rail.is-active,
.project-settings-rail.is-active:hover,
.project-settings-rail.is-active:focus-visible {
    border-color: var(--color-brand);
    background: var(--color-brand);
    color: #fff;
}

.project-settings-rail:focus-visible {
    outline: 2px solid var(--color-brand-dark);
    outline-offset: 2px;
}

.project-settings-rail.ticket-action-rail {
    bottom: auto;
    transform: translateY(-50%);
}

.project-settings-rail.ticket-action-rail:hover:not(:disabled),
.project-settings-rail.ticket-action-rail:focus-visible,
.project-settings-rail.ticket-action-rail:active:not(:disabled) {
    transform: translateY(-50%);
}

.project-settings-rail.ticket-analytics-rail {
    --rail-index: 1;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

.project-settings-rail.ticket-settings-rail {
    border-bottom-left-radius: 0;
}

.project-settings-rail.ticket-attachments-rail {
    --rail-index: 2;
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
}

/* #ADG: AI является последним действием карточки заявки и продолжает общий компактный rail без зазоров. */
.project-settings-rail.ticket-ai-rail {
    --rail-index: 3;
    border-top-left-radius: 0;
}

.ticket-ai-rail-mark {
    display: block;
    font-size: .68rem;
    font-weight: 800;
    line-height: 1;
}

.project-files-rail {
    --rail-index: 0;
    border-bottom-left-radius: 0;
}

.project-main-rail {
    --rail-index: 1;
    border-top-left-radius: 0;
}

.project-files-rail:hover:not(:disabled),
.project-files-rail:focus-visible,
.project-files-rail:active:not(:disabled) {
    transform: translateY(-50%);
}

.project-files-drawer {
    width: min(500px, 100vw);
}

.project-file-input {
    display: block;
    width: 100%;
    padding: 10px;
    border: 1px dashed #bdd7b7;
    border-radius: 6px;
    background: #f8f9fd;
}

.project-files-count {
    color: var(--color-muted);
    font-size: .78rem;
    font-weight: 400;
}

.project-file-list {
    display: grid;
    gap: 7px;
}

.project-file-row {
    display: grid;
    grid-template-columns: 18px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 9px;
    padding: 10px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
    color: inherit;
    text-decoration: none;
}

.project-file-row:hover,
.project-file-row:focus-visible {
    border-color: #bdd7b7;
    background: #f8f9fd;
}

.project-file-meta {
    display: grid;
    min-width: 0;
    gap: 3px;
}

.project-file-meta strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.project-file-meta small {
    color: var(--color-muted);
    font-size: .75rem;
}

.project-drawer-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: flex;
    justify-content: flex-end;
    background: rgba(29, 38, 29, .23);
    animation: project-drawer-backdrop-in .2s ease-out both;
    /* #ADG: при перетаскивании по select/input браузер не должен продолжать
       выделение текста в затемнённой карточке под модальной панелью. */
    user-select: none;
    overflow: hidden;
    overscroll-behavior: contain;
}

/* #ADG: Пока открыта боковая панель, единственной прокручиваемой областью
   остаётся её содержимое. Так колесо не переходит сначала к drawer, а затем
   к карточке заявки под затемнением. */
body:has(.ticket-detail-workspace .project-drawer-backdrop) .ticket-detail-main {
    overflow: hidden !important;
}

.project-drawer {
    display: flex;
    width: min(440px, 100vw);
    height: 100%;
    flex-direction: column;
    border-left: 1px solid var(--color-line);
    background: var(--color-surface);
    box-shadow: -8px 0 28px rgba(21, 34, 20, .16);
    animation: project-drawer-in .24s cubic-bezier(.22, 1, .36, 1) both;
    will-change: transform, opacity;
    user-select: text;
}

.ticket-analytics-editor-heading {
    cursor: move;
    user-select: none;
}

.ticket-analytics-editor-heading button {
    cursor: pointer;
}

.modal-panel-narrow.is-minimized {
    min-height: 0;
}

.project-drawer input,
.project-drawer select,
.project-drawer textarea,
.project-drawer button,
.project-drawer label {
    user-select: auto;
}

/* #ADG: настройки и аналитика открываются как единая офисная боковая панель,
   без резкого появления поверх заявки. */
@keyframes project-drawer-backdrop-in {
    from { background: rgba(29, 38, 29, 0); }
    to { background: rgba(29, 38, 29, .23); }
}

@keyframes project-drawer-in {
    from {
        opacity: .72;
        transform: translateX(100%);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    .project-drawer-backdrop,
    .project-drawer {
        animation: none;
    }
}

.project-drawer-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 19px 20px 15px;
    border-bottom: 1px solid var(--color-line);
}

.project-drawer-heading h2 {
    margin: 3px 0 0;
    font-size: 1.1rem;
}

/* ADG, ООО «Ай-Технолоджис Групп»: единая спокойная кнопка закрытия для всех боковых панелей. */
.drawer-close-button {
    flex: 0 0 32px;
    height: 32px;
    width: 32px;
    min-width: 32px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 5px;
    color: var(--color-ink);
    font-family: Arial, sans-serif;
    font-size: 1.2rem;
    font-weight: 400;
    line-height: 1;
}

.drawer-close-button:hover:not(:disabled) {
    background: #f3f7f1;
    border-color: #bfd6b9;
    box-shadow: none;
    transform: none;
}

.project-drawer-body {
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 18px 20px 28px;
}

.project-drawer-body section + section {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--color-line);
}

.project-drawer-body h3 {
    margin: 0 0 11px;
    font-size: .9rem;
}

/* #ADG Панель обратной связи повторяет спокойную офисную геометрию остальных боковых панелей. */
.feedback-drawer {
    width: min(480px, 100vw);
}

.feedback-drawer .project-drawer-heading small {
    color: var(--color-muted);
    display: block;
    font-size: .68rem;
    font-weight: 700;
    margin-bottom: 2px;
    text-transform: uppercase;
}

.feedback-tabs {
    background: #f7f9f6;
    border-bottom: 1px solid var(--color-line);
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0 20px;
}

.feedback-tabs button {
    background: transparent;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    color: var(--color-muted);
    font-size: .78rem;
    font-weight: 700;
    min-height: 40px;
}

.feedback-tabs button.is-active {
    border-bottom-color: var(--color-brand);
    color: var(--color-brand-dark);
}

.feedback-tabs button span {
    background: #e8eee5;
    border-radius: 3px;
    font-size: .66rem;
    margin-left: 4px;
    padding: 1px 4px;
}

.feedback-drawer-body {
    flex: 1;
}

.feedback-section-heading {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 12px;
}

.feedback-section-heading h3 {
    margin: 0 0 3px;
}

.feedback-section-heading p,
.feedback-inline-status {
    color: var(--color-muted);
    font-size: .76rem;
    line-height: 1.4;
    margin: 0;
}

.feedback-search-row {
    display: grid;
    gap: 6px;
    grid-template-columns: minmax(0, 1fr) 34px;
}

.feedback-search-row input,
.feedback-form input,
.feedback-form textarea,
.office-filter-row input {
    border: 1px solid var(--color-line);
    border-radius: 4px;
    font: inherit;
    min-height: 34px;
    padding: .42rem .55rem;
    width: 100%;
}

.feedback-search-row button {
    min-width: 34px;
    padding: 0;
}

.feedback-inline-status {
    padding: 12px 0 2px;
}

.feedback-wiki-results,
.feedback-request-list {
    border: 1px solid var(--color-line);
    border-radius: 4px;
    display: grid;
    margin-top: 10px;
    overflow: hidden;
}

.feedback-wiki-results a,
.feedback-request-list a {
    color: var(--color-ink);
    display: grid;
    gap: 3px;
    padding: 9px 10px;
    text-decoration: none;
}

.feedback-wiki-results a + a,
.feedback-request-list a + a {
    border-top: 1px solid var(--color-line);
}

.feedback-wiki-results a:hover,
.feedback-request-list a:hover {
    background: var(--color-brand-soft);
}

.feedback-wiki-results strong,
.feedback-request-list strong {
    font-size: .8rem;
}

.feedback-wiki-results span,
.feedback-request-meta,
.feedback-request-number {
    color: var(--color-muted);
    font-size: .7rem;
}

.feedback-form,
.feedback-form label,
.feedback-editor-field {
    display: grid;
    gap: 7px;
}

.feedback-form {
    gap: 13px;
}

.feedback-form label > span,
.feedback-editor-field > span {
    font-size: .76rem;
    font-weight: 700;
}

.feedback-form textarea {
    min-height: 130px;
    resize: vertical;
}

/* #ADG Редактор обращения использует тот же набор действий, что и заявка, но переносит их внутри узкой боковой панели. */
.feedback-editor-toolbar {
    align-items: center;
    box-shadow: none;
    flex-wrap: wrap;
    gap: 4px;
    padding: 5px;
    position: static !important;
}

.feedback-editor-toolbar button,
.feedback-editor-toolbar .editor-file-button {
    min-height: 28px;
    padding: 4px 7px;
}

.feedback-editor-toolbar .editor-icon-button {
    padding: 0;
}

.feedback-rich-editor {
    max-height: 42vh;
    min-height: 150px;
    overflow: auto;
    padding: 10px 11px;
}

.feedback-rich-editor:empty::before {
    color: #889486;
    content: attr(data-placeholder);
    pointer-events: none;
}

.feedback-rich-editor img {
    height: auto;
    max-width: 100%;
}

.feedback-form-actions {
    display: flex;
    justify-content: flex-end;
}

.feedback-queue-link {
    margin-top: 14px;
    text-decoration: none;
}

.notice-banner-warning {
    background: #fffbea;
    border-color: #e7d595;
    color: #725817;
}

.office-filter-row {
    align-items: center;
    border-bottom: 1px solid var(--color-line);
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(240px, 1fr) auto auto;
    padding: 10px 12px;
}

.office-check-control {
    align-items: center;
    display: inline-flex;
    font-size: .76rem;
    gap: 6px;
    white-space: nowrap;
}

.office-table-scroll {
    min-width: 0;
    /* #ADG: таблица удерживает только горизонтальный жест. Вертикальное колесо
       передаётся рабочей области страницы, даже когда указатель находится над строками. */
    overscroll-behavior-x: contain;
    overscroll-behavior-y: auto;
    overflow-x: auto;
    scrollbar-gutter: stable;
}

/* #ADG: AI-помощник оформлен немодальным плавающим чатом и находится вне
   scroll-контейнера заявки. Нижний правый угол остаётся стабильным при любой
   прокрутке карточки, а длинный диалог прокручивается только внутри помощника. */
.ticket-ai-widget {
    position: fixed;
    inset-inline-end: 18px;
    inset-block-end: 18px;
    z-index: 940;
    display: flex;
    width: min(410px, calc(100vw - 28px));
    height: min(660px, calc(100dvh - 104px));
    min-height: 360px;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #b9cdb5;
    border-radius: 8px;
    background: var(--color-surface);
    box-shadow: 0 12px 34px rgba(26, 46, 25, .18);
    animation: ticket-ai-widget-in .16s ease-out;
}

.ticket-ai-widget.is-minimized {
    width: auto;
    height: auto;
    min-height: 0;
    border-radius: 7px;
}

@keyframes ticket-ai-widget-in {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.ticket-ai-widget-heading {
    display: flex;
    align-items: center;
    gap: 9px;
    flex: 0 0 auto;
    min-height: 54px;
    padding: 9px 10px;
    border-bottom: 1px solid var(--color-line);
    background: #f8f9fd;
}

.ticket-ai-widget-icon {
    display: inline-flex;
    width: 32px;
    height: 32px;
    flex: 0 0 32px;
    align-items: center;
    justify-content: center;
    border: 1px solid #b9d2b4;
    border-radius: 6px;
    background: #f1f3ff;
    color: var(--color-brand-dark);
    font-size: .95rem;
}

.ticket-ai-widget-icon .oi,
.ticket-ai-widget-action .oi,
.ticket-ai-send .oi {
    top: 0;
    line-height: 1;
}

.ticket-ai-widget-title {
    display: grid;
    min-width: 0;
    gap: 2px;
}

.ticket-ai-widget-title strong {
    overflow: hidden;
    font-size: .88rem;
    line-height: 1.2;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-ai-widget-title small {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: var(--color-muted);
    font-size: .72rem;
}

.ticket-ai-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #3f9840;
    box-shadow: 0 0 0 2px #dcefd8;
}

.ticket-ai-widget-actions {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    margin-left: auto;
}

.ticket-ai-widget-action.icon-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    min-width: 30px;
    padding: 0;
    border-color: transparent;
    border-radius: 5px;
    background: transparent;
    color: var(--color-muted);
    font-size: .9rem;
}

.ticket-ai-widget-action.icon-button:hover:not(:disabled),
.ticket-ai-widget-action.icon-button:focus-visible {
    border-color: #bfd6b9;
    background: #edf5eb;
    color: var(--color-brand-dark);
    box-shadow: none;
    transform: none;
}

.ticket-ai-widget-launcher {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    gap: 9px;
    min-width: 172px;
    padding: 8px 11px;
    border: 0;
    background: #f8f9fd;
    color: var(--color-ink);
    cursor: pointer;
    text-align: left;
}

.ticket-ai-widget-launcher:hover,
.ticket-ai-widget-launcher:focus-visible {
    background: #eef6eb;
    outline: none;
}

.ticket-ai-widget-launcher > span:last-child {
    display: grid;
    gap: 1px;
}

.ticket-ai-widget-launcher strong {
    font-size: .8rem;
}

.ticket-ai-widget-launcher small {
    color: var(--color-muted);
    font-size: .68rem;
}

.ticket-ai-widget-body {
    display: grid;
    align-content: start;
    flex: 1 1 auto;
    min-height: 0;
    gap: 11px;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 11px;
    scrollbar-gutter: stable;
}

.ticket-ai-quota {
    display: grid;
    gap: 7px;
    padding: 8px 10px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
    background: var(--color-surface-muted);
    color: var(--color-muted);
    font-size: .82rem;
}

.ticket-ai-quota > div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.ticket-ai-quota strong {
    color: var(--color-ink);
}

.ticket-ai-quota progress {
    width: 100%;
    height: 4px;
    overflow: hidden;
    border: 0;
    border-radius: 2px;
    background: #dce6d9;
    color: var(--color-brand);
}

.ticket-ai-quota progress::-webkit-progress-bar {
    background: #dce6d9;
}

.ticket-ai-quota progress::-webkit-progress-value {
    background: var(--color-brand);
}

.ticket-ai-quota progress::-moz-progress-bar {
    background: var(--color-brand);
}

.ticket-ai-welcome {
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr);
    align-items: start;
    gap: 9px;
    max-width: 92%;
    padding: 10px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
    background: #f8f9fd;
}

.ticket-ai-welcome > div {
    display: grid;
    gap: 3px;
}

.ticket-ai-welcome strong {
    font-size: .8rem;
}

.ticket-ai-welcome p {
    margin: 0;
    color: var(--color-muted);
    font-size: .78rem;
    line-height: 1.4;
}

.ticket-ai-history {
    display: grid;
    gap: 7px;
}

.ticket-ai-history h3 {
    margin: 0 0 2px;
    font-size: .84rem;
}

.ticket-ai-history-message {
    display: grid;
    gap: 4px;
    max-width: 92%;
    padding: 8px 10px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
    background: var(--color-surface);
}

.ticket-ai-history-message.is-user {
    justify-self: end;
    border-color: #bad8b5;
    background: #f2f8f0;
}

.ticket-ai-history-message strong {
    font-size: .72rem;
}

.ticket-ai-history-message p {
    margin: 0;
    font-size: .8rem;
    line-height: 1.4;
    white-space: pre-wrap;
}

.ticket-ai-composer {
    display: grid;
    flex: 0 0 auto;
    gap: 6px;
    padding: 9px 10px 10px;
    border-top: 1px solid var(--color-line);
    background: #fafaff;
}

.ticket-ai-composer > label {
    font-size: .72rem;
    font-weight: 700;
}

.ticket-ai-composer-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 36px;
    align-items: end;
    gap: 6px;
}

.ticket-ai-composer textarea {
    box-sizing: border-box;
    min-height: 58px;
    max-height: 116px;
    padding: 8px 9px;
    resize: vertical;
}

.ticket-ai-send.primary-action {
    display: inline-flex;
    align-items: center;
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 0;
    justify-content: center;
    border-radius: 6px;
}

.ticket-ai-composer > small {
    color: var(--color-muted);
    font-size: .68rem;
}

/* #ADG: На узких и низких экранах помощник сохраняет поля вокруг себя и не
   перекрывает верхнюю навигацию портала. Основная страница остаётся доступной. */
@media (max-width: 720px) {
    .ticket-ai-widget {
        right: 8px;
        bottom: 8px;
        width: calc(100vw - 16px);
        height: min(72dvh, 620px);
        max-height: calc(100dvh - 82px);
        min-height: 320px;
    }

    .ticket-ai-widget.is-minimized {
        width: auto;
        min-height: 0;
    }
}

@media (max-height: 620px) and (min-width: 721px) {
    .ticket-ai-widget {
        top: 76px;
        bottom: 10px;
        height: auto;
        min-height: 280px;
    }
}

.ticket-ai-result {
    display: grid;
    gap: 10px;
}

.ticket-ai-result-block {
    padding: 12px;
    border: 1px solid var(--color-line);
    border-radius: 6px;
    background: var(--color-surface);
}

.ticket-ai-result-block h3,
.ticket-ai-result-block p,
.ticket-ai-result-block ol {
    margin-top: 0;
}

.ticket-ai-result-block p,
.ticket-ai-result-block ol {
    margin-bottom: 0;
    line-height: 1.5;
    white-space: pre-wrap;
}

.ticket-ai-result-block ol {
    padding-left: 20px;
}

.ticket-ai-result-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.ticket-ai-result-heading span {
    color: var(--color-muted);
    font-size: .74rem;
}

.ticket-ai-reply {
    border-left: 3px solid var(--color-brand);
    background: #f8fbf7;
}

.ticket-ai-reply .primary-action {
    margin-top: 12px;
}

.ticket-ai-sources {
    display: grid;
    gap: 7px;
}

.ticket-ai-source {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 12px;
    padding: 9px 10px;
    border: 1px solid var(--color-line);
    border-radius: 5px;
    color: inherit;
    text-decoration: none;
}

.ticket-ai-source:hover,
.ticket-ai-source:focus-visible {
    border-color: #9fc598;
    background: #f4f9f2;
}

.ticket-ai-source strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ticket-ai-source span,
.ticket-ai-source small {
    color: var(--color-muted);
    font-size: .74rem;
}

.ticket-ai-source small {
    grid-column: 1 / -1;
    line-height: 1.35;
}

/* #ADG: результаты действий в карточке накладываются поверх рабочей области,
   поэтому появление уведомления не меняет положение заголовка и содержимого заявки. */
.ticket-toast-region {
    display: grid;
    gap: 8px;
    max-width: min(420px, calc(100vw - 32px));
    position: fixed;
    right: 20px;
    top: 64px;
    width: max-content;
    z-index: 1300;
}

.ticket-toast {
    align-items: center;
    animation: ticket-toast-in .18s ease-out;
    background: var(--color-surface);
    border: 1px solid var(--color-line);
    border-left: 4px solid var(--color-brand);
    border-radius: 5px;
    box-shadow: 0 10px 28px rgb(28 45 30 / 18%);
    color: var(--color-ink);
    display: grid;
    font-size: .78rem;
    gap: 9px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    line-height: 1.35;
    min-width: 260px;
    padding: 10px 8px 10px 11px;
}

.ticket-toast > .oi {
    color: var(--color-brand-dark);
    font-size: .78rem;
}

.ticket-toast > button {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 3px;
    color: var(--color-muted);
    display: inline-flex;
    font-size: 1rem;
    height: 24px;
    justify-content: center;
    padding: 0;
    width: 24px;
}

.ticket-toast > button:hover,
.ticket-toast > button:focus-visible {
    background: var(--color-brand-soft);
    color: var(--color-brand-dark);
    outline: none;
}

.ticket-toast-error {
    border-left-color: #b23b32;
}

.ticket-toast-error > .oi {
    color: #b23b32;
}

@keyframes ticket-toast-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
    .ticket-toast-region {
        left: 12px;
        max-width: none;
        right: 12px;
        top: 12px;
        width: auto;
    }
}

.ticket-assignee-picker { border:1px solid var(--color-line); border-radius:6px; display:grid; gap:6px; max-height:190px; overflow-y:auto; padding:8px 10px 10px; }
.ticket-assignee-picker legend { font-size:.76rem; font-weight:600; padding:0 4px; }
.ticket-assignee-picker label { align-items:center; display:flex; flex-direction:row; gap:7px; }
.ticket-assignee-picker input { height:15px; margin:0; width:15px; }
.ticket-assignee-edit-field { display:grid; gap:6px; position:relative; }
.ticket-assignee-edit-field > span { font-size:.76rem; font-weight:600; }
.ticket-assignee-select { display:grid; gap:6px; min-width:0; }
.ticket-assignee-trigger { align-items:center; background:#fff; border:1px solid var(--color-line); border-radius:6px; color:var(--color-ink); display:flex; font:inherit; justify-content:space-between; min-height:34px; padding:6px 10px; text-align:left; width:100%; }
.ticket-assignee-select.is-open .ticket-assignee-trigger { border-color:var(--color-brand); box-shadow:0 0 0 2px color-mix(in srgb, var(--color-brand) 14%, transparent); }
.ticket-assignee-trigger .oi { color:var(--color-muted); font-size:.65rem; }
.ticket-assignee-selected { display:flex; flex-wrap:wrap; gap:5px; }
.ticket-assignee-chip { align-items:center; background:var(--color-brand-soft); border:1px solid var(--color-brand-line); border-radius:999px; color:var(--color-brand-dark); display:inline-flex; font-size:.72rem; gap:5px; max-width:100%; padding:3px 5px 3px 8px; }
.ticket-assignee-chip > button { align-items:center; background:transparent; border:0; border-radius:50%; color:inherit; display:inline-flex; font-size:15px; height:18px; justify-content:center; line-height:1; padding:0; width:18px; }
.ticket-assignee-chip > button:hover { background:rgba(255,255,255,.7); }
/* #ADG Потоковый список не перекрывает соседние поля в модальном создании и не обрезается контейнером с прокруткой. */
.ticket-assignee-dropdown { background:#fff; border:1px solid var(--color-brand-line); border-radius:6px; box-shadow:0 10px 26px rgba(19,27,46,.16); min-width:0; padding:7px; }
.ticket-assignee-search { box-sizing:border-box; margin:0 0 6px; width:100%; }
.ticket-assignee-options { display:grid; max-height:220px; overflow-y:auto; }
.ticket-assignee-option { align-items:center; background:transparent; border:0; border-radius:4px; color:var(--color-ink); display:flex; font:inherit; justify-content:space-between; min-height:32px; padding:6px 8px; text-align:left; width:100%; }
.ticket-assignee-option:hover, .ticket-assignee-option.is-selected { background:var(--color-brand-soft); color:var(--color-brand-dark); }
.ticket-assignee-option .oi { font-size:.7rem; }
.ticket-assignee-empty { color:var(--color-muted); font-size:.75rem; padding:9px 8px; }
.ticket-work-acceptance {
    /* #ADG: до принятия заявки блок занимает ту же нижнюю sticky-позицию, что и композер. */
    position: sticky;
    bottom: 0;
    z-index: 4;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px 16px;
    padding: 12px;
    margin: auto -1px -1px;
    border: 1px solid var(--color-brand-line);
    border-radius: var(--office-control-radius, 4px);
    background: var(--color-surface);
    color: var(--color-ink-soft);
    box-shadow: 0 -8px 18px rgba(38, 61, 35, .06);
}
