@media (min-width: 600px) {

    /* ========== БАЗОВЫЙ ЛЕЙАУТ ========== */

    html {
        background: #0f172a;
        height: 100% !important;
        overflow: hidden !important;
    }

    html::before {
        content: "";
        position: fixed;
        inset: 0;
        z-index: -1;
        background:
            radial-gradient(ellipse 60% 50% at 20% 30%, rgba(59,130,246,0.12) 0%, transparent 70%),
            radial-gradient(ellipse 50% 40% at 80% 70%, rgba(99,102,241,0.10) 0%, transparent 70%),
            #0f172a;
    }

    body {
        width: 720px !important;
        min-width: 720px !important;
        max-width: 720px !important;
        margin: 24px auto !important;
        height: calc(100vh - 48px) !important;
        min-height: unset !important;
        display: flex !important;
        flex-direction: column !important;
        overflow: hidden !important;
        border-radius: 32px !important;
        box-shadow:
            0 0 0 1px rgba(255,255,255,0.08),
            0 32px 80px rgba(0,0,0,0.7),
            0 8px 24px rgba(0,0,0,0.5);
        padding-bottom: 0 !important;
        position: relative !important;
    }

    /* Жёсткое ограничение ширины */
    body * {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* Header — прибит сверху */
    body > header {
        position: relative !important;
        top: auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        z-index: 50 !important;
    }

    /* Main — скроллится */
    body > main {
        flex: 1 1 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        -webkit-overflow-scrolling: touch !important;
        padding-bottom: 0 !important;
        min-height: 0 !important;
    }

    body > main::-webkit-scrollbar { width: 0; }

    /* Nav — прибит снизу */
    body > nav {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        z-index: 100 !important;
    }

    /* ========== СТРАНИЦЫ БЕЗ NAV (create-vacancy, edit-vacancy) ========== */
    /* .actions как нижняя панель */

    body:has(> .actions) {
        height: calc(100vh - 48px) !important;
        overflow: hidden !important;
    }

    body:has(> .actions) > main {
        flex: 1 1 0 !important;
        overflow-y: auto !important;
        overflow-x: hidden !important;
        min-height: 0 !important;
    }

    body:has(> .actions) > .actions {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        display: flex !important;
        justify-content: center !important;
    }

    body:has(> .actions) > .actions .actions-content {
        width: 100% !important;
        max-width: 100% !important;
        display: flex !important;
        gap: 12px !important;
    }

    body:has(> .actions) > .actions .btn {
        flex: 1 1 0 !important;
        max-width: none !important;
        width: auto !important;
    }

    /* ========== КНОПКИ CV/AI/НАПИСАТЬ В КАРТОЧКАХ ========== */

    body .actions {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: stretch !important;
    }

    body .actions > button,
    body .actions > a {
        max-width: none !important;
        flex: 1 1 0 !important;
        min-width: 0 !important;
        width: auto !important;
    }

    /* ========== КНОПКА ОТКЛИКНУТЬСЯ (vacancy.php) ========== */

    body > .apply-footer {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
    }

    /* ========== ПОЛЕ ВВОДА ЧАТА ========== */

    body > .input-container {
        position: relative !important;
        bottom: auto !important;
        left: auto !important;
        right: auto !important;
        flex-shrink: 0 !important;
        width: 100% !important;
        z-index: 100 !important;
    }

    /* ========== FIXED → ABSOLUTE (привязка к контейнеру) ========== */

    .loader-overlay,
    .chat-loader,
    .image-modal,
    .modal-overlay,
    .modal,
    .filter-overlay,
    .call-overlay,
    .call-panel,
    .cv-modal-overlay {
        position: absolute !important;
    }

    .loader-overlay,
    .chat-loader,
    .image-modal,
    .modal-overlay,
    .modal,
    .filter-overlay,
    .call-overlay,
    .cv-modal-overlay {
        inset: 0 !important;
    }

    .call-panel {
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        max-height: 70% !important;
    }

    .save-bar {
        position: absolute !important;
        left: 16px !important;
        right: 16px !important;
        bottom: 86px !important;
    }

    #saveToast {
        position: absolute !important;
        top: 76px !important;
        left: 16px !important;
        right: 16px !important;
    }

    .fab {
        position: absolute !important;
        bottom: 90px !important;
        right: 20px !important;
    }

    .edits-counter {
        position: absolute !important;
        top: 80px !important;
        left: 16px !important;
        right: 16px !important;
    }

    .loading-screen {
        position: absolute !important;
        inset: 0 !important;
    }

    .success-notification {
        position: absolute !important;
        top: 20px !important;
        left: 50% !important;
        transform: translateX(-50%) translateY(-100px) !important;
    }

    .success-notification.show {
        transform: translateX(-50%) translateY(0) !important;
    }

    /* ========== CV МОДАЛКА ========== */

    .cv-modal-overlay {
        clip-path: inset(0) !important;
    }

    .cv-modal {
        max-height: 88% !important;
        width: 100% !important;
        max-width: 720px !important;
    }

    .cv-modal-body {
        overflow-y: auto !important;
        max-height: calc(88% - 73px) !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .cv-modal-body::-webkit-scrollbar { width: 0 !important; }

    /* ========== ПРОЧЕЕ ========== */

    button, input, textarea, select {
        max-width: 100% !important;
    }

    body > main::-webkit-scrollbar { width: 0; }
    body::-webkit-scrollbar { width: 0; }
}

/* ---- CV модалка: скролл внутри ---- */
@media (min-width: 600px) {

    .cv-modal {
        overflow: visible !important;
        display: flex !important;
        flex-direction: column !important;
        max-height: 88% !important;
    }

    .cv-modal-header {
        flex-shrink: 0 !important;
    }

    .cv-modal-body {
        flex: 1 1 0 !important;
        overflow-y: auto !important;
        min-height: 0 !important;
        max-height: none !important;
        -webkit-overflow-scrolling: touch !important;
    }

    .cv-modal-body::-webkit-scrollbar { width: 0 !important; }
}

/* ---- CV модалка: финальный фикс скролла ---- */
@media (min-width: 600px) {

    .cv-modal-overlay {
        align-items: flex-end !important;
    }

    .cv-modal {
        overflow: hidden !important;
        display: flex !important;
        flex-direction: column !important;
        max-height: 80% !important;
        width: 100% !important;
        border-radius: 24px 24px 0 0 !important;
    }

    .cv-modal-header {
        flex-shrink: 0 !important;
        position: relative !important;
    }

    .cv-modal-body {
        flex: 1 1 auto !important;
        overflow-y: scroll !important;
        min-height: 0 !important;
        max-height: none !important;
        -webkit-overflow-scrolling: touch !important;
    }
}
