/*  ОСТРОВНОЙ-КОНТЕНТ (MAIN CONTENT)*/
.content-area {
    padding: 15px;
    margin-bottom: 12px;
    flex: 1;
}

.content-section {
    display: none;
}

/* Все секции скрыты по умолчанию */
.content-section.active {
    display: block;
}

/* ГЛАВНАЯ СЕТКА (MAIN GRID LAYOUT */
.main-content-grid {
    display: grid;
    grid-template-columns: var(--sidebar-width) 1fr;
    grid-template-areas: "sidebar right-column";
    gap: 12px ;
    max-width: var(--max-width);
    width: 100%;
    margin: 12px auto 0 auto;
    padding: 0 3px;
    flex: 1;
}

.right-column-wrapper {
    grid-area: right-column;
    display: flex;
    flex-direction: column;
    flex: 1;
}

/* САЙДБАР-ОСТРОВ (NAVIGATION)*/
.nav-link {
    text-decoration: none;
    color: var(--text-gray);
    padding: 12px 16px;
    border-radius: 12px;
    font-weight: 500;
    transition: all 0.2s ease;
}

.nav-link:hover:not(.active) {
    background: var(--bg-page);
    color: var(--primary);
}

.nav-link.active {
    background: var(--primary-light);
    color: white;
}

.nav-icon-img {
    width: 12px;
    height: 12px;
    margin-right: 5px;
    vertical-align: baseline;
}

.nav-link:hover .nav-icon-img {
    filter: brightness(1.2);
    transform: scale(1.1)
}

.nav-link.active .nav-icon-img {
    filter: grayscale(1) invert(1) brightness(2);
}

@media (max-width: 992px) {
    .nav-link {
        white-space: nowrap;
    }
}

/* ====================== PROFILE HERO ====================== */
.profile-hero {
    margin-bottom: 12px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
    height: 250px;
    display: flex;
    align-items: center;
    position: relative;
    overflow: hidden;
}

.profile-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Ccircle cx='30' cy='30' r='2' fill='white' fill-opacity='0.1'/%3E%3C/svg%3E");
    pointer-events: none;
}

.hero-content-horizontal {
    display: flex;
    align-items: center;
    gap: 25px;
    padding: 0 60px;
    z-index: 2;
    width: 100%;
}

/* По умолчанию скрываем шапку на всех вкладках */
.profile-hero {
    display: none !important;
}

