/*─────────────────── заметки к объектам (ts_uicontrol_part1.ts) ───────────────────
  Иконка в шапке карточки, модальное окно заметок и баннер поверх карточки.
  Цвета берём из токенов темы (--surface-*, --fore-color), а не «утопленных»
  светлых поверхностей — иначе в тёмной теме строки становятся белыми.
  -------------------------------------------------------------------------------- */

/* иконка в шапке окна: между прогресс-баром (right: 110px) и кнопкой масштабирования (right: 46px) */
.ui-dialog .notes_icon {
    position: absolute;
    top: 2px;
    right: 78px;
    width: 18px;
    height: 18px;
    cursor: pointer;
    font-size: 14px;
    line-height: 18px;
    text-align: center;
    opacity: 0.9;
    user-select: none;
}

    .ui-dialog .notes_icon:hover {
        opacity: 1;
    }

    .ui-dialog .notes_icon.has_reprimand {
        filter: drop-shadow(0 0 4px #e5484d);
    }

    .ui-dialog .notes_icon .notes_badge {
        position: absolute;
        top: -6px;
        right: -8px;
        min-width: 14px;
        height: 14px;
        padding: 0 3px;
        border-radius: 7px;
        font-size: 9px;
        line-height: 14px;
        text-align: center;
        color: #fff;
        background: var(--color-skyblue, #3aa0ff);
    }

    .ui-dialog .notes_icon.has_reprimand .notes_badge {
        background: var(--color-red, #e5484d);
    }

/*──────────────────────────── баннер поверх карточки ────────────────────────────*/

.notes_host {
    position: relative;
}

.notes_banner_layer {
    position: absolute;
    inset: 0;
    z-index: 60;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 18px;
    background: rgba(16, 16, 20, 0.62);
    backdrop-filter: blur(2px);
}

.notes_banner_box {
    max-width: 620px;
    width: 100%;
    max-height: 90%;
    overflow: auto;
    padding: 14px 16px;
    border-radius: 10px;
    background: var(--surface-card, #2b2c2f);
    color: var(--fore-color, #f0f0f0);
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.14));
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

.notes_banner_head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.notes_banner_title {
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--color-yellow, #ffb020);
}

.notes_banner_close {
    cursor: pointer;
    font-size: 14px;
    padding: 2px 6px;
    border-radius: 4px;
}

    .notes_banner_close:hover {
        background: rgba(255, 255, 255, 0.08);
    }

.notes_banner_text {
    font-size: 14px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
}

.notes_banner_author {
    margin-top: 8px;
    font-size: 11px;
    opacity: 0.7;
}

/*──────────────────────────── окно заметок ────────────────────────────*/

.notes_modal {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 620px;
    max-width: 92vw;
    max-height: 72vh;
    padding: 4px;
    box-sizing: border-box;
}

    .notes_modal button {
        width: auto !important;
        height: auto !important;
        min-height: 26px;
        flex: 0 0 auto;
    }

.notes_toolbar {
    display: flex;
    justify-content: flex-end;
}

.notes_add {
    padding: 4px 10px !important;
    font-size: 12px;
}

.notes_list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    overflow: auto;
    max-height: 34vh;
    padding-right: 4px;
}

.notes_empty {
    opacity: 0.7;
    font-size: 12px;
}

.notes_row {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    background: var(--surface-card, #2b2c2f);
    color: var(--fore-color, #f0f0f0);
    box-sizing: border-box;
}

.notes_head {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.notes_status {
    font-size: 12px;
    color: var(--color-meta, #999);
}

    .notes_status.is_active {
        color: var(--color-green, #35c759);
    }

    .notes_status.is_wait {
        color: var(--color-yellow, #ffb020);
    }

    .notes_status.is_off {
        color: var(--color-meta, #999);
    }

.notes_type {
    font-weight: 600;
}

    .notes_type.t2 {
        color: var(--color-yellow, #ffb020);
    }

    .notes_type.t3 {
        color: var(--color-red, #e5484d);
    }

.notes_roles {
    opacity: 0.8;
}

.notes_off_label {
    opacity: 0.9;
    color: var(--color-meta, #999);
    font-style: italic;
}

.notes_wait_label {
    opacity: 0.9;
    color: var(--color-yellow, #ffb020);
    font-style: italic;
}

.notes_text {
    font-size: 13px;
    line-height: 1.45;
    white-space: pre-wrap;
    word-break: break-word;
    color: inherit;
}

.notes_meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    font-size: 11px;
    opacity: 0.75;
}

.notes_reason_text {
    width: 100%;
    font-style: italic;
}

.notes_actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
}

.notes_btn {
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 13px;
    user-select: none;
}

    .notes_btn:hover {
        background: rgba(255, 255, 255, 0.1);
    }

    .notes_btn.del:hover {
        background: rgba(229, 72, 77, 0.2);
    }

.notes_deactivate {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.notes_reason_input {
    flex: 1 1 220px;
    min-width: 160px;
}

.notes_deactivate_btn {
    padding: 3px 10px !important;
    font-size: 12px;
}

/*──────────────────────────── форма ────────────────────────────*/

.notes_form {
    display: flex;
    flex-direction: column;
    gap: 6px;
    border-top: 1px solid var(--border-color, rgba(255, 255, 255, 0.12));
    padding-top: 10px;
}

.notes_form_title {
    font-weight: 600;
    font-size: 13px;
}

.notes_field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    min-height: 0;
}

    .notes_field.column {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }

.notes_label {
    flex: 0 0 118px;
    font-size: 12px;
    opacity: 0.8;
}

/*---- контролы формы: свои размеры и цвета, независимо от глобальных стилей ----*/

.notes_modal input[type="text"],
.notes_modal input[type="date"],
.notes_modal textarea,
.notes_modal select {
    flex: 1 1 auto;
    width: auto;
    min-height: 26px;
    margin: 0;
    padding: 3px 8px;
    font-family: inherit;
    font-size: 12.5px;
    line-height: 1.3;
    color: var(--fore-color, #f0f0f0);
    background: var(--surface-panel, rgba(255, 255, 255, 0.06));
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.18));
    border-radius: 6px;
    box-sizing: border-box;
}

    .notes_modal input[type="date"] {
        flex: 0 0 130px;
        width: 130px;
    }

    .notes_modal textarea {
        /*---- не растягиваем: иначе между подписью и полем появляется «воздух» ----*/
        flex: 0 0 auto;
        width: 100%;
        height: 84px;
        min-height: 84px;
        max-height: 200px;
        resize: vertical;
        line-height: 1.4;
    }

    .notes_modal select {
        flex: 0 0 180px;
        width: 180px;
    }

    .notes_modal select option {
        color: var(--fore-color, #f0f0f0);
        background: var(--surface-card, #2b2c2f);
    }

/*---- тип заметки: три кнопки с эмодзи над полем текста ----*/

.notes_type_buttons {
    display: flex;
    gap: 6px;
    align-items: center;
    padding: 2px 0;
}

.notes_modal .notes_type_btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: auto !important;
    height: 30px !important;
    min-height: 30px;
    padding: 0 12px !important;
    font-size: 12.5px;
    line-height: 1;
    border-radius: 8px;
    border: 1px solid var(--border-color, rgba(255, 255, 255, 0.16));
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.12s ease, border-color 0.12s ease;
    white-space: nowrap;
}

    .notes_modal .notes_type_btn:hover {
        opacity: 1;
    }

    .notes_modal .notes_type_btn.selected {
        opacity: 1;
        border-color: var(--color-skyblue, #3aa0ff);
        box-shadow: inset 0 0 0 1px var(--color-skyblue, #3aa0ff);
    }

/*---- чекбокс «разрешить деактивацию не автору» ----*/

.notes_field .checkbox,
.notes_field input[type="checkbox"] {
    flex: 0 0 auto;
}

.notes_text_input {
    display: block;
    margin: 0 !important;
}

.notes_dash {
    opacity: 0.6;
    flex: 0 0 auto;
}

.notes_roles_btn {
    padding: 3px 10px !important;
    font-size: 12px;
}

.notes_form_actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    padding-top: 4px;
}

.notes_cancel {
    padding: 4px 10px !important;
    font-size: 12px;
}
