/* Глобальные заметки панели — TSK25 / ФБ / ФСБЦ */
.sk-notes-mount {
    display: inline-flex;
    align-items: center;
    margin-left: auto;
    flex: 0 0 auto;
}

/* Иконка ФСБЦ — фирменный светло-бежевый чип */
.sk-notes-icon {
    position: relative;
    z-index: 1;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border-radius: 999px;
    border: 1px solid #e2ddd4;
    background: var(--c25-brand-beige, var(--sk-brand-beige, #f8f6f1));
    color: var(--c25-brand-dark, #127023);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    /* без тени/кольца — иначе «двойная» кнопка-призрак рядом с +Нить */
    box-shadow: none;
    float: none;
    transform: none;
}
.sk-notes-icon:hover,
.sk-notes-icon[aria-expanded="true"] {
    border-color: var(--c25-brand, #497952);
    color: var(--c25-brand-dark, #127023);
    background: #f3f0e9;
    box-shadow: none;
}
.sk-notes-icon::before,
.sk-notes-icon::after {
    content: none !important;
    display: none !important;
}
.sk-notes-icon__glyph {
    display: inline-flex;
    width: 18px;
    height: 18px;
    color: var(--c25-brand, #497952);
}
.sk-notes-icon__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}
.sk-notes-icon__label {
    line-height: 1;
}

/* Единый mount у штатного admin-title: иконка прокручивается вместе с заголовком. */
.sk-notes-admin-title-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    max-width: 100%;
}
.sk-notes-admin-title-row .sk-notes-mount {
    margin-left: 0;
}
.sk-notes-admin-title-row .sk-notes-icon {
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
    border-color: var(--c25-line, #d7ddd3);
    background: var(--c25-brand-soft, #e8efe6);
}
.sk-notes-admin-title-row .sk-notes-icon:hover,
.sk-notes-admin-title-row .sk-notes-icon:focus-visible,
.sk-notes-admin-title-row .sk-notes-icon[aria-expanded="true"] {
    border-color: var(--c25-brand, #497952);
    background: var(--c25-brand-beige, #f8f6f1);
}
.sk-notes-admin-title-row .sk-notes-icon__glyph {
    width: 28px;
    height: 28px;
}
.sk-notes-admin-title-row .sk-notes-icon__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.sk-notes-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100040;
    background: rgba(61, 68, 56, 0.22);
    opacity: 0;
    transition: opacity 0.22s ease;
    /* не участвует в flex toolbar/actions, куда PHP вставляет разметку */
    margin: 0 !important;
    float: none !important;
}
.sk-notes-backdrop.is-open {
    opacity: 1;
}
/* display:flex на drawer иначе перебивает [hidden] → «призрак» в ряду кнопок */
.sk-notes-drawer[hidden],
.sk-notes-backdrop[hidden] {
    display: none !important;
}

.sk-notes-drawer {
    --sk-notes-drawer-w: min(420px, 100vw);
    /* узкая рельса ресайза: контент стартует правее hit-area */
    --sk-notes-grip-w: 8px;
    position: fixed;
    top: 0;
    right: 0;
    /* выше .icons_right (99991) — иначе сайд-иконки поверх листка */
    z-index: 100050;
    width: var(--sk-notes-drawer-w);
    height: 100%;
    max-height: 100dvh;
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    padding-left: var(--sk-notes-grip-w);
    background: var(--c25-brand-beige, var(--sk-brand-beige, #f8f6f1));
    border-left: 1px solid #e2ddd4;
    box-shadow: -12px 0 40px rgba(61, 68, 56, 0.14);
    transform: translateX(100%);
    transition: transform 0.28s ease;
    color: var(--c25-ink, #3d4438);
    overflow: hidden;
    margin: 0 !important;
    float: none !important;
}
.sk-notes-drawer.is-open {
    transform: translateX(0);
}
.sk-notes-drawer.is-resizing {
    transition: none;
}

/*
 * Hit-area ресайза — без pill/::after (белая «кнопка-призрак»).
 * Подсветка только тонкой полоской border на hover/drag.
 */
.sk-notes-drawer__resize {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sk-notes-grip-w);
    z-index: 6;
    cursor: ew-resize;
    touch-action: none;
    background: transparent;
    border: 0;
    border-radius: 0;
    padding: 0;
    margin: 0;
    box-shadow: none;
}
.sk-notes-drawer__resize::before,
.sk-notes-drawer__resize::after {
    content: none !important;
    display: none !important;
}
.sk-notes-drawer__resize:hover,
.sk-notes-drawer__resize:focus-visible,
body.sk-notes-resizing .sk-notes-drawer__resize {
    background: rgba(73, 121, 82, 0.18);
}
.sk-notes-drawer__resize:focus-visible {
    outline: none;
}
body.sk-notes-resizing {
    cursor: ew-resize !important;
    user-select: none !important;
}
body.sk-notes-resizing * {
    cursor: ew-resize !important;
    user-select: none !important;
}

.sk-notes-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 14px 16px 10px 18px;
    border-bottom: 1px solid #e2ddd4;
    background: rgba(255, 255, 255, 0.45);
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}
.sk-notes-drawer button,
.sk-notes-drawer select,
.sk-notes-drawer textarea {
    /* изоляция от adm-btn / absolute float в админке Bitrix */
    position: relative;
    left: auto;
    right: auto;
    top: auto;
    bottom: auto;
    float: none !important;
    max-width: 100%;
    transform: none;
}
.sk-notes-drawer button::before,
.sk-notes-drawer button::after {
    /* убрать чужие декоративные псевдо-кнопки */
    content: none !important;
}
.sk-notes-drawer__close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid #e2ddd4;
    background: #fff;
    color: var(--c25-brand-dark, #127023);
    font-size: 16px;
    cursor: pointer;
}
.sk-notes-drawer__close:hover {
    border-color: var(--c25-brand, #497952);
    background: var(--c25-brand-soft, #e8efe6);
}

.sk-notes-drawer__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 14px 10px 18px;
    border-bottom: 1px solid #e2ddd4;
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
}
.sk-notes-theme-chip {
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid #d4e0d0;
    background: var(--c25-brand-soft, #e8efe6);
    color: var(--c25-brand-dark, #127023);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
}
.sk-notes-theme-chip:hover {
    border-color: var(--c25-brand, #497952);
    background: var(--c25-brand-softest, #f3f7f2);
}
.sk-notes-theme-chip.is-active {
    background: var(--c25-brand, #497952);
    color: #fff;
    border-color: var(--c25-brand, #497952);
}

.sk-notes-drawer__composer {
    padding: 12px 14px 12px 18px;
    border-bottom: 1px solid #e2ddd4;
    background: rgba(255, 255, 255, 0.35);
    flex: 0 0 auto;
    position: relative;
    z-index: 1;
    min-width: 0;
}
.sk-notes-drawer__composer-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--c25-muted, #8a9a86);
    margin-bottom: 6px;
}
.sk-notes-input,
.sk-notes-select {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #e2ddd4;
    border-radius: 10px;
    padding: 8px 10px;
    font: inherit;
    font-size: 14px;
    color: var(--c25-ink, #3d4438);
    background: #fff;
    resize: vertical;
}
.sk-notes-input:focus,
.sk-notes-select:focus {
    outline: none;
    border-color: var(--c25-brand, #497952);
    box-shadow: 0 0 0 2px rgba(73, 121, 82, 0.15);
}
.sk-notes-drawer__composer-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}
.sk-notes-drawer__theme-pick {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--c25-muted, #8a9a86);
}
.sk-notes-drawer__theme-pick .sk-notes-select {
    width: auto;
    min-width: 120px;
    padding: 6px 8px;
    font-size: 13px;
}
.sk-notes-drawer__theme-pick--custom {
    flex: 1 1 160px;
    min-width: 0;
}
.sk-notes-theme-input {
    width: 100%;
    min-width: 0;
    padding: 6px 8px;
    font-size: 13px;
    resize: none;
}
.sk-notes-drawer__hint {
    margin: 8px 0 0;
    font-size: 12px;
    line-height: 1.4;
    color: var(--c25-muted, #8a9a86);
}
.sk-notes-drawer__guest {
    display: grid;
    gap: 14px;
    justify-items: start;
    padding: 22px 18px 28px;
}
.sk-notes-drawer__guest p {
    margin: 0;
    color: var(--c25-text, #4f574b);
    font-size: 14px;
    line-height: 1.45;
}
.sk-notes-drawer__guest .sk-notes-btn {
    text-decoration: none;
}

.sk-notes-vis-toggle {
    min-width: 42px;
    height: 34px;
    padding: 0 10px;
    border-radius: 999px;
    border: 1px solid #e2ddd4;
    background: #fff;
    color: var(--c25-brand-dark, #127023);
    font: inherit;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.sk-notes-vis-toggle[data-vis="shared"] {
    background: var(--c25-brand-soft, #e8efe6);
    border-color: #d4e0d0;
}
.sk-notes-vis-toggle:hover {
    border-color: var(--c25-brand, #497952);
}

.sk-notes-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}
.sk-notes-btn--primary {
    background: var(--c25-brand, #497952);
    color: #fff;
    margin-left: auto;
}
.sk-notes-btn--primary:hover {
    background: var(--c25-brand-dark, #127023);
}
.sk-notes-btn--ghost {
    background: #fff;
    color: var(--c25-brand-dark, #127023);
    border-color: #e2ddd4;
}
.sk-notes-btn--danger {
    background: #fdf5f5;
    color: #a94444;
    border-color: #f0cfcf;
}
.sk-notes-btn--danger:hover {
    background: #c45c5c;
    color: #fff;
}
.sk-notes-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* Листок: разлинованный фон ФБ */
.sk-notes-paper {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: visible;
    overflow-y: auto;
    padding: 10px 14px 28px 16px;
    min-width: 0;
    background-color: var(--c25-brand-beige, var(--sk-brand-beige, #f8f6f1));
    /* одна красная «поля» слева — НЕ repeat по X (иначе сетка и артефакты) */
    background-image:
        linear-gradient(
            90deg,
            transparent 0,
            transparent 15px,
            rgba(200, 80, 80, 0.22) 15px,
            rgba(200, 80, 80, 0.22) 16px,
            transparent 16px
        ),
        repeating-linear-gradient(
            to bottom,
            transparent 0,
            transparent 27px,
            rgba(73, 121, 82, 0.12) 27px,
            rgba(73, 121, 82, 0.12) 28px
        );
    background-size: 100% 100%, 100% 28px;
    background-repeat: no-repeat, repeat;
    background-position: 0 0, 0 4px;
    background-attachment: local;
    -webkit-overflow-scrolling: touch;
    position: relative;
    z-index: 1;
}

.sk-notes-empty {
    margin: 24px 12px;
    color: var(--c25-muted, #8a9a86);
    font-size: 14px;
    font-weight: 600;
}

/*
 * Карточка заметки.
 * Evidence (crop 54×196): «призраки» сверху/снизу = stroke #e2ddd4
 * собственной border-radius карточки (верхняя линия + нижний угол),
 * плюс контент вплотную к левому краю. Убираем 1px border → только
 * мягкая тень; фон непрозрачный; нормальный padding.
 */
.sk-notes-card {
    position: relative;
    margin: 0 0 12px;
    padding: 12px 12px 12px 14px;
    border-radius: 12px;
    background: #fff;
    border: 0;
    box-shadow:
        0 0 0 1px rgba(226, 221, 212, 0.55),
        0 1px 2px rgba(61, 68, 56, 0.04);
    max-width: 100%;
    box-sizing: border-box;
    overflow: visible;
}
.sk-notes-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}
.sk-notes-card__theme {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.02em;
    color: var(--c25-brand, #497952);
    background: var(--c25-brand-soft, #e8efe6);
    border-radius: 999px;
    padding: 2px 8px;
    /* не давать чипу вылезать под обрезку предка */
    max-width: 100%;
    box-sizing: border-box;
}
.sk-notes-card__author {
    font-size: 11px;
    color: var(--c25-muted, #8a9a86);
    font-weight: 600;
}
.sk-notes-card__body {
    margin: 0;
    white-space: pre-wrap;
    word-break: break-word;
    font-size: 14px;
    line-height: 1.55;
    color: var(--c25-ink, #3d4438);
    min-height: 1.55em;
}
.sk-notes-card__body.is-editable {
    cursor: text;
    /* Тап редактирует текст, жест прокрутки drawer остаётся нативным. */
    touch-action: manipulation;
    border-radius: 8px;
    padding: 2px 4px;
    margin: 0;
}
.sk-notes-card__body.is-editable:hover {
    background: var(--c25-brand-softest, #f3f7f2);
    box-shadow: none;
    outline: 1px solid #d4e0d0;
    outline-offset: 0;
}
.sk-notes-card__edit {
    display: block;
    width: 100%;
    box-sizing: border-box;
    margin: 0;
    border: 1px solid var(--c25-brand, #497952);
    border-radius: 8px;
    padding: 6px 8px;
    font: inherit;
    font-size: 14px;
    line-height: 1.55;
    color: var(--c25-ink, #3d4438);
    background: #fff;
    resize: vertical;
    min-height: 2.8em;
    box-shadow: 0 0 0 2px rgba(73, 121, 82, 0.15);
}
.sk-notes-card__edit:focus {
    outline: none;
}
.sk-notes-card__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    margin-top: 8px;
    max-width: 100%;
    min-width: 0;
}
.sk-notes-card__actions .sk-notes-vis-toggle {
    height: 30px;
    min-width: 38px;
    font-size: 12px;
}
.sk-notes-card__actions .sk-notes-btn {
    padding: 5px 10px;
    font-size: 12px;
}
.sk-notes-card__actions .sk-notes-btn--danger {
    margin-left: auto;
}

body.sk-notes-open {
    overflow: hidden;
}
/* сайд-иконки витрины (z-index 99991) не должны торчать поверх drawer */
body.sk-notes-open .icons_right,
body.sk-notes-open .sticky-content .icons_right {
    visibility: hidden !important;
    pointer-events: none !important;
}
/* Нижний floater задач не должен проникать в открытый drawer. */
body.sk-notes-open #sk-bug-floater {
    visibility: hidden !important;
    pointer-events: none !important;
}

@media (max-width: 480px) {
    .sk-notes-icon__label {
        display: none;
    }
    .sk-notes-drawer {
        --sk-notes-drawer-w: 100vw;
        --sk-notes-grip-w: 0px;
        width: 100vw;
        padding-left: 0;
    }
    .sk-notes-drawer__resize {
        display: none;
    }
}