/* Показываем её, если секция профиля НЕ скрыта (у неё нет display: none) */
.main-content-grid:has(#candidate-profile-section:not([style*="display: none"]):not([style*="display:none"])) .profile-hero,
.main-content-grid:has(#candidate-profile-section.active) .profile-hero {
    display: flex !important;
}

/* ПОКАЗЫВАЕМ ШАПКУ, ЕСЛИ АКТИВНЫ СЛЕДУЮЩИЕ СЕКЦИИ: */

/* 1. Секция профиля кандидата */
.main-content-grid:has(#candidate-profile-section:not([style*="display: none"]):not([style*="display:none"])) .profile-hero,
.main-content-grid:has(#candidate-profile-section.active) .profile-hero,

    /* 2. Секция "Мои публикации" работодателя (НОВОЕ УСЛОВИЕ) */
.main-content-grid:has(#my-publications-section:not([style*="display: none"]):not([style*="display:none"])) .profile-hero,
.main-content-grid:has(#my-publications-section.active) .profile-hero {
    display: flex !important;
}

/* --- АВАТАР --- */
.avatar-container-hero {
    width: 130px;
    height: 130px;
    border-radius: 24px;
    border: 3px solid rgba(255, 255, 255, 0.25);
    background: #ffffff;
    position: relative;
    overflow: hidden;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s ease;
}

.avatar-text-placeholder {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: var(--primary);
    font-weight: 700;
    font-size: 3rem;
    letter-spacing: -1px;
    user-select: none;
    line-height: 1;
    z-index: 1;
}

/* Оверлей при наведении (Камера) */
.avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.camera-icon {
    width: 28px;
    height: 28px;
    filter: brightness(0) invert(1);
    transform: translateY(15px);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.avatar-container-hero:hover .avatar-overlay {
    opacity: 1;
}

.avatar-container-hero:hover .camera-icon {
    transform: translateY(0);
}

.avatar-container-hero.is-uploading .avatar-overlay {
    opacity: 1;
    background: rgba(0, 0, 0, 0.6);
}

.avatar-container-hero.is-uploading .camera-icon {
    animation: cameraPulse 1.5s infinite ease-in-out;
}

@keyframes cameraPulse {
    0% {
        transform: scale(1);
        opacity: 0.8;
    }
    50% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
    }
}

/* Изображение аватара */
.avatar-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* CROPPER MODAL (Интерфейс обрезки) */
.cropper-overlay {
    position: fixed;
    inset: 0;
    background: #000000;
    z-index: 10000;
    display: flex;
    flex-direction: column;
}

.cropper-container-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
    width: 100%;
}

.cropper-header {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: #111111;
    color: white;
    border-bottom: 1px solid #222;
}

.cropper-cancel,
.cropper-confirm {
    background: none;
    border: none;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 8px;
    transition: background 0.2s;
}

.cropper-cancel:hover {
    background: rgba(255, 255, 255, 0.1);
}

.cropper-confirm:hover {
    background: rgba(59, 130, 246, 0.1);
}

.cropper-title {
    font-weight: 600;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}

.cropper-confirm {
    color: #3B82F6;
    font-weight: 700;
}

.cropper-body {
    flex: 1;
    position: relative;
    overflow: hidden;
    background: #000;
}

/* Область обрезки (настройки библиотеки) */
.cropper-view-box,
.cropper-face {
    border-radius: 14px;
    outline: none !important;
}

.cropper-footer {
    flex-shrink: 0;
    padding: 20px;
    text-align: center;
    color: #666;
    font-size: 0.85rem;
    background: #111111;
    border-top: 1px solid #222;
}

/*  ИНФО-КОЛОНКА (Имя, Позиция, Статус) */
.info-column {
    display: flex;
    flex-direction: column;
    justify-content: center;
    flex: 1;
    min-width: 0;
}

.name-row {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 4px;
}

.user-name {
    font-size: 1.6rem;
    font-weight: 650;
    color: white;
    margin: 0;
}

.user-position {
    font-size: 1.11rem;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 18px;
    font-weight: 500;
}

.status-pulsing-dot {
    position: absolute;
    bottom: 6px;
    right: 6px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    z-index: 20;
    border: 2px solid #fff;
    transition: background-color 0.4s ease, box-shadow 0.4s ease;
}

/* Состояние: В активном поиске */
.status-pulsing-dot.open-to-work {
    background-color: #10B981;
}

/* Состояние: Не ищу работу */
.status-pulsing-dot.not-looking {
    background-color: #94a3b8;
}

/* САЙДБАР-ОСТРОВ (NAVIGATION)*/
.sidebar {
    grid-area: sidebar;
    padding: 30px 15px;
    align-self: start;
    position: sticky;
    top: 82px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* (ИНЛАЙН-РЕДАКТИРОВАНИЕ) */
.editable-card.island-inner {
    padding: 1.5rem;
    background: #ffffff;
    border-radius: 16px;
    border: 2px solid #eef2f6;
    transition: all 0.25s ease;
    cursor: pointer;
    position: relative;
    margin-bottom: 24px;
}

.editable-card.island-inner:hover {
    background: #f8faff;
    transform: translateY(-2px);
    border-color: rgba(37, 99, 235, 0.16);
    box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.block-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #94a3b8;
    font-weight: 700;
}

.edit-hint {
    font-size: 0.75rem;
    color: var(--primary);
    opacity: 0;
    transition: opacity 0.2s;
}

.editable-card.island-inner:hover .edit-hint {
    opacity: 1;
    transform: translateX(0);
}

.inline-form {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

/* Кнопки управления */
.edit-actions-inline {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 10px;
    padding-top: 20px;
    border-top: 1px solid #f1f5f9;
}

.btn-save,
.btn-cancel {
    padding: 6px 16px;
    border-radius: 10px;
    font-weight: 550;
    font-size: 0.9rem;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.btn-save {
    background: var(--primary);
    color: var(--white);
}

.btn-save:hover {
    border: 1px solid rgba(37, 99, 235, 0.08);
    box-shadow: 0 0 3px 1px var(--primary, #2563eb);
}

.btn-cancel {
    background: #f1f5f9;
    color: #64748b;
}

.btn-cancel:hover {
    background: #e2e8f0;
    color: #1e293b;
    border: 1px solid rgba(148, 163, 184, 0.12);
    box-shadow: 0 0 4px 1px rgba(148, 163, 184, 0.3);
}

/* Активное нажатие */
.btn-save:active,
.btn-cancel:active {
    transform: scale(0.96);
}

.btn-delete {
    background: none;
    border: none;
    padding: 0;
    margin-right: auto;
    color: #94a3b8;
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;

    display: flex;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-delete:hover {
    color: #ef4444;
}

.btn-delete::before {
    content: '✕';
    font-size: 0.9rem;
}

/* Кнопка (+Добавить)*/
.btn-add-inline {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.2s;
}

.btn-add-inline:hover {
    background: rgba(var(--primary), 0.1);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 400;
    color: #94a3b8;
}

/* Поля ввода (Inputs, Selects, Textareas) */
.form-input,
.form-select,
.form-textarea {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    font-size: 0.85rem;
    border-radius: 12px;
    font-family: inherit;
    color: #1e293b;
    background-color: #ffffff;
    outline: none;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 0 8px 3px rgba(59, 130, 246, 0),
    0 4px 20px rgba(59, 130, 246, 0);
    transition: border-color 0.45s cubic-bezier(0.25, 0.8, 0.25, 1),
    box-shadow 0.45s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Для браузера Safari */
.form-select {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%2394a3b8'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 16px center;
    background-size: 16px;
    padding-right: 40px;
}

/* Стилизация текстовых областей (Textarea) */
.form-textarea {
    font-size: 0.90rem;
    min-height: 250px;
    width: 100%;
    resize: vertical;
    line-height: 1.6;
    margin-bottom: 8px;
    overflow-y: auto;
    font-weight: 400;
}

.form-textarea::placeholder,
.form-input::placeholder {
    font-size: 0.85rem;
    color: #94a3b8;
    font-weight: 400;
    opacity: 0.8;
}

.form-textarea:focus::placeholder {
    opacity: 0.4;
    transition: opacity 0.2s ease;
}

/* Состояния фокуса */
.form-input:focus,
.form-select:focus,
.form-textarea:focus {
    border-color: rgba(59, 130, 246, 0.5);
    background-color: #ffffff;
    box-shadow: 0 0 8px 2px rgba(59, 130, 246, 0.3),
    0 4px 15px rgba(59, 130, 246, 0.1);
}

/* Группа зарплаты: Инпут + Валюта */
.salary-inline-group {
    display: grid;
    grid-template-columns: 1fr 85px;
    gap: 10px;
}

.char-counter {
    text-align: right;
    font-size: 0.75rem;
    color: #94a3b8;
    margin-top: 4px;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-weight: 500;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 15px;
    height: 15px;
    margin-top: 2px;
    cursor: pointer;
    accent-color: var(--primary-light);
}

/* Контейнер строки поиска */
.search-bar-container {
    position: relative;
    margin-bottom: 19px;
    flex: 1;
}

.search-bar-container .form-input {
    width: 100%;
    padding: 0 16px 0 45px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    font-size: 0.85rem;
    transition: all 0.3s ease;
    background-color: #ffffff;
    outline: none;
    height: 40px;
    line-height: 44px;
    box-sizing: border-box;
}

.search-bar-container .form-input:focus {
    border-color: #3b82f6;
}

/* Иконка лупы внутри контейнера */
.search-bar-container::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    background-color: #94a3b8;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='currentColor'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z'%3E%3C/path%3E%3C/svg%3E") no-repeat center;
    z-index: 1;
    pointer-events: none;
}

/* Изменяем цвет иконки при фокусе на инпуте */
.search-bar-container:focus-within::before {
    background-color: #3b82f6;
}

/* =========================================================
   RESPONSIVE — PROFILE
   ========================================================= */


/* =========================================================
   TABLET — до 1100px
   ========================================================= */

@media (max-width: 1100px) {

    /* -------------------------
       MAIN GRID
       ------------------------- */

    .main-content-grid {
        gap: 10px;
        padding: 0 2px;
    }

    .content-area {
        padding: 12px;
    }


    /* -------------------------
       SIDEBAR
       ------------------------- */

    .sidebar {
        padding: 25px 10px;
    }

    .nav-link {
        padding: 11px 13px;
        font-size: 0.92rem;
    }


    /* -------------------------
       HERO
       ------------------------- */

    .hero-content-horizontal {
        gap: 20px;
        padding: 0 35px;
    }

    .avatar-container-hero {
        width: 115px;
        height: 115px;
        border-radius: 21px;
    }

    .avatar-text-placeholder {
        font-size: 2.7rem;
    }

    .user-name {
        font-size: 1.45rem;
    }

    .user-position {
        font-size: 1rem;
        margin-bottom: 14px;
    }


    /* -------------------------
       CARDS
       ------------------------- */

    .editable-card.island-inner {
        padding: 1.35rem;
        margin-bottom: 20px;
    }


    /* -------------------------
       FORMS
       ------------------------- */

    .form-row {
        gap: 12px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 13px 14px;
    }

    .form-textarea {
        min-height: 220px;
    }

    .salary-inline-group {
        grid-template-columns: minmax(0, 1fr) 80px;
    }
}


/* =========================================================
   TABLET / SMALL LAPTOP — до 992px
   ========================================================= */

@media (max-width: 992px) {

    /* -------------------------
       MAIN GRID
       ------------------------- */

    .main-content-grid {
        /*
         * Sidebar остаётся слева,
         * но становится уже.
         */
        grid-template-columns: minmax(150px, var(--sidebar-width)) minmax(0, 1fr);
        gap: 10px;
    }

    .right-column-wrapper {
        min-width: 0;
    }


    /* -------------------------
       SIDEBAR
       ------------------------- */

    .sidebar {
        min-width: 0;
        overflow: hidden;
    }

    .sidebar-nav {
        width: 100%;
    }

    .nav-link {
        display: flex;
        align-items: center;

        min-width: 0;

        padding: 11px 12px;

        font-size: 0.88rem;
    }

    .nav-link span {
        overflow: hidden;
        text-overflow: ellipsis;
    }


    /* -------------------------
       HERO
       ------------------------- */

    .profile-hero {
        height: 220px;
    }

    .hero-content-horizontal {
        padding: 0 28px;
        gap: 18px;
    }

    .avatar-container-hero {
        width: 105px;
        height: 105px;
        border-radius: 20px;
    }

    .avatar-text-placeholder {
        font-size: 2.5rem;
    }

    .user-name {
        font-size: 1.35rem;
    }

    .user-position {
        font-size: 0.95rem;
    }
}


/* =========================================================
   MOBILE — до 768px
   ========================================================= */

@media (max-width: 768px) {

    /* -------------------------
       CONTENT
       ------------------------- */

    .content-area {
        padding: 10px;
        margin-bottom: 8px;
    }


    /* -------------------------
       MAIN GRID
       ------------------------- */

    .main-content-grid {
        display: flex;
        flex-direction: column;

        width: 100%;
        max-width: var(--max-width);

        gap: 8px;

        margin-top: 8px;
        padding: 0;

        box-sizing: border-box;
    }

    .right-column-wrapper {
        width: 100%;
        min-width: 0;
    }


    /* -------------------------
       SIDEBAR
       ------------------------- */

    .sidebar {
        position: static;

        width: 100%;
        min-width: 0;

        padding: 0;

        overflow-x: auto;
        overflow-y: hidden;

        /*
         * Убираем scrollbar,
         * но оставляем горизонтальный scroll.
         */
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    .sidebar::-webkit-scrollbar {
        display: none;
    }

    .sidebar-nav {
        display: flex;
        flex-direction: row;

        width: max-content;
        min-width: 100%;

        gap: 6px;

        padding: 2px 2px 4px;
    }

    .nav-link {
        flex: 0 0 auto;

        white-space: nowrap;

        padding: 9px 13px;

        border-radius: 10px;

        font-size: 0.86rem;
    }

    .nav-icon-img {
        width: 11px;
        height: 11px;
        margin-right: 4px;
    }


    /* -------------------------
       HERO
       ------------------------- */

    .profile-hero {
        height: auto;
        min-height: 190px;

        padding: 25px 0;
        box-sizing: border-box;

        align-items: center;
    }

    .hero-content-horizontal {
        display: flex;
        align-items: center;

        gap: 16px;

        padding: 0 22px;

        box-sizing: border-box;
    }

    .avatar-container-hero {
        width: 90px;
        height: 90px;

        border-radius: 18px;

        box-shadow: 0 8px 22px rgba(0, 0, 0, 0.18);
    }

    .avatar-text-placeholder {
        font-size: 2.2rem;
    }

    .camera-icon {
        width: 24px;
        height: 24px;
    }

    .info-column {
        min-width: 0;
    }

    .name-row {
        gap: 9px;
        margin-bottom: 3px;
    }

    .user-name {
        font-size: 1.25rem;

        /*
         * Длинное имя не должно
         * раздвигать hero.
         */
        min-width: 0;
        overflow-wrap: anywhere;
    }

    .user-position {
        font-size: 0.9rem;
        line-height: 1.4;

        margin-bottom: 10px;

        overflow-wrap: anywhere;
    }


    /* -------------------------
       CARDS
       ------------------------- */

    .editable-card.island-inner {
        padding: 1.15rem;

        margin-bottom: 14px;

        border-radius: 14px;
    }

    .card-header {
        margin-bottom: 0.65rem;
    }

    .block-label {
        font-size: 0.76rem;
    }

    .edit-hint {
        display: none;
    }


    /* -------------------------
       FORMS
       ------------------------- */

    .inline-form {
        gap: 13px;
    }

    .form-row {
        grid-template-columns: 1fr;
        gap: 13px;
    }

    .form-group {
        gap: 5px;
    }

    .form-group label {
        font-size: 0.82rem;
    }

    .form-input,
    .form-select,
    .form-textarea {
        width: 100%;
        box-sizing: border-box;

        padding: 12px 13px;

        font-size: 0.88rem;

        border-radius: 10px;
    }

    .form-select {
        padding-right: 38px;

        background-position: right 13px center;
        background-size: 15px;
    }

    .form-textarea {
        min-height: 190px;

        line-height: 1.55;
    }

    .form-textarea::placeholder,
    .form-input::placeholder {
        font-size: 0.82rem;
    }


    /* -------------------------
       SALARY
       ------------------------- */

    .salary-inline-group {
        grid-template-columns: minmax(0, 1fr) 78px;
        gap: 8px;
    }


    /* -------------------------
       EDIT ACTIONS
       ------------------------- */

    .edit-actions-inline {
        gap: 8px;

        margin-top: 8px;
        padding-top: 15px;

        flex-wrap: wrap;
    }

    .btn-save,
    .btn-cancel {
        padding: 7px 14px;
        font-size: 0.86rem;
    }

    .btn-delete {
        font-size: 0.76rem;
    }


    /* -------------------------
       SEARCH
       ------------------------- */

    .search-bar-container {
        margin-bottom: 14px;
        width: 100%;
    }

    .search-bar-container .form-input {
        height: 42px;

        padding-left: 42px;
        padding-right: 13px;

        font-size: 0.88rem;

        line-height: normal;
    }

    .search-bar-container::before {
        left: 14px;

        width: 18px;
        height: 18px;
    }


    /* -------------------------
       CHECKBOX
       ------------------------- */

    .checkbox-label {
        gap: 9px;
        font-size: 0.88rem;
    }


    /* -------------------------
       COUNTER
       ------------------------- */

    .char-counter {
        font-size: 0.72rem;
        margin-top: 3px;
    }
}


/* =========================================================
   SMALL MOBILE — до 576px
   ========================================================= */

@media (max-width: 576px) {

    .content-area {
        padding: 8px;
    }


    /* -------------------------
       NAVIGATION
       ------------------------- */

    .sidebar-nav {
        gap: 5px;
        padding: 1px 1px 4px;
    }

    .nav-link {
        padding: 8px 11px;
        font-size: 0.82rem;
        border-radius: 9px;
    }


    /* -------------------------
       HERO
       ------------------------- */

    .profile-hero {
        min-height: 175px;
        padding: 20px 0;
    }

    .hero-content-horizontal {
        padding: 0 16px;
        gap: 13px;
    }

    .avatar-container-hero {
        width: 78px;
        height: 78px;
        border-radius: 16px;
    }

    .avatar-text-placeholder {
        font-size: 1.9rem;
    }

    .camera-icon {
        width: 21px;
        height: 21px;
    }

    .user-name {
        font-size: 1.12rem;
    }

    .user-position {
        font-size: 0.84rem;
        line-height: 1.35;
        margin-bottom: 7px;
    }

    .name-row {
        gap: 7px;
    }

    .status-pulsing-dot {
        width: 12px;
        height: 12px;

        bottom: 5px;
        right: 5px;

        border-width: 2px;
    }


    /* -------------------------
       CARDS
       ------------------------- */

    .editable-card.island-inner {
        padding: 1rem;

        margin-bottom: 12px;

        border-radius: 13px;
    }

    .block-label {
        font-size: 0.73rem;
    }


    /* -------------------------
       FORMS
       ------------------------- */

    .form-input,
    .form-select,
    .form-textarea {
        padding: 11px 12px;
        font-size: 0.86rem;
    }

    .form-select {
        padding-right: 36px;
        background-position: right 12px center;
    }

    .form-textarea {
        min-height: 170px;
    }


    /* -------------------------
       SALARY
       ------------------------- */

    .salary-inline-group {
        grid-template-columns: minmax(0, 1fr) 72px;
        gap: 7px;
    }


    /* -------------------------
       BUTTONS
       ------------------------- */

    .edit-actions-inline {
        /*
         * Delete остаётся слева,
         * Save/Cancel справа.
         * Если места мало — перенос.
         */
        gap: 7px;
    }

    .btn-save,
    .btn-cancel {
        padding: 7px 12px;
        font-size: 0.82rem;
        border-radius: 9px;
    }

    .btn-delete {
        font-size: 0.73rem;
    }


    /* -------------------------
       SEARCH
       ------------------------- */

    .search-bar-container .form-input {
        height: 40px;
        padding-left: 40px;
        font-size: 0.84rem;
    }

    .search-bar-container::before {
        left: 13px;
        width: 17px;
        height: 17px;
    }
}


/* =========================================================
   VERY SMALL MOBILE — до 400px
   ========================================================= */

@media (max-width: 400px) {

    .content-area {
        padding: 6px;
    }


    /* -------------------------
       HERO
       ------------------------- */

    .profile-hero {
        min-height: 160px;
        padding: 17px 0;
    }

    .hero-content-horizontal {
        padding: 0 13px;
        gap: 11px;
    }

    .avatar-container-hero {
        width: 68px;
        height: 68px;
        border-radius: 14px;
    }

    .avatar-text-placeholder {
        font-size: 1.7rem;
    }

    .camera-icon {
        width: 19px;
        height: 19px;
    }

    .user-name {
        font-size: 1.02rem;
    }

    .user-position {
        font-size: 0.78rem;
    }


    /* -------------------------
       CARDS
       ------------------------- */

    .editable-card.island-inner {
        padding: 0.85rem;
        border-radius: 12px;
    }


    /* -------------------------
       FORMS
       ------------------------- */

    .form-row {
        gap: 11px;
    }

    .form-input,
    .form-select,
    .form-textarea {
        padding: 10px 11px;
        font-size: 0.84rem;
    }

    .form-textarea {
        min-height: 155px;
    }

    .form-select {
        padding-right: 34px;
    }


    /* -------------------------
       SALARY
       ------------------------- */

    .salary-inline-group {
        grid-template-columns: minmax(0, 1fr) 68px;
        gap: 6px;
    }


    /* -------------------------
       ACTIONS
       ------------------------- */

    .edit-actions-inline {
        align-items: center;
    }

    .btn-save,
    .btn-cancel {
        padding: 7px 10px;
        font-size: 0.8rem;
    }
}


/* =========================================================
   ULTRA SMALL — до 340px
   ========================================================= */

@media (max-width: 340px) {

    .content-area {
        padding: 5px;
    }


    /* -------------------------
       HERO
       ------------------------- */

    .hero-content-horizontal {
        padding: 0 10px;
        gap: 9px;
    }

    .avatar-container-hero {
        width: 60px;
        height: 60px;
    }

    .avatar-text-placeholder {
        font-size: 1.5rem;
    }

    .user-name {
        font-size: 0.95rem;
    }

    .user-position {
        font-size: 0.74rem;
    }


    /* -------------------------
       CARD
       ------------------------- */

    .editable-card.island-inner {
        padding: 0.75rem;
    }


    /* -------------------------
       SALARY
       ------------------------- */

    .salary-inline-group {
        grid-template-columns: minmax(0, 1fr) 64px;
    }


    /* -------------------------
       ACTIONS
       ------------------------- */

    .edit-actions-inline {
        justify-content: flex-start;
    }

    .btn-delete {
        width: 100%;
        margin-right: 0;
        margin-bottom: 3px;
    }
}


/* =========================================================
   CROPPER — MOBILE
   ========================================================= */

@media (max-width: 576px) {

    .cropper-header {
        padding: 12px 14px;
    }

    .cropper-title {
        font-size: 0.95rem;
        letter-spacing: 0.2px;
    }

    .cropper-cancel,
    .cropper-confirm {
        padding: 8px 9px;
        font-size: 0.88rem;
    }

    .cropper-footer {
        padding: 14px 12px;

        font-size: 0.78rem;
    }
}


/* =========================================================
   CROPPER — VERY SMALL MOBILE
   ========================================================= */

@media (max-width: 400px) {

    .cropper-header {
        padding: 10px 9px;
    }

    .cropper-title {
        font-size: 0.88rem;
    }

    .cropper-cancel,
    .cropper-confirm {
        padding: 7px 6px;
        font-size: 0.82rem;
    }

    .cropper-footer {
        padding: 11px 9px;
        font-size: 0.74rem;
    }
}


/* =========================================================
   TOUCH DEVICES
   ========================================================= */

@media (hover: none) and (pointer: coarse) {

    /*
     * На телефоне hover не нужен.
     * Не оставляем элементы в "полуактивном"
     * состоянии из-за touch.
     */

    .editable-card.island-inner:hover {
        background: #ffffff;
        border-color: #f1f5f9;
    }

    .nav-link:hover:not(.active) {
        background: transparent;
        color: var(--text-gray);
    }

    .about-btn-hint:hover,
    .btn-save:hover,
    .btn-cancel:hover {
        box-shadow: none;
    }

    .avatar-container-hero:hover .avatar-overlay {
        opacity: 0;
    }

    /*
     * Но если аватар действительно находится
     * в состоянии загрузки — overlay остаётся.
     */
    .avatar-container-hero.is-uploading .avatar-overlay {
        opacity: 1;
    }
}

/* =========================================================
   IOS SAFARI — ЗАЩИТА ОТ ZOOM ПРИ ФОКУСЕ
   ========================================================= */

@media (max-width: 768px) {

    input,
    select,
    textarea,
    .form-input,
    .form-select,
    .form-textarea {
        font-size: 16px !important;
    }

    .form-input::placeholder,
    .form-textarea::placeholder {
        font-size: 16px !important;
    }
}